release.go 3.9 KB

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