Skip to content

Commit

Permalink
fix(docker): improve docker tags to be cleared and avoid conflicts (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored Jan 31, 2024
1 parent 39973cd commit 4b77129
Show file tree
Hide file tree
Showing 15 changed files with 861 additions and 253 deletions.
13 changes: 12 additions & 1 deletion .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ github:
# strict means "Require branches to be up to date before merging".
strict: false
# contexts are the names of checks that must pass
# unfortunately AFAICT for `matrix:` jobs, we have to itemize every
# combination here.
contexts:
- check
- lint-check
- cypress-matrix (1, chrome)
- cypress-matrix (2, chrome)
- cypress-matrix (3, chrome)
Expand All @@ -72,6 +74,15 @@ github:
- test-postgres (3.9)
- test-postgres (3.10)
- test-sqlite (3.9)
- ephemeral-docker-build
- docker-build (dev, linux/amd64)
- docker-build (lean, linux/amd64)
- docker-build (py310, linux/arm64)
- docker-build (py310, linux/amd64)
- docker-build (websocket, linux/arm64)
- docker-build (websocket, linux/amd64)
- docker-build (dockerize, linux/arm64)
- docker-build (dockerize, linux/amd64)

required_pull_request_reviews:
dismiss_stale_reviews: false
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
target: ["dev", "lean", "lean310", "websocket", "dockerize"]
build_preset: ["dev", "lean", "py310", "websocket", "dockerize"]
platform: ["linux/amd64", "linux/arm64"]
exclude:
# disabling because slow! no python wheels for arm/py39 and
# QEMU is slow!
- build_preset: "dev"
platform: "linux/arm64"
- build_preset: "lean"
platform: "linux/arm64"
fail-fast: false
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
Expand All @@ -47,4 +54,5 @@ jobs:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
GITHUB_RELEASE_TAG_NAME="${{ github.event.release.tag_name }}"
./scripts/docker_build_push.sh "$GITHUB_RELEASE_TAG_NAME" ${{ matrix.target }} ${{ matrix.platform }}
pip install click
./scripts/build_docker.py ${{ matrix.build_preset }} release --platform ${{ matrix.platform }}
29 changes: 15 additions & 14 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
docker-build:
name: docker-build
runs-on: ubuntu-latest
strategy:
matrix:
target: ["dev", "lean", "lean310", "websocket", "dockerize"]
build_preset: ["dev", "lean", "py310", "websocket", "dockerize"]
platform: ["linux/amd64", "linux/arm64"]
exclude:
# disabling because slow! no python wheels for arm/py39 and
# QEMU is slow!
- target: "dev"
- build_preset: "dev"
platform: "linux/arm64"
- target: "lean"
- build_preset: "lean"
platform: "linux/arm64"
fail-fast: false
steps:
Expand All @@ -41,11 +45,11 @@ jobs:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
./scripts/docker_build_push.sh "" ${{ matrix.target }} ${{ matrix.platform }}
pip install click
./scripts/build_docker.py ${{ matrix.build_preset }} ${{ github.event_name }} --platform ${{ matrix.platform }}
ephemeral-docker-build:
name: docker-build
runs-on: ubuntu-latest
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
Expand All @@ -61,19 +65,16 @@ jobs:

- 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 buildx build --target ci \
--load \
--cache-from=type=registry,ref=apache/superset:lean \
-t ${{ github.sha }} \
-t "pr-${{ github.event.pull_request.number }}" \
--platform linux/amd64 \
--label "build_actor=${GITHUB_ACTOR}" \
.
docker save ${{ github.sha }} | gzip > ./build/${{ github.sha }}.tar.gz
docker save ${{ github.sha }}-ci | gzip > ./build/${{ github.sha }}.tar.gz
- name: Upload build artifacts
if: github.event_name == 'pull_request'
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/no-op.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,17 @@ jobs:
run: |
echo "This is a no-op step for python-lint to ensure a successful status."
exit 0
check:
runs-on: ubuntu-latest
steps:
- name: No-op for frontend-build
run: |
echo "This is a no-op step for frontend-build to ensure a successful status."
exit 0
docker-build:
runs-on: ubuntu-latest
steps:
- name: No-op for frontend-build
run: |
echo "This is a no-op step for frontend-build to ensure a successful status."
exit 0
2 changes: 1 addition & 1 deletion .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
types: [opened, edited, reopened, synchronize]

jobs:
check:
lint-check:
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/superset-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
cypress-matrix:
runs-on: ubuntu-20.04
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/superset-python-integrationtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
test-mysql:
runs-on: ubuntu-20.04
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ brew install readline pkg-config libffi openssl mysql postgresql@14
You should install a recent version of Python. Refer to the [setup.py](https://github.com/apache/superset/blob/master/setup.py) file for a list of Python versions officially supported by Superset. We'd recommend using a Python version manager like [pyenv](https://github.com/pyenv/pyenv) (and also [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv)).

:::tip
To identify the Python version used by the official docker image, see the [Dockerfile](https://github.com/apache/superset/blob/master/Dockerfile). Additional docker images published for newer versions of Python can be found in [this file](https://github.com/apache/superset/blob/master/scripts/docker_build_push.sh).
To identify the Python version used by the official docker image, see the [Dockerfile](https://github.com/apache/superset/blob/master/Dockerfile). Additional docker images published for newer versions of Python can be found in [this file](https://github.com/apache/superset/blob/master/scripts/build_docker.py).
:::

Let's also make sure we have the latest version of `pip` and `setuptools`:
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
testpaths =
tests
python_files = *_test.py test_*.py *_tests.py *viz/utils.py
addopts = -p no:warnings
Loading

0 comments on commit 4b77129

Please sign in to comment.