git_action.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package forms
  2. import (
  3. "github.com/porter-dev/porter/internal/models"
  4. )
  5. // CreateGitAction represents the accepted values for creating a
  6. // github action integration
  7. type CreateGitAction struct {
  8. ReleaseID uint `json:"release_id" form:"required"`
  9. GitRepo string `json:"git_repo" form:"required"`
  10. ImageRepoURI string `json:"image_repo_uri" form:"required"`
  11. DockerfilePath string `json:"dockerfile_path" form:"required"`
  12. GitRepoID uint `json:"git_repo_id" form:"required"`
  13. BuildEnv map[string]string `json:"env"`
  14. RegistryID uint `json:"registry_id"`
  15. }
  16. // ToGitActionConfig converts the form to a gorm git action config model
  17. func (ca *CreateGitAction) ToGitActionConfig() (*models.GitActionConfig, error) {
  18. return &models.GitActionConfig{
  19. ReleaseID: ca.ReleaseID,
  20. GitRepo: ca.GitRepo,
  21. ImageRepoURI: ca.ImageRepoURI,
  22. DockerfilePath: ca.DockerfilePath,
  23. GitRepoID: ca.GitRepoID,
  24. }, nil
  25. }
  26. type CreateGitActionOptional struct {
  27. GitRepo string `json:"git_repo"`
  28. ImageRepoURI string `json:"image_repo_uri"`
  29. DockerfilePath string `json:"dockerfile_path"`
  30. GitRepoID uint `json:"git_repo_id"`
  31. BuildEnv map[string]string `json:"env"`
  32. RegistryID uint `json:"registry_id"`
  33. }