This is an automated email from the ASF dual-hosted git repository.
dpgaspar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 807c57c531 fix(ci): ephemeral env build (#26852)
807c57c531 is described below
commit 807c57c531b94edb82467f1eb6fb737ab2b22be1
Author: Daniel Vaz Gaspar <[email protected]>
AuthorDate: Wed Jan 31 12:06:06 2024 +0000
fix(ci): ephemeral env build (#26852)
---
.asf.yaml | 1 -
.github/workflows/docker.yml | 35 ------------------
.github/workflows/ephemeral-env.yml | 73 +++++++++++++++++--------------------
3 files changed, 34 insertions(+), 75 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
index eacbcd9029..180414f24a 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -66,7 +66,6 @@ github:
- cypress-matrix (1, chrome)
- cypress-matrix (2, chrome)
- cypress-matrix (3, chrome)
- - docker-build
- frontend-build
- pre-commit (3.9)
- python-lint (3.9)
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index df92ca5639..ae54835e0f 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -47,38 +47,3 @@ jobs:
run: |
pip install click
./scripts/build_docker.py ${{ matrix.build_preset }} ${{
github.event_name }} --platform ${{ matrix.platform }}
-
-
- ephemeral-docker-build:
- runs-on: ubuntu-latest
- steps:
- - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
- uses: actions/checkout@v4
- with:
- persist-credentials: false
-
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v3
-
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
-
- - name: Build ephemeral env image
- if: github.event_name == 'pull_request'
- env:
- DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
- DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
- run: |
- pip install click
- ./scripts/build_docker.py "ci" "pull_request" --platform linux/amd64
- mkdir -p ./build
- echo ${{ github.sha }} > ./build/SHA
- echo ${{ github.event.pull_request.number }} > ./build/PR-NUM
- docker save ${{ github.sha }}-ci | gzip > ./build/${{ github.sha
}}.tar.gz
-
- - name: Upload build artifacts
- if: github.event_name == 'pull_request'
- uses: actions/upload-artifact@v4
- with:
- name: build
- path: build/
diff --git a/.github/workflows/ephemeral-env.yml
b/.github/workflows/ephemeral-env.yml
index 2e8178199f..4d11439f8a 100644
--- a/.github/workflows/ephemeral-env.yml
+++ b/.github/workflows/ephemeral-env.yml
@@ -79,55 +79,51 @@ jobs:
})
core.setFailed(errMsg)
- docker_ephemeral_env:
- needs: config
- if: needs.config.outputs.has-secrets
- name: Push ephemeral env Docker image to ECR
+ ephemeral-docker-build:
+ needs: ephemeral_env_comment
+ name: docker-build
runs-on: ubuntu-latest
-
steps:
- - name: "Download artifact"
- uses: actions/[email protected]
+ - name: Get Info from comment
+ uses: actions/github-script@v3
+ id: get-pr-info
with:
script: |
- const artifacts = await github.actions.listWorkflowRunArtifacts({
+ const request = {
owner: context.repo.owner,
repo: context.repo.repo,
- run_id: ${{ github.event.workflow_run.id }},
- });
-
- core.info('*** artifacts')
- core.info(JSON.stringify(artifacts))
-
- const matchArtifact = artifacts.data.artifacts.filter((artifact)
=> {
- return artifact.name === "build";
- });
-
- if (!matchArtifact.length) {
- return core.setFailed("Build artifacts not found");
+ pull_number: ${{ github.event.issue.number }},
}
+ core.info(`Getting PR #${request.pull_number} from
${request.owner}/${request.repo}`)
+ const pr = await github.pulls.get(request);
+ return pr.data;
- const download = await github.actions.downloadArtifact({
- owner: context.repo.owner,
- repo: context.repo.repo,
- artifact_id: matchArtifact[0].id,
- archive_format: 'zip',
- });
- var fs = require('fs');
- fs.writeFileSync('${{github.workspace}}/build.zip',
Buffer.from(download.data));
+ - name: Debug
+ id: get-sha
+ run: |
+ echo "sha=${{ fromJSON(steps.get-pr-info.outputs.result).head.sha
}}" >> $GITHUB_OUTPUT
- - run: unzip build.zip
+ - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} :
${{steps.get-sha.outputs.sha}} )"
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ steps.get-sha.outputs.sha }}
+ persist-credentials: false
- - name: Display downloaded files (debug)
- run: ls -la
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
- - name: Get SHA
- id: get-sha
- run: echo "::set-output name=sha::$(cat ./SHA)"
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
- - name: Get PR
- id: get-pr
- run: echo "::set-output name=num::$(cat ./PR-NUM)"
+ - name: Build ephemeral env image
+ run: |
+ docker buildx build --target ci \
+ --load \
+ -t ${{ steps.get-sha.outputs.sha }} \
+ -t "pr-${{ github.event.issue.number }}" \
+ --platform linux/amd64 \
+ --label "build_actor=${GITHUB_ACTOR}" \
+ .
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
@@ -146,9 +142,8 @@ jobs:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: superset-ci
SHA: ${{ steps.get-sha.outputs.sha }}
- IMAGE_TAG: pr-${{ steps.get-pr.outputs.num }}
+ IMAGE_TAG: pr-${{ github.event.issue.number }}
run: |
- docker load < $SHA.tar.gz
docker tag $SHA $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $SHA $ECR_REGISTRY/$ECR_REPOSITORY:$SHA
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY