release.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. package types
  2. import (
  3. "helm.sh/helm/v3/pkg/release"
  4. v1 "k8s.io/api/core/v1"
  5. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  6. )
  7. // Release is a helm release with a form attached
  8. type Release struct {
  9. *release.Release
  10. *PorterRelease
  11. Form *FormYAML `json:"form,omitempty"`
  12. }
  13. type PorterRelease struct {
  14. ID uint `json:"id"`
  15. WebhookToken string `json:"webhook_token"`
  16. LatestVersion string `json:"latest_version"`
  17. GitActionConfig *GitActionConfig `json:"git_action_config,omitempty"`
  18. ImageRepoURI string `json:"image_repo_uri"`
  19. BuildConfig *BuildConfig `json:"build_config,omitempty"`
  20. Tags []string `json:"tags,omitempty"`
  21. }
  22. // swagger:model
  23. type GetReleaseResponse Release
  24. type UpdateNotificationConfigRequest struct {
  25. Payload struct {
  26. Enabled bool `json:"enabled"`
  27. Success bool `json:"success"`
  28. Failure bool `json:"failure"`
  29. } `json:"payload"`
  30. }
  31. type CreateReleaseBaseRequest struct {
  32. RepoURL string `json:"-" schema:"repo_url"`
  33. TemplateName string `json:"template_name" form:"required"`
  34. TemplateVersion string `json:"template_version" form:"required"`
  35. Values map[string]interface{} `json:"values"`
  36. Name string `json:"name" form:"required"`
  37. }
  38. // swagger:model
  39. type CreateReleaseRequest struct {
  40. *CreateReleaseBaseRequest
  41. ImageURL string `json:"image_url" form:"required"`
  42. GithubActionConfig *CreateGitActionConfigRequest `json:"github_action_config,omitempty"`
  43. BuildConfig *CreateBuildConfigRequest `json:"build_config,omitempty"`
  44. Tags []string `json:"tags,omitempty"`
  45. SyncedEnvGroups []string `json:"synced_env_groups,omitempty"`
  46. }
  47. type CreateAddonRequest struct {
  48. *CreateReleaseBaseRequest
  49. HelmRepoID uint `json:"helm_repo_id"`
  50. }
  51. type RollbackReleaseRequest struct {
  52. Revision int `json:"revision" form:"required"`
  53. }
  54. // swagger:model UpdateReleaseRequest
  55. type UpgradeReleaseRequest struct {
  56. Values string `json:"values" form:"required"`
  57. ChartVersion string `json:"version"`
  58. }
  59. type UpdateImageBatchRequest struct {
  60. ImageRepoURI string `json:"image_repo_uri" form:"required"`
  61. Tag string `json:"tag" form:"required"`
  62. }
  63. type GetJobsStatusResponse struct {
  64. Status string `json:"status,omitempty"`
  65. StartTime *metav1.Time `json:"start_time,omitempty"`
  66. }
  67. const URLParamToken URLParam = "token"
  68. type WebhookRequest struct {
  69. Commit string `schema:"commit"`
  70. // NOTICE: deprecated. This field should no longer be used; it is not supported
  71. // internally.
  72. Repository string `schema:"repository"`
  73. }
  74. type GetGHATemplateRequest struct {
  75. ReleaseName string `json:"release_name"`
  76. GithubActionConfig *CreateGitActionConfigRequest `json:"github_action_config" form:"required"`
  77. }
  78. type GetGHATemplateResponse string
  79. type GetReleaseStepsResponse []SubEvent
  80. type SubEvent struct {
  81. EventID string `json:"event_id"`
  82. Name string `json:"name"`
  83. Index int64 `json:"index"`
  84. Status EventStatus `json:"status"`
  85. Info string `json:"info"`
  86. Time int64 `json:"time"`
  87. }
  88. type EventStatus int64
  89. const (
  90. EventStatusSuccess EventStatus = 1
  91. EventStatusInProgress = 2
  92. EventStatusFailed = 3
  93. )
  94. type UpdateReleaseStepsRequest struct {
  95. Event SubEvent `json:"event" form:"required"`
  96. }
  97. type NotificationConfig struct {
  98. Enabled bool `json:"enabled"`
  99. Success bool `json:"success"`
  100. Failure bool `json:"failure"`
  101. NotifLimit string `json:"notif_limit"`
  102. }
  103. type GetNotificationConfigResponse struct {
  104. *NotificationConfig
  105. }
  106. type DNSRecord struct {
  107. ExternalURL string `json:"external_url"`
  108. Endpoint string `json:"endpoint"`
  109. Hostname string `json:"hostname"`
  110. ClusterID uint `json:"cluster_id"`
  111. }
  112. type GetReleaseAllPodsResponse []v1.Pod
  113. type PatchUpdateReleaseTags struct {
  114. Tags []string `json:"tags"`
  115. }