diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1c9d6576d..e265dc046 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,7 +18,7 @@ jobs: permissions: contents: write packages: write - runs-on: ubuntu-latest + runs-on: ubuntu-latest-16-cores strategy: matrix: os: [linux, darwin, freebsd] diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 0a0a7ae96..6a936f908 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -14,7 +14,7 @@ permissions: read-all jobs: dedupe: name: Dedupe/restore blobs - runs-on: ubuntu-latest + runs-on: ubuntu-latest-16-cores steps: - uses: actions/checkout@v4 - uses: ./.github/actions/clean-runner @@ -62,7 +62,7 @@ jobs: sync: name: Sync harness - runs-on: ubuntu-latest + runs-on: ubuntu-latest-16-cores steps: - name: Check out source code uses: actions/checkout@v4 @@ -81,7 +81,7 @@ jobs: gc-referrers-stress-s3: name: GC(with referrers) on S3(localstack) with short interval - runs-on: ubuntu-latest + runs-on: ubuntu-latest-16-cores steps: - uses: actions/checkout@v4 - uses: ./.github/actions/clean-runner @@ -118,7 +118,7 @@ jobs: gc-stress-s3: name: GC(without referrers) on S3(localstack) with short interval - runs-on: ubuntu-latest + runs-on: ubuntu-latest-16-cores steps: - uses: actions/checkout@v4 - uses: ./.github/actions/clean-runner @@ -155,7 +155,7 @@ jobs: docker-image: name: Build docker image (for users still using Docker environments) - runs-on: ubuntu-latest + runs-on: ubuntu-latest-16-cores steps: - uses: actions/checkout@v4 - uses: ./.github/actions/clean-runner diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5b57c1a5a..5cef58852 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,7 +14,7 @@ permissions: read-all jobs: test-run-minimal: name: Running zot without extensions tests - runs-on: ubuntu-latest + runs-on: ubuntu-latest-16-cores steps: - uses: actions/checkout@v4 - uses: ./.github/actions/clean-runner @@ -57,7 +57,7 @@ jobs: - uses: ./.github/actions/teardown-localstack test-run-extensions: name: Run zot with extensions tests - runs-on: ubuntu-latest + runs-on: ubuntu-latest-16-cores steps: - uses: actions/checkout@v4 - uses: ./.github/actions/clean-runner @@ -80,7 +80,6 @@ jobs: cd $GITHUB_WORKSPACE go mod download - uses: ./.github/actions/setup-localstack - - uses: ./.github/actions/check-diskspace - name: run zot extended tests run: | cd $GITHUB_WORKSPACE @@ -99,7 +98,7 @@ jobs: - uses: ./.github/actions/teardown-localstack test-run-devmode: name: Running privileged tests on Linux - runs-on: ubuntu-latest + runs-on: ubuntu-latest-16-cores steps: - uses: actions/checkout@v4 - uses: ./.github/actions/clean-runner diff --git a/pkg/meta/dynamodb/dynamodb.go b/pkg/meta/dynamodb/dynamodb.go index d96c2b1df..84c20e2d6 100644 --- a/pkg/meta/dynamodb/dynamodb.go +++ b/pkg/meta/dynamodb/dynamodb.go @@ -1451,8 +1451,11 @@ func (dwr *DynamoDB) createRepoMetaTable() error { }, BillingMode: types.BillingModePayPerRequest, }) + if err != nil { + if strings.Contains(err.Error(), "Table already exists") { + return nil + } - if err != nil && !strings.Contains(err.Error(), "Table already exists") { return err } @@ -1517,8 +1520,11 @@ func (dwr *DynamoDB) createManifestDataTable() error { }, BillingMode: types.BillingModePayPerRequest, }) + if err != nil { + if strings.Contains(err.Error(), "Table already exists") { + return nil + } - if err != nil && !strings.Contains(err.Error(), "Table already exists") { return err } @@ -1542,9 +1548,12 @@ func (dwr *DynamoDB) createIndexDataTable() error { }, BillingMode: types.BillingModePayPerRequest, }) + if err != nil { + if strings.Contains(err.Error(), "Table already exists") { + return nil + } - if err != nil && strings.Contains(err.Error(), "Table already exists") { - return nil + return err } return dwr.waitTableToBeCreated(dwr.IndexDataTablename) @@ -1837,8 +1846,11 @@ func (dwr *DynamoDB) createUserDataTable() error { }, BillingMode: types.BillingModePayPerRequest, }) + if err != nil { + if strings.Contains(err.Error(), "Table already exists") { + return nil + } - if err != nil && !strings.Contains(err.Error(), "Table already exists") { return err } @@ -1862,8 +1874,11 @@ func (dwr DynamoDB) createAPIKeyTable() error { }, BillingMode: types.BillingModePayPerRequest, }) + if err != nil { + if strings.Contains(err.Error(), "Table already exists") { + return nil + } - if err != nil && !strings.Contains(err.Error(), "Table already exists") { return err } diff --git a/pkg/meta/version/version_test.go b/pkg/meta/version/version_test.go index e64dbbf70..ec919ea98 100644 --- a/pkg/meta/version/version_test.go +++ b/pkg/meta/version/version_test.go @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/dynamodb" "github.com/aws/aws-sdk-go-v2/service/dynamodb/types" "github.com/aws/aws-sdk-go/aws" + guuid "github.com/gofrs/uuid" . "github.com/smartystreets/goconvey/convey" "go.etcd.io/bbolt" @@ -116,16 +117,21 @@ func setBoltDBVersion(db *bbolt.DB, vers string) error { func TestVersioningDynamoDB(t *testing.T) { tskip.SkipDynamo(t) + uuid, err := guuid.NewV4() + if err != nil { + panic(err) + } + Convey("Tests", t, func() { params := mdynamodb.DBDriverParameters{ Endpoint: os.Getenv("DYNAMODBMOCK_ENDPOINT"), Region: "us-east-2", - RepoMetaTablename: "RepoMetadataTable", - ManifestDataTablename: "ManifestDataTable", - IndexDataTablename: "IndexDataTable", - UserDataTablename: "UserDataTable", - APIKeyTablename: "ApiKeyTable", - VersionTablename: "Version", + RepoMetaTablename: "RepoMetadataTable" + uuid.String(), + ManifestDataTablename: "ManifestDataTable" + uuid.String(), + IndexDataTablename: "IndexDataTable" + uuid.String(), + UserDataTablename: "UserDataTable" + uuid.String(), + APIKeyTablename: "ApiKeyTable" + uuid.String(), + VersionTablename: "Version" + uuid.String(), } dynamoClient, err := mdynamodb.GetDynamoClient(params) @@ -140,7 +146,7 @@ func TestVersioningDynamoDB(t *testing.T) { So(dynamoWrapper.ResetRepoMetaTable(), ShouldBeNil) Convey("dbVersion is empty", func() { - err := setDynamoDBVersion(dynamoWrapper.Client, "") + err := setDynamoDBVersion(dynamoWrapper.Client, params.VersionTablename, "") So(err, ShouldBeNil) err = dynamoWrapper.PatchDB() @@ -160,7 +166,7 @@ func TestVersioningDynamoDB(t *testing.T) { }, } - err := setDynamoDBVersion(dynamoWrapper.Client, version.Version1) + err := setDynamoDBVersion(dynamoWrapper.Client, params.VersionTablename, version.Version1) So(err, ShouldBeNil) // we should skip the first patch @@ -181,7 +187,7 @@ func TestVersioningDynamoDB(t *testing.T) { }) } -func setDynamoDBVersion(client *dynamodb.Client, vers string) error { +func setDynamoDBVersion(client *dynamodb.Client, versTable, vers string) error { mdAttributeValue, err := attributevalue.Marshal(vers) if err != nil { return err @@ -199,7 +205,7 @@ func setDynamoDBVersion(client *dynamodb.Client, vers string) error { Value: version.DBVersionKey, }, }, - TableName: aws.String("Version"), + TableName: aws.String(versTable), UpdateExpression: aws.String("SET #V = :Version"), })