Skip to content

Commit

Permalink
atlasexec: support new commands for declarative flow (#84)
Browse files Browse the repository at this point in the history
* atlasexec: support new commands for declarative flow

* .github/workflows: login to use pro features

* atlasexec: added `SCMType` type
  • Loading branch information
giautm authored Aug 26, 2024
1 parent 288f04d commit 164ed54
Show file tree
Hide file tree
Showing 9 changed files with 685 additions and 13 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- run: |
curl -sSf 'https://atlasgo.sh?test=1' | env ATLAS_DEBUG=true sh
- uses: ariga/setup-atlas@v0
with:
cloud-token: ${{ secrets.ATLAS_TOKEN }}
env:
ATLAS_DEBUG: "true"
- name: Run tests
run: go test ./atlasexec/internal/e2e
env:
Expand Down
25 changes: 16 additions & 9 deletions atlasexec/atlas.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ type (
// RunContext is an input type for describing the context of where the
// command is triggered from. For example, a GitHub Action on the master branch.
RunContext struct {
Repo string `json:"repo,omitempty"`
Path string `json:"path,omitempty"`
Branch string `json:"branch,omitempty"`
Commit string `json:"commit,omitempty"`
URL string `json:"url,omitempty"`
Username string `json:"username,omitempty"` // The username that triggered the event that initiated the command.
UserID string `json:"userID,omitempty"` // The user ID that triggered the event that initiated the command.
SCMType string `json:"scmType,omitempty"` // Source control management system type.
}
Repo string `json:"repo,omitempty"`
Path string `json:"path,omitempty"`
Branch string `json:"branch,omitempty"`
Commit string `json:"commit,omitempty"`
URL string `json:"url,omitempty"`
Username string `json:"username,omitempty"` // The username that triggered the event that initiated the command.
UserID string `json:"userID,omitempty"` // The user ID that triggered the event that initiated the command.
SCMType SCMType `json:"scmType,omitempty"` // Source control management system type.
}
// SCMType is a type for the "scm_type" enum field.
SCMType string // Only GITHUB is supported for now.
// DeployRunContext is an input type for describing the context in which
// `migrate-apply` and `migrate down` were used. For example, a GitHub Action with version v1.2.3
DeployRunContext struct {
Expand All @@ -78,6 +80,11 @@ const (
TriggerTypeCircleCIOrb TriggerType = "CIRCLECI_ORB"
)

// SCMType values.
const (
SCMTypeGithub SCMType = "GITHUB"
)

// ExecutionOrder values.
const (
ExecOrderLinear MigrateExecOrder = "linear" // Default
Expand Down
4 changes: 2 additions & 2 deletions atlasexec/atlas_migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ func TestAtlasMigrate_Push(t *testing.T) {
URL: "this://is/a/url",
UserID: "test-user-id",
Username: "test-user",
SCMType: "GIHUB",
SCMType: atlasexec.SCMTypeGithub,
}
t.Run("sync", func(t *testing.T) {
params := &atlasexec.MigratePushParams{
Expand Down Expand Up @@ -806,7 +806,7 @@ func TestAtlasMigrate_LintWithLogin(t *testing.T) {
URL: "this://is/a/url",
Username: "test-user",
UserID: "test-user-id",
SCMType: "GIHUB",
SCMType: atlasexec.SCMTypeGithub,
}
)
err = c.MigrateLintError(context.Background(), &atlasexec.MigrateLintParams{
Expand Down
Loading

0 comments on commit 164ed54

Please sign in to comment.