diff --git a/.github/actions/setup-localstack/action.yaml b/.github/actions/setup-localstack/action.yaml index ee503fe9..405c392f 100644 --- a/.github/actions/setup-localstack/action.yaml +++ b/.github/actions/setup-localstack/action.yaml @@ -1,5 +1,5 @@ name: 'Setup localstack service' -description: 'Download & run localstack container' +description: 'Download & run localstack container (does not create S3 buckets; tests or workflows should create resources they need)' inputs: # inputs for https://github.com/docker/login-action username: @@ -13,26 +13,25 @@ inputs: runs: using: "composite" steps: - - uses: docker/login-action@v3 + - uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ inputs.username }} password: ${{ inputs.password }} - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: '3.11' - shell: bash run: | - pip install localstack==3.3.0 # Install LocalStack cli - # Below image was copied manually from localstack/localstack:2.2 and uploaded to ghcr - docker pull ghcr.io/project-zot/ci-images/localstack:3.3.0 # Make sure to pull a working version of the image - localstack start -d # Start LocalStack in the background - - echo "Waiting for LocalStack startup..." # Wait 30 seconds for the LocalStack container - localstack wait -t 30 # to become ready before timing out + pip install --upgrade pyopenssl + pip install localstack==3.3.0 'awscli-local[ver1]' + # Below image was copied manually from localstack/localstack:community-archive and uploaded to ghcr + docker pull "$IMAGE_NAME" # Make sure to pull a working version of the image + localstack start -d # Start LocalStack in the background + echo "Waiting for LocalStack startup..." # Wait 30 seconds for the LocalStack container + localstack wait -t 30 # to become ready before timing out echo "Startup complete" - - aws --endpoint-url=http://localhost:4566 s3api create-bucket --bucket zot-storage --region us-east-2 --create-bucket-configuration="{\"LocationConstraint\": \"us-east-2\"}" env: AWS_ACCESS_KEY_ID: fake AWS_SECRET_ACCESS_KEY: fake + IMAGE_NAME: ghcr.io/project-zot/ci-images/localstack:community-archive diff --git a/.github/workflows/ecosystem-tools.yaml b/.github/workflows/ecosystem-tools.yaml index cd563801..5896611f 100644 --- a/.github/workflows/ecosystem-tools.yaml +++ b/.github/workflows/ecosystem-tools.yaml @@ -72,25 +72,7 @@ jobs: - name: Run CI tests run: | make run-blackbox-ci - - name: Log in to GitHub Docker Registry - uses: docker/login-action@v4 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ github.token }} - - uses: actions/setup-python@v6 - with: - python-version: '3.11' - - name: Install localstack - run: | - pip install --upgrade pyopenssl - pip install localstack==3.3.0 awscli-local[ver1] # install LocalStack cli and awslocal - docker pull ghcr.io/project-zot/ci-images/localstack:3.3.0 # Make sure to pull a working version of the image - localstack start -d # Start LocalStack in the background - - echo "Waiting for LocalStack startup..." # Wait 30 seconds for the LocalStack container - localstack wait -t 30 # to become ready before timing out - echo "Startup complete" + - uses: ./.github/actions/setup-localstack - name: Run cloud-only tests run: | make run-blackbox-cloud-ci diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index c72df402..2b41a9e7 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -36,25 +36,7 @@ jobs: make bin/skopeo sudo cp bin/skopeo /usr/bin skopeo -v - - name: Log in to GitHub Docker Registry - uses: docker/login-action@v4 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ github.token }} - - uses: actions/setup-python@v6 - with: - python-version: '3.11' - - name: Install localstack - run: | - pip install --upgrade pyopenssl - pip install localstack==3.3.0 awscli-local[ver1] # install LocalStack cli and awslocal - docker pull ghcr.io/project-zot/ci-images/localstack:3.3.0 # Make sure to pull the latest version of the image - localstack start -d # Start LocalStack in the background - - echo "Waiting for LocalStack startup..." # Wait 30 seconds for the LocalStack container - localstack wait -t 30 # to become ready before timing out - echo "Startup complete" + - uses: ./.github/actions/setup-localstack - name: Run blackbox nightly dedupe tests run: | # test restoring s3 blobs after cache is deleted @@ -95,7 +77,13 @@ jobs: check-latest: true go-version: 1.25.x - uses: ./.github/actions/setup-localstack - + - name: Create zot-storage bucket on LocalStack + run: | + awslocal s3api create-bucket --bucket zot-storage --region us-east-2 \ + --create-bucket-configuration='{"LocationConstraint": "us-east-2"}' + env: + AWS_ACCESS_KEY_ID: fake + AWS_SECRET_ACCESS_KEY: fake - name: Run zb timeout-minutes: 240 id: bench @@ -133,7 +121,13 @@ jobs: check-latest: true go-version: 1.25.x - uses: ./.github/actions/setup-localstack - + - name: Create zot-storage bucket on LocalStack + run: | + awslocal s3api create-bucket --bucket zot-storage --region us-east-2 \ + --create-bucket-configuration='{"LocationConstraint": "us-east-2"}' + env: + AWS_ACCESS_KEY_ID: fake + AWS_SECRET_ACCESS_KEY: fake - name: Run zb timeout-minutes: 240 id: bench @@ -274,25 +268,7 @@ jobs: sudo cp bin/skopeo /usr/bin skopeo -v cd $GITHUB_WORKSPACE - - name: Log in to GitHub Docker Registry - uses: docker/login-action@v4 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ github.token }} - - uses: actions/setup-python@v6 - with: - python-version: '3.11' - - name: Install localstack - run: | - pip install --upgrade pyopenssl - pip install localstack==3.3.0 awscli-local[ver1] # install LocalStack cli and awslocal - docker pull ghcr.io/project-zot/ci-images/localstack:3.3.0 # Make sure to pull a working version of the image - localstack start -d # Start LocalStack in the background - - echo "Waiting for LocalStack startup..." # Wait 30 seconds for the LocalStack container - localstack wait -t 30 # to become ready before timing out - echo "Startup complete" + - uses: ./.github/actions/setup-localstack - name: Run cloud scale-out high scale performance tests id: scale run: | @@ -361,25 +337,7 @@ jobs: sudo cp bin/skopeo /usr/bin skopeo -v cd $GITHUB_WORKSPACE - - name: Log in to GitHub Docker Registry - uses: docker/login-action@v4 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ github.token }} - - uses: actions/setup-python@v6 - with: - python-version: '3.11' - - name: Install localstack - run: | - pip install --upgrade pyopenssl - pip install localstack==3.3.0 awscli-local[ver1] # install LocalStack cli and awslocal - docker pull ghcr.io/project-zot/ci-images/localstack:3.3.0 # Make sure to pull a working version of the image - localstack start -d # Start LocalStack in the background - - echo "Waiting for LocalStack startup..." # Wait 30 seconds for the LocalStack container - localstack wait -t 30 # to become ready before timing out - echo "Startup complete" + - uses: ./.github/actions/setup-localstack - name: Run cloud scale-out Redis tests id: scale run: | diff --git a/Makefile b/Makefile index cc2a64cd..726f293c 100644 --- a/Makefile +++ b/Makefile @@ -220,7 +220,7 @@ test-extended: testdata-images .PHONY: test-minimal test-minimal: testdata-images - env GOEXPERIMENT=jsonv2 go test -failfast -trimpath -race -cover -coverpkg ./... -coverprofile=coverage-minimal.txt -covermode=atomic ./... + env GOEXPERIMENT=jsonv2 go test -failfast -trimpath -race -timeout 12m -cover -coverpkg ./... -coverprofile=coverage-minimal.txt -covermode=atomic ./... rm -rf /tmp/getter*; rm -rf /tmp/trivy* .PHONY: test-devmode