release.go 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. IsStack bool `json:"is_stack"`
  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"`
  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. }
  85. type UpgradeReleaseRequest struct {
  86. Values string `json:"values" form:"required"`
  87. ChartVersion string `json:"version"`
  88. }
  89. type UpdateImageBatchRequest struct {
  90. ImageRepoURI string `json:"image_repo_uri" form:"required"`
  91. Tag string `json:"tag" form:"required"`
  92. }
  93. type GetJobsStatusResponse struct {
  94. Status string `json:"status,omitempty"`
  95. StartTime *metav1.Time `json:"start_time,omitempty"`
  96. }
  97. const URLParamToken URLParam = "token"
  98. type WebhookRequest struct {
  99. Commit string `schema:"commit"`
  100. // NOTICE: deprecated. This field should no longer be used; it is not supported
  101. // internally.
  102. Repository string `schema:"repository"`
  103. }
  104. type GetGHATemplateRequest struct {
  105. ReleaseName string `json:"release_name"`
  106. GithubActionConfig *CreateGitActionConfigRequest `json:"github_action_config" form:"required"`
  107. }
  108. type GetGHATemplateResponse string
  109. type GetReleaseStepsResponse []SubEvent
  110. type SubEvent struct {
  111. EventID string `json:"event_id"`
  112. Name string `json:"name"`
  113. Index int64 `json:"index"`
  114. Status EventStatus `json:"status"`
  115. Info string `json:"info"`
  116. Time int64 `json:"time"`
  117. }
  118. type EventStatus int64
  119. const (
  120. EventStatusSuccess EventStatus = 1
  121. EventStatusInProgress = 2
  122. EventStatusFailed = 3
  123. )
  124. type UpdateReleaseStepsRequest struct {
  125. Event SubEvent `json:"event" form:"required"`
  126. }
  127. type NotificationConfig struct {
  128. Enabled bool `json:"enabled"`
  129. Success bool `json:"success"`
  130. Failure bool `json:"failure"`
  131. NotifLimit string `json:"notif_limit"`
  132. }
  133. type GetNotificationConfigResponse struct {
  134. *NotificationConfig
  135. }
  136. type DNSRecord struct {
  137. ExternalURL string `json:"external_url"`
  138. Endpoint string `json:"endpoint"`
  139. Hostname string `json:"hostname"`
  140. ClusterID uint `json:"cluster_id"`
  141. }
  142. type GetReleaseAllPodsResponse []v1.Pod
  143. type PatchUpdateReleaseTags struct {
  144. Tags []string `json:"tags"`
  145. }
  146. type PartialGitActionConfig struct {
  147. // The branch to use for the git repository
  148. // required: true
  149. GitBranch string `json:"branch" form:"required"`
  150. }
  151. type UpdateGitActionConfigRequest struct {
  152. GitActionConfig *PartialGitActionConfig `json:"git_action_config"`
  153. }