Skip to content

Commit

Permalink
fix(build): import both default and production namespaces for test
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeMac committed Jun 15, 2024
1 parent 5d30e59 commit b56aac6
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions build/testing/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,24 @@ func Migration(ctx context.Context, client *dagger.Client, base, flipt *dagger.C
Tag(*release.TagName).
Tree()

// handle the case that we're migrating to a new path location (path now includes "/main/")
fi, err := base.File("build/testing/integration/readonly/testdata/main/default.yaml").Sync(ctx)
if err != nil {
fi = base.File("build/testing/integration/readonly/testdata/default.yaml")
}

base = base.
WithMountedDirectory(".", fliptDir)

// import testdata into latest Flipt instance (using latest image for import)
_, err = latest.
WithFile("import.yaml", fi).
WithServiceBinding("flipt", latest.WithExec(nil).AsService()).
WithExec([]string{"sh", "-c", "sleep 5 && /flipt import --address grpc://flipt:9000 import.yaml"}).
Sync(ctx)
if err != nil {
return err
for _, namespace := range []string{"default", "production"} {
fi, err := base.File(fmt.Sprintf("build/testing/integration/readonly/testdata/main/%s.yaml", namespace)).Sync(ctx)
if err != nil {
return err
}

// import testdata into latest Flipt instance (using latest image for import)
_, err = latest.
WithFile("import.yaml", fi).
WithServiceBinding("flipt", latest.WithExec(nil).AsService()).
WithExec([]string{"sh", "-c", "sleep 5 && /flipt import --address grpc://flipt:9000 import.yaml"}).
Sync(ctx)
if err != nil {
return err
}
}

// run migration with edge Flipt build
Expand All @@ -78,6 +79,7 @@ func Migration(ctx context.Context, client *dagger.Client, base, flipt *dagger.C
// ensure new edge Flipt build continues to work as expected
_, err = base.
WithServiceBinding("flipt", flipt.
WithEnvVariable("FLIPT_AUTHENTICATION_REQUIRED", "true").
WithEnvVariable("FLIPT_AUTHENTICATION_METHODS_TOKEN_ENABLED", "true").
WithEnvVariable("FLIPT_AUTHENTICATION_METHODS_TOKEN_BOOTSTRAP_TOKEN", "secret").
WithExec(nil).
Expand Down

0 comments on commit b56aac6

Please sign in to comment.