release.go 4.0 KB

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