Skip to content
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

Merged
merged 9 commits into from
Sep 26, 2023
Merged

atlasaction: support migrate/apply #71

merged 9 commits into from
Sep 26, 2023

Conversation

rotemtam
Copy link
Member

No description provided.

@github-actions
Copy link

Atlas Lint Report

Analyzed migrations2

StatusStepResultDiagnostics
Detect New Migration FilesFound 0 new migration files (from 0 total)
Replay Migration FilesLoaded 0 changes on dev database
Connect your project to Atlas Cloud to get more safety checks

Migrations automatically reviewed by Atlas

@github-actions
Copy link

Atlas Lint Report

Analyzed migrations

StatusStepResultDiagnostics
Detect New Migration FilesFound 0 new migration files (from 0 total)
Replay Migration FilesLoaded 0 changes on dev database
Connect your project to Atlas Cloud to get more safety checks

Migrations automatically reviewed by Atlas

Comment on lines 40 to 41
// Cloud-based migrations are currently based on creating a temporary atlas.hcl
// file therefore it cannot be used with a user-supplied config.
Copy link
Contributor

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 Show resolved Hide resolved
Comment on lines 39 to 40
if strings.HasPrefix(params.DirURL, "atlas://") && params.Env != "" && params.ConfigURL == "" {
cfg, clean, err := atlasexec.TempFile(`env { name = atlas.env }`, "hcl")
Copy link
Contributor

@dorav dorav Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 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)

  1. Why is that needed for reporting the run to the cloud? the user provided the migration directory
  2. 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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big like! 👍

@rotemtam rotemtam requested a review from dorav September 26, 2023 13:33
dir := testDir(t, "./testdata/migrations")
ad, err := migrate.ArchiveDir(&dir)
require.NoError(t, err)
// nolint:errcheck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rotemtam rotemtam merged commit 5d35164 into master Sep 26, 2023
6 checks passed
@rotemtam rotemtam deleted the r/cloudapi branch September 26, 2023 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants