mirror of https://github.com/apache/superset.git
fix: docker should always run, even in forks (#26801)
This commit is contained in:
parent
424b4c2378
commit
845bcc9bea
|
@ -8,27 +8,7 @@ on:
|
|||
types: [synchronize, opened, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
config:
|
||||
runs-on: "ubuntu-latest"
|
||||
outputs:
|
||||
has-secrets: ${{ steps.check.outputs.has-secrets }}
|
||||
steps:
|
||||
- name: "Check for secrets"
|
||||
id: check
|
||||
env:
|
||||
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
run: |
|
||||
if [[ -n "$DOCKERHUB_USER" && -n "$DOCKERHUB_TOKEN" ]]; then
|
||||
echo "has-secrets=true" >> "$GITHUB_ENV"
|
||||
echo "has secrets!"
|
||||
else
|
||||
echo "has-secrets=false" >> "$GITHUB_ENV"
|
||||
echo "no secrets!"
|
||||
fi
|
||||
docker-build:
|
||||
needs: config
|
||||
if: needs.config.outputs.has-secrets == 'true'
|
||||
name: docker-build
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
@ -63,9 +43,8 @@ jobs:
|
|||
run: |
|
||||
./scripts/docker_build_push.sh "" ${{ matrix.target }} ${{ matrix.platform }}
|
||||
|
||||
|
||||
ephemeral-docker-build:
|
||||
needs: config
|
||||
if: needs.config.outputs.has-secrets
|
||||
name: docker-build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
@ -130,15 +130,22 @@ if [[ -n "${BUILD_TARGET}" ]]; then
|
|||
TARGET_ARGUMENT="--target ${BUILD_TARGET}"
|
||||
fi
|
||||
|
||||
# Building the cache settings
|
||||
CACHE_REF="${REPO_NAME}-cache:${TARGET}-${BUILD_ARG}"
|
||||
CACHE_REF=$(echo "${CACHE_REF}" | tr -d '.')
|
||||
CACHE_FROM_ARG="--cache-from=type=registry,ref=${CACHE_REF}"
|
||||
CACHE_TO_ARG=""
|
||||
if [ -n "${DOCKERHUB_TOKEN}" ]; then
|
||||
# need to be logged in to push to the cache
|
||||
CACHE_TO_ARG="--cache-to=type=registry,mode=max,ref=${CACHE_REF}"
|
||||
fi
|
||||
|
||||
docker buildx build \
|
||||
${TARGET_ARGUMENT} \
|
||||
${DOCKER_ARGS} \
|
||||
--cache-from=type=registry,ref=${CACHE_REF} \
|
||||
--cache-to=type=registry,mode=max,ref=${CACHE_REF} \
|
||||
${DOCKER_TAGS} \
|
||||
${CACHE_FROM_ARG} \
|
||||
${CACHE_TO_ARG} \
|
||||
--platform ${BUILD_PLATFORM} \
|
||||
--label "sha=${SHA}" \
|
||||
--label "built_at=$(date)" \
|
||||
|
|
Loading…
Reference in New Issue