release.go 3.6 KB

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