diff --git a/.github/workflows/.e2e-run.yml b/.github/workflows/.e2e-run.yml index 657fbf4..ebf9d8b 100644 --- a/.github/workflows/.e2e-run.yml +++ b/.github/workflows/.e2e-run.yml @@ -25,6 +25,10 @@ on: password_secret: required: false type: string + cache: + required: false + type: string + default: registry env: HARBOR_VERSION: v2.13.2 @@ -56,6 +60,24 @@ jobs: if: inputs.type == 'local' run: | cat ./.github/e2e/${{ inputs.id }}/env >> $GITHUB_ENV + - + name: Set up outputs + uses: actions/github-script@v8 + env: + INPUT_SLUG: ${{ env.REGISTRY_SLUG || inputs.slug }} + INPUT_CACHE: ${{ inputs.cache }} + with: + script: | + const inpSlug = core.getInput('slug'); + const inpCache = core.getInput('cache'); + if (inpCache === 'registry') { + core.exportVariable('CACHE_FROM', `type=registry,ref=${inpSlug}:master`); + core.exportVariable('CACHE_TO', 'type=inline'); + } else if (inpCache === 's3') { + const cacheName = inpSlug.replace(/[^a-zA-Z0-9]/g, '-').toLowerCase(); + core.exportVariable('CACHE_FROM', `type=s3,region=us-east-2,bucket=buildkit-s3-cache-test,name=${cacheName}`); + core.exportVariable('CACHE_TO', `type=s3,region=us-east-2,bucket=buildkit-s3-cache-test,name=${cacheName}`); + } - name: Set up BuildKit config run: | @@ -121,8 +143,12 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ env.REGISTRY_SLUG || inputs.slug }}:master - cache-to: type=inline + cache-from: ${{ env.CACHE_FROM }} + cache-to: ${{ env.CACHE_TO }} + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} + AWS_SESSION_TOKEN: ${{ secrets.AWS_S3_SESSION_TOKEN }} - name: Inspect image run: | diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 9e03d50..6941255 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -25,6 +25,11 @@ jobs: name: Distribution id: distribution type: local + - + name: Distribution (s3 cache) + id: distribution + type: local + cache: s3 - name: Docker Hub registry: '' @@ -104,4 +109,5 @@ jobs: slug: ${{ matrix.slug }} username_secret: ${{ matrix.username_secret }} password_secret: ${{ matrix.password_secret }} + cache: ${{ matrix.cache || 'registry' }} secrets: inherit