app_revision.go 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package models
  2. import (
  3. "github.com/google/uuid"
  4. "gorm.io/gorm"
  5. )
  6. // AppRevisionStatus is the status of an app revision
  7. type AppRevisionStatus string
  8. const (
  9. // AppRevisionStatus_Created is the initial status for a revision when first inserted in database
  10. AppRevisionStatus_Created AppRevisionStatus = "CREATED"
  11. // AppRevisionStatus_AwaitingBuild is the status for a revision that still needs to be built
  12. AppRevisionStatus_AwaitingBuild AppRevisionStatus = "AWAITING_BUILD_ARTIFACT"
  13. // AppRevisionStatus_AwaitingPredeploy is the status for a revision that is waiting for a predeploy to complete.
  14. AppRevisionStatus_AwaitingPredeploy AppRevisionStatus = "AWAITING_PREDEPLOY"
  15. // AppRevisionStatus_Deployed is the status for a revision that has been deployed
  16. AppRevisionStatus_Deployed AppRevisionStatus = "DEPLOYED"
  17. // AppRevisionStatus_BuildCanceled is the status for a revision that was canceled during the build process
  18. AppRevisionStatus_BuildCanceled AppRevisionStatus = "BUILD_CANCELED"
  19. // AppRevisionStatus_BuildFailed is the status for a revision that failed to build
  20. AppRevisionStatus_BuildFailed AppRevisionStatus = "BUILD_FAILED"
  21. // AppRevisionStatus_PredeployFailed is the status for a revision that failed to predeploy
  22. AppRevisionStatus_PredeployFailed AppRevisionStatus = "PREDEPLOY_FAILED"
  23. // AppRevisionStatus_DeployFailed is the status for a revision that failed to deploy
  24. AppRevisionStatus_DeployFailed AppRevisionStatus = "DEPLOY_FAILED"
  25. )
  26. // AppRevision represents the full spec for a revision of a porter app
  27. type AppRevision struct {
  28. gorm.Model
  29. // ID is a UUID for the AppRevision
  30. ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
  31. // Base64App is the PorterApp as json encoded in base64
  32. Base64App string `json:"base64_app"`
  33. // Status is the status of the apply that happened for this revision.
  34. Status AppRevisionStatus `json:"status"`
  35. // DeploymentTargetID is the ID of the deployment target that the revision applies to.
  36. DeploymentTargetID uuid.UUID `json:"deployment_target_id"`
  37. // ProjectID is the ID of the project that the revision belongs to.
  38. ProjectID int `json:"project_id"`
  39. // PorterAppID is the ID of the PorterApp that the revision belongs to. This will be deprecated in favor of AppInstanceID (tracking: POR-1992)
  40. PorterAppID int `json:"porter_app_id"`
  41. // RevisionNumber is the number of the revision respective to that porter_app_id and deployment_target_id
  42. RevisionNumber int `json:"revision_number"`
  43. // AppInstanceID is the ID of the AppInstance that the revision belongs to. This will be null while the app instance table is being seeded (tracking: POR-1991)
  44. AppInstanceID uuid.UUID `json:"app_instance_id" gorm:"type:uuid;default:00000000-0000-0000-0000-000000000000"`
  45. }