Skip to content

Commit

Permalink
ci: use runners provided by CNCF (project-zot#1946)
Browse files Browse the repository at this point in the history
Signed-off-by: Ramkumar Chinchani <[email protected]>
  • Loading branch information
rchincha authored Oct 21, 2023
1 parent 7ab2032 commit 4cb7a6c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
27 changes: 21 additions & 6 deletions pkg/meta/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand All @@ -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)
Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down
26 changes: 16 additions & 10 deletions pkg/meta/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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"),
})

Expand Down

0 comments on commit 4cb7a6c

Please sign in to comment.