mirror of https://github.com/apache/superset.git
fix: Docker ephemeral env (#23786)
This commit is contained in:
parent
d4c0ae34f4
commit
c536d92ade
|
@ -1,4 +1,4 @@
|
||||||
name: Push ephmereral env image
|
name: Push ephemeral env image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_run:
|
workflow_run:
|
||||||
|
@ -17,14 +17,14 @@ jobs:
|
||||||
id: check
|
id: check
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
if [ -n "${{ (secrets.AWS_ACCESS_KEY_ID != '' &&
|
if [ -n "${{ (secrets.AWS_ACCESS_KEY_ID != '' &&
|
||||||
secrets.AWS_ACCESS_KEY_ID != '' &&
|
secrets.AWS_ACCESS_KEY_ID != '' &&
|
||||||
secrets.AWS_SECRET_ACCESS_KEY != '' &&
|
secrets.AWS_SECRET_ACCESS_KEY != '' &&
|
||||||
secrets.AWS_SECRET_ACCESS_KEY != '') || '' }}" ]; then
|
secrets.AWS_SECRET_ACCESS_KEY != '') || '' }}" ]; then
|
||||||
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
|
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker_ephemeral_env:
|
docker_ephemeral_env:
|
||||||
needs: config
|
needs: config
|
||||||
|
@ -33,66 +33,66 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 'Download artifact'
|
- name: "Download artifact"
|
||||||
uses: actions/github-script@v3.1.0
|
uses: actions/github-script@v3.1.0
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const artifacts = await github.actions.listWorkflowRunArtifacts({
|
const artifacts = await github.actions.listWorkflowRunArtifacts({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
run_id: ${{ github.event.workflow_run.id }},
|
run_id: ${{ github.event.workflow_run.id }},
|
||||||
});
|
});
|
||||||
|
|
||||||
core.info('*** artifacts')
|
core.info('*** artifacts')
|
||||||
core.info(JSON.stringify(artifacts))
|
core.info(JSON.stringify(artifacts))
|
||||||
|
|
||||||
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
||||||
return artifact.name == "build"
|
return artifact.name == "build"
|
||||||
})[0];
|
})[0];
|
||||||
if(!matchArtifact) return core.setFailed("Build artifacts not found")
|
if(!matchArtifact) return core.setFailed("Build artifacts not found")
|
||||||
|
|
||||||
const download = await github.actions.downloadArtifact({
|
const download = await github.actions.downloadArtifact({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
artifact_id: matchArtifact.id,
|
artifact_id: matchArtifact.id,
|
||||||
archive_format: 'zip',
|
archive_format: 'zip',
|
||||||
});
|
});
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
fs.writeFileSync('${{github.workspace}}/build.zip', Buffer.from(download.data));
|
fs.writeFileSync('${{github.workspace}}/build.zip', Buffer.from(download.data));
|
||||||
|
|
||||||
- run: unzip build.zip
|
- run: unzip build.zip
|
||||||
|
|
||||||
- name: Display downloaded files (debug)
|
- name: Display downloaded files (debug)
|
||||||
run: ls -la
|
run: ls -la
|
||||||
|
|
||||||
- name: Get SHA
|
- name: Get SHA
|
||||||
id: get-sha
|
id: get-sha
|
||||||
run: echo "::set-output name=sha::$(cat ./SHA)"
|
run: echo "::set-output name=sha::$(cat ./SHA)"
|
||||||
|
|
||||||
- name: Get PR
|
- name: Get PR
|
||||||
id: get-pr
|
id: get-pr
|
||||||
run: echo "::set-output name=num::$(cat ./PR-NUM)"
|
run: echo "::set-output name=num::$(cat ./PR-NUM)"
|
||||||
|
|
||||||
- name: Configure AWS credentials
|
- name: Configure AWS credentials
|
||||||
uses: aws-actions/configure-aws-credentials@v1
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
with:
|
with:
|
||||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
aws-region: us-west-2
|
aws-region: us-west-2
|
||||||
|
|
||||||
- name: Login to Amazon ECR
|
- name: Login to Amazon ECR
|
||||||
id: login-ecr
|
id: login-ecr
|
||||||
uses: aws-actions/amazon-ecr-login@v1
|
uses: aws-actions/amazon-ecr-login@v1
|
||||||
|
|
||||||
- name: Load, tag and push image to ECR
|
- name: Load, tag and push image to ECR
|
||||||
id: push-image
|
id: push-image
|
||||||
env:
|
env:
|
||||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||||
ECR_REPOSITORY: superset-ci
|
ECR_REPOSITORY: superset-ci
|
||||||
SHA: ${{ steps.get-sha.outputs.sha }}
|
SHA: ${{ steps.get-sha.outputs.sha }}
|
||||||
IMAGE_TAG: pr-${{ steps.get-pr.outputs.num }}
|
IMAGE_TAG: pr-${{ steps.get-pr.outputs.num }}
|
||||||
run: |
|
run: |
|
||||||
docker load < $SHA.tar.gz
|
docker load < $SHA.tar.gz
|
||||||
docker tag $SHA $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
docker tag $SHA $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||||
docker tag $SHA $ECR_REGISTRY/$ECR_REPOSITORY:$SHA
|
docker tag $SHA $ECR_REGISTRY/$ECR_REPOSITORY:$SHA
|
||||||
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY
|
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY
|
||||||
|
|
Loading…
Reference in New Issue