disk and docker clean up in between jobs #737
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Image Health Check | |
| env: | |
| GH_TOKEN: "${{ secrets.GH_TOKEN }}" | |
| PACKAGING_SECRET_KEY: "${{ secrets.PACKAGING_SECRET_KEY }}" | |
| PACKAGE_ENCRYPTION_KEY: "${{ secrets.PACKAGE_ENCRYPTION_KEY }}" | |
| PACKAGING_PASSPHRASE: "${{ secrets.PACKAGING_PASSPHRASE }}" | |
| DOCKERHUB_PASSWORD: "${{ secrets.DOCKERHUB_PASSWORD }}" | |
| DOCKERHUB_USER_NAME: "${{ secrets.DOCKERHUB_USER_NAME }}" | |
| ACR_PASSWORD: "${{ secrets.ACR_PASSWORD }}" | |
| ACR_SERVICE_PRINCIPAL_ID: "${{ secrets.ACR_SERVICE_PRINCIPAL_ID }}" | |
| CURRENT_BRANCH: "${GITHUB_REF##*/}" | |
| TEST: false | |
| on: | |
| push: | |
| branches: "**" | |
| schedule: | |
| - cron: "30 2 * * *" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check_docker_files_integrity: | |
| name: Check if docker files are compliant with templates | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Update and check dockerfiles | |
| run: | | |
| ./update_dockerfiles | |
| git add --intent-to-add dockerfiles | |
| git diff --exit-code dockerfiles | |
| build_package: | |
| name: Build package | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 3 # limit concurrent docker builds to reduce overlay pressure | |
| matrix: | |
| TARGET_PLATFORM: | |
| - oraclelinux,8 | |
| - almalinux,8 | |
| - almalinux,9 | |
| POSTGRES_VERSION: | |
| - 14 | |
| - 15 | |
| - 16 | |
| - 17 | |
| - 18 | |
| include: | |
| - TARGET_PLATFORM: debian,bullseye | |
| - TARGET_PLATFORM: debian,bookworm | |
| - TARGET_PLATFORM: debian,trixie | |
| - TARGET_PLATFORM: ubuntu,jammy | |
| - TARGET_PLATFORM: ubuntu,noble | |
| - TARGET_PLATFORM: pgxn | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Install package dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --no-install-recommends -y libcurl4-openssl-dev libssl-dev python3-testresources | |
| sudo apt-get clean | |
| sudo rm -rf /var/lib/apt/lists/* | |
| - name: Disk usage before build | |
| run: | | |
| df -h / | |
| docker system df || true | |
| - name: Install wheel for el/8 | |
| if: matrix.TARGET_PLATFORM == 'centos,8' | |
| run: python -m pip install wheel | |
| - name: Build image for the target platform | |
| env: | |
| TARGET_PLATFORM: ${{ matrix.TARGET_PLATFORM }} | |
| POSTGRES_VERSION: ${{ matrix.POSTGRES_VERSION }} | |
| DOCKER_BUILDKIT: 1 | |
| run: | | |
| git checkout -- dockerfiles | |
| ./update_image | |
| - name: Clone tools repo for test | |
| run: git clone -b v0.8.35 --depth=1 https://github.com/citusdata/tools.git tools | |
| - name: Execute packaging tests | |
| run: | | |
| python -m pip install -r tools/packaging_automation/requirements.txt | |
| python -m pytest -q tools/packaging_automation/tests/test_citus_package.py -k 'test_build_packages' | |
| env: | |
| PACKAGING_IMAGE_PLATFORM: "${{matrix.TARGET_PLATFORM}}" | |
| - name: Remove build artifacts | |
| if: always() | |
| run: | | |
| rm -rf tools packages dist build .pytest_cache || true | |
| - name: Cleanup docker cache and free disk | |
| if: always() | |
| uses: ./.github/actions/cleanup-runner-disk | |
| with: | |
| aggressive: true | |