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

go.mod: bump sdk to latest #100

Merged
merged 8 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version-file: 'go.mod'
- name: Install Atlas CLI
run: |
curl -sSf https://atlasgo.sh | ATLAS_DEBUG=true sh
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

# Build the manager binary
FROM golang:1.20-alpine as builder
FROM golang:1.21-alpine as builder
ARG TARGETOS
ARG TARGETARCH
ARG OPERATOR_VERSION
Expand Down
6 changes: 3 additions & 3 deletions controllers/atlasmigration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ func (r *AtlasMigrationReconciler) watchRefs(res *dbv1alpha1.AtlasMigration) {

// Reconcile the given AtlasMigration resource.
func (r *AtlasMigrationReconciler) reconcile(ctx context.Context, dir, envName string) (_ *dbv1alpha1.AtlasMigrationStatus, _ error) {
c, err := atlas.NewClientWithDir(dir, r.execPath)
c, err := atlas.NewClient(dir, r.execPath)
if err != nil {
return nil, err
}
// Check if there are any pending migration files
status, err := c.Status(ctx, &atlas.StatusParams{Env: envName})
status, err := c.MigrateStatus(ctx, &atlas.MigrateStatusParams{Env: envName})
if err != nil {
return nil, transient(err)
}
Expand All @@ -238,7 +238,7 @@ func (r *AtlasMigrationReconciler) reconcile(ctx context.Context, dir, envName s
}, nil
}
// Execute Atlas CLI migrate command
report, err := c.Apply(ctx, &atlas.ApplyParams{Env: envName})
report, err := c.MigrateApply(ctx, &atlas.MigrateApplyParams{Env: envName})
if err != nil {
return nil, transient(err)
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/atlasmigration_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,9 @@ func TestReconcile_reconcile_baseline(t *testing.T) {
status, err := tt.r.reconcile(context.Background(), wd.Path(), "test")
require.NoError(t, err)
require.EqualValues(t, "20230412003628", status.LastAppliedVersion)
cli, err := atlasexec.NewClientWithDir(wd.Path(), tt.r.execPath)
cli, err := atlasexec.NewClient(wd.Path(), tt.r.execPath)
require.NoError(t, err)
report, err := cli.Status(context.Background(), &atlasexec.StatusParams{
report, err := cli.MigrateStatus(context.Background(), &atlasexec.MigrateStatusParams{
Env: "test",
})
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion controllers/atlasschema_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func (r *AtlasSchemaReconciler) watchRefs(res *dbv1alpha1.AtlasSchema) {
}

func (r *AtlasSchemaReconciler) apply(ctx context.Context, dir, envName string) (*atlas.SchemaApply, error) {
cli, err := atlas.NewClientWithDir(dir, r.execPath)
cli, err := atlas.NewClient(dir, r.execPath)
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions controllers/atlasschema_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func TestSchemaConfigMap(t *testing.T) {
require.NoError(t, err)

// Assert that the schema was applied.
cli, err := atlasexec.NewClientWithDir("", tt.r.execPath)
cli, err := atlasexec.NewClient("", tt.r.execPath)
require.NoError(t, err)
inspect, err := cli.SchemaInspect(ctx, &atlas.SchemaInspectParams{
URL: tt.dburl,
Expand Down Expand Up @@ -344,7 +344,7 @@ func Test_FirstRunDestructive(t *testing.T) {
require.Contains(t, ev, "FirstRunDestructive")
require.Contains(t, ev, "Warning")

cli, err := atlasexec.NewClientWithDir("", tt.r.execPath)
cli, err := atlasexec.NewClient("", tt.r.execPath)
require.NoError(t, err)
ins, err := cli.SchemaInspect(context.Background(), &atlas.SchemaInspectParams{
URL: tt.dburl,
Expand Down Expand Up @@ -385,7 +385,7 @@ func TestDiffPolicy(t *testing.T) {
tt.initDB("create table x (c int);")
_, err := tt.r.Reconcile(context.Background(), req())
require.NoError(t, err)
cli, err := atlasexec.NewClientWithDir("", tt.r.execPath)
cli, err := atlasexec.NewClient("", tt.r.execPath)
require.NoError(t, err)
ins, err := cli.SchemaInspect(context.Background(), &atlas.SchemaInspectParams{
URL: tt.dburl,
Expand Down Expand Up @@ -704,7 +704,7 @@ func (t *test) initDB(statement string) {
defer wd.Close()
_, err = wd.WriteFile("schema.sql", []byte(statement))
require.NoError(t, err)
cli, err := atlasexec.NewClientWithDir(wd.Path(), "atlas")
cli, err := atlasexec.NewClient(wd.Path(), "atlas")
require.NoError(t, err)
_, err = cli.SchemaApply(context.Background(), &atlas.SchemaApplyParams{
URL: t.dburl,
Expand Down
10 changes: 5 additions & 5 deletions controllers/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const lintDirName = "lint-migrations"
// - 2.sql: the pending changes.
// Then it runs `atlas migrate lint` in the temporary directory.
func (r *AtlasSchemaReconciler) lint(ctx context.Context, wd *atlas.WorkingDir, envName string, vars atlas.Vars) error {
cli, err := atlas.NewClientWithDir(wd.Path(), r.execPath)
cli, err := atlas.NewClient(wd.Path(), r.execPath)
if err != nil {
return err
}
Expand Down Expand Up @@ -67,7 +67,7 @@ func (r *AtlasSchemaReconciler) lint(ctx context.Context, wd *atlas.WorkingDir,
if err != nil {
return err
}
lint, err := cli.Lint(ctx, &atlas.LintParams{
lint, err := cli.MigrateLint(ctx, &atlas.MigrateLintParams{
DirURL: fmt.Sprintf("file://./%s", lintDirName),
Env: envName,
Latest: 1, // Only lint 2.sql, pending changes.
Expand All @@ -76,14 +76,14 @@ func (r *AtlasSchemaReconciler) lint(ctx context.Context, wd *atlas.WorkingDir,
if err != nil {
return err
}
if diags := destructive(lint.Files); len(diags) > 0 {
if diags := destructive(lint); len(diags) > 0 {
return &destructiveErr{diags: diags}
}
return nil
}

func destructive(files []*atlas.FileReport) (checks []sqlcheck.Diagnostic) {
for _, f := range files {
func destructive(rep *atlas.SummaryReport) (checks []sqlcheck.Diagnostic) {
for _, f := range rep.Files {
for _, r := range f.Reports {
if f.Error == "" {
continue
Expand Down
36 changes: 19 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
module github.com/ariga/atlas-operator

go 1.19
go 1.21

toolchain go1.21.2

require (
ariga.io/atlas v0.12.2-0.20230801155208-e69a7788b101
ariga.io/atlas-go-sdk v0.1.1-0.20230809094434-aac65e944787
ariga.io/atlas v0.14.3-0.20231010104048-0c071bfc9161
ariga.io/atlas-go-sdk v0.1.1-0.20231029150106-1927c56b057b
github.com/stretchr/testify v1.8.4
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb
golang.org/x/mod v0.9.0
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/mod v0.13.0
k8s.io/api v0.26.0
k8s.io/apimachinery v0.26.0
k8s.io/client-go v0.26.0
Expand All @@ -16,8 +18,8 @@ require (
)

require (
github.com/agext/levenshtein v1.2.1 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand All @@ -33,18 +35,18 @@ require (
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/hashicorp/hcl/v2 v2.10.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/hcl/v2 v2.18.1 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
Expand All @@ -54,20 +56,20 @@ require (
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rogpeppe/go-internal v1.6.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/zclconf/go-cty v1.8.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading