-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
atlasaction: support migrate/apply #71
Conversation
Atlas Lint ReportAnalyzed migrations2
Migrations automatically reviewed by Atlas |
Atlas Lint ReportAnalyzed migrations
Migrations automatically reviewed by Atlas |
atlasaction/action.go
Outdated
// Cloud-based migrations are currently based on creating a temporary atlas.hcl | ||
// file therefore it cannot be used with a user-supplied config. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it implemented this way because of the override of cloud-url
and cloud-token
?
If so, I think this should be solved in the testing code, not inside the production code and causing a limitation on the users
atlasaction/action.go
Outdated
if strings.HasPrefix(params.DirURL, "atlas://") && params.Env != "" && params.ConfigURL == "" { | ||
cfg, clean, err := atlasexec.TempFile(`env { name = atlas.env }`, "hcl") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- If there is an env name but no URL, there might be a missing parameter (a human error) on the side of the user, in which case we might perform the wrong operation (apply a migration with a wrong parameter for example)?
If that's the case, I think throwing an error is safer and more predictable (and should probably be done by Atlas / Nebula, since we agreed the actions should do minimal logic)
- Why is that needed for reporting the run to the cloud? the user provided the migration directory
- What happens if the user didn't provide an 'env' name? will we get a report to the cloud?
} | ||
t.Run("basic", func(t *testing.T) { | ||
var payloads []string | ||
srv := httptest.NewServer(handler(&payloads)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big like! 👍
atlasaction/action_test.go
Outdated
dir := testDir(t, "./testdata/migrations") | ||
ad, err := migrate.ArchiveDir(&dir) | ||
require.NoError(t, err) | ||
// nolint:errcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.