release.go 5.6 KB

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