2
0

release.go 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. package types
  2. import (
  3. "github.com/stefanmcshane/helm/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. PorterVersion uint `json:"porter_version,omitempty"`
  12. AppRevisionId string `json:"app_revision_id,omitempty"`
  13. Form *FormYAML `json:"form,omitempty"`
  14. }
  15. type PorterRelease struct {
  16. // The ID of this Porter release
  17. ID uint `json:"id"`
  18. // The webhook token used to secure Github repository webhooks
  19. WebhookToken string `json:"webhook_token"`
  20. // The latest version of this Porter release
  21. LatestVersion string `json:"latest_version"`
  22. // Configuration regarding the connected git repository
  23. GitActionConfig *GitActionConfig `json:"git_action_config,omitempty"`
  24. // The complete image repository URI for this release
  25. ImageRepoURI string `json:"image_repo_uri"`
  26. // The build configuration for this release when using buildpacks
  27. BuildConfig *BuildConfig `json:"build_config,omitempty"`
  28. // The list of tags for this release
  29. Tags []string `json:"tags,omitempty"`
  30. // Whether this release is tied to a stack or not
  31. StackID string `json:"stack_id"`
  32. // The canonical name of this release
  33. CanonicalName string `json:"canonical_name"`
  34. }
  35. // swagger:model
  36. type GetReleaseResponse Release
  37. type UpdateNotificationConfigRequest struct {
  38. Payload struct {
  39. Enabled bool `json:"enabled"`
  40. Success bool `json:"success"`
  41. Failure bool `json:"failure"`
  42. } `json:"payload"`
  43. }
  44. type CreateReleaseBaseRequest struct {
  45. // The repository URL for this release
  46. RepoURL string `json:"repo_url,omitempty" schema:"repo_url"`
  47. // the Porter charts templated name
  48. // required: true
  49. TemplateName string `json:"template_name" form:"required"`
  50. // The Porter charts template version
  51. // required: true
  52. TemplateVersion string `json:"template_version" form:"required"`
  53. // The Helm values for this release
  54. Values map[string]interface{} `json:"values"`
  55. // The name of this release
  56. // required: true
  57. Name string `json:"name" form:"required,dns1123"`
  58. }
  59. // swagger:model
  60. type CreateReleaseRequest struct {
  61. *CreateReleaseBaseRequest
  62. // The repository image URL for this release
  63. // required: true
  64. ImageURL string `json:"image_url" form:"required"`
  65. // Configuration regarding the connected git repository
  66. GitActionConfig *CreateGitActionConfigRequest `json:"git_action_config,omitempty"`
  67. // Build configuration options for this release
  68. BuildConfig *CreateBuildConfigRequest `json:"build_config,omitempty"`
  69. // The list of tags for this release
  70. Tags []string `json:"tags,omitempty"`
  71. // The list of synced environment groups for this release
  72. SyncedEnvGroups []string `json:"synced_env_groups,omitempty"`
  73. }
  74. type CreateAddonRequest struct {
  75. *CreateReleaseBaseRequest
  76. HelmRepoID uint `json:"helm_repo_id"`
  77. }
  78. type RollbackReleaseRequest struct {
  79. Revision int `json:"revision" form:"required"`
  80. }
  81. // swagger:model UpdateReleaseRequest
  82. type V1UpgradeReleaseRequest struct {
  83. // The Helm values to upgrade the release with
  84. // required: true
  85. Values map[string]interface{} `json:"values" form:"required"`
  86. // The Porter charts version to upgrade the release with
  87. ChartVersion string `json:"version"`
  88. // (optional) if set, the backend will validate that the user was upgrading from the revision specified by
  89. // LatestRevision, and there hasn't been an upgrade in the meantime.
  90. LatestRevision uint `json:"latest_revision"`
  91. }
  92. type UpgradeReleaseRequest struct {
  93. Values string `json:"values" form:"required"`
  94. ChartVersion string `json:"version"`
  95. // (optional) if set, the backend will validate that the user was upgrading from the revision specified by
  96. // LatestRevision, and there hasn't been an upgrade in the meantime.
  97. LatestRevision uint `json:"latest_revision"`
  98. // Required to ignore dependecies when we read releases for umbrella charts, because their subcharts aren't Porter charts https://github.com/helm/helm/issues/9214
  99. IgnoreDependencies bool
  100. }
  101. type UpdateImageBatchRequest struct {
  102. ImageRepoURI string `json:"image_repo_uri" form:"required"`
  103. Tag string `json:"tag" form:"required"`
  104. }
  105. type GetJobsStatusResponse struct {
  106. Status string `json:"status,omitempty"`
  107. StartTime *metav1.Time `json:"start_time,omitempty"`
  108. }
  109. const URLParamToken URLParam = "token"
  110. type WebhookRequest struct {
  111. Commit string `schema:"commit"`
  112. // NOTICE: deprecated. This field should no longer be used; it is not supported
  113. // internally.
  114. Repository string `schema:"repository"`
  115. }
  116. type GetGHATemplateRequest struct {
  117. ReleaseName string `json:"release_name"`
  118. GithubActionConfig *CreateGitActionConfigRequest `json:"github_action_config" form:"required"`
  119. }
  120. type GetGHATemplateResponse string
  121. type GetReleaseStepsResponse []SubEvent
  122. type SubEvent struct {
  123. EventID string `json:"event_id"`
  124. Name string `json:"name"`
  125. Index int64 `json:"index"`
  126. Status EventStatus `json:"status"`
  127. Info string `json:"info"`
  128. Time int64 `json:"time"`
  129. }
  130. type EventStatus int64
  131. const (
  132. EventStatusSuccess EventStatus = 1
  133. EventStatusInProgress = 2
  134. EventStatusFailed = 3
  135. )
  136. type UpdateReleaseStepsRequest struct {
  137. Event SubEvent `json:"event" form:"required"`
  138. }
  139. type NotificationConfig struct {
  140. Enabled bool `json:"enabled"`
  141. Success bool `json:"success"`
  142. Failure bool `json:"failure"`
  143. NotifLimit string `json:"notif_limit"`
  144. }
  145. type GetNotificationConfigResponse struct {
  146. *NotificationConfig
  147. }
  148. type DNSRecord struct {
  149. ExternalURL string `json:"external_url"`
  150. Endpoint string `json:"endpoint"`
  151. Hostname string `json:"hostname"`
  152. ClusterID uint `json:"cluster_id"`
  153. }
  154. type GetReleaseAllPodsResponse []v1.Pod
  155. type PatchUpdateReleaseTags struct {
  156. Tags []string `json:"tags"`
  157. }
  158. type PartialGitActionConfig struct {
  159. // The branch to use for the git repository
  160. // required: true
  161. GitBranch string `json:"git_branch" form:"required"`
  162. }
  163. type UpdateGitActionConfigRequest struct {
  164. GitActionConfig *PartialGitActionConfig `json:"git_action_config"`
  165. }
  166. type UpdateCanonicalNameRequest struct {
  167. CanonicalName string `json:"canonical_name"`
  168. }