release.go 3.8 KB

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