Update latest CI image #197
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: update_CI_image | |
| run-name: Update latest CI image | |
| env: | |
| AIS_DOCKER_REGISTRY: ghcr.io/${{ github.repository }} | |
| on: | |
| pull_request_target: # A.K.A. This is a privileged action. See `pull_request`. | |
| types: | |
| - closed # CAUTION: Includes un-merged PR's. | |
| branches: | |
| - develop | |
| workflow_dispatch: | |
| # Requires write access to trigger. | |
| inputs: | |
| pull_from_cache: | |
| description: Build image with 'latest' cache | |
| required: false | |
| default: true | |
| type: boolean | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| update_AIS_CI_image: | |
| env: | |
| AIS_CI_IMAGE_NAME: ais_ci_${{ matrix.supported_platforms }} | |
| AIS_INPUT_PLATFORM: ${{ matrix.supported_platforms }} | |
| if: ${{ github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' }} | |
| runs-on: [ubuntu-24.04] | |
| container: docker:28.5 | |
| strategy: | |
| matrix: | |
| supported_platforms: | |
| - rocky | |
| - suse | |
| - ubuntu | |
| rocm_versions: | |
| - 7.2.0 | |
| steps: | |
| - name: Fetching code repository... | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2 | |
| - name: Authenticating to GitHub Container Registry. | |
| uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 #v4.0.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set target AIS CI Image | |
| id: ci-image | |
| run: | | |
| AIS_CI_IMAGE="${AIS_DOCKER_REGISTRY}/${AIS_CI_IMAGE_NAME}:latest-rocm${{ matrix.rocm_versions }}" | |
| echo "AIS_CI_IMAGE=$(printf '%s' "${AIS_CI_IMAGE}" | tr '[:upper:]' '[:lower:]')" >> "${GITHUB_OUTPUT}" | |
| - name: Set Docker Cache Instruction | |
| id: use-cache | |
| # If triggered by a pull_request, pull_from_cache will be null. Note | |
| # however `false == null` resolves to `true`. Use empty string to check | |
| # for 'null'. | |
| # See: https://docs.github.com/en/actions/reference/workflows-and-actions/expressions | |
| # for how null gets converted when compared to non-null, and converted into a string. | |
| run: >- | |
| echo "CACHE_FROM_CMD=${{ | |
| ( format('{0}', inputs.pull_from_cache) == '' || inputs.pull_from_cache ) && | |
| format('--cache-from=type=registry,ref=\"{0}-cache\"', steps.ci-image.outputs.AIS_CI_IMAGE) || | |
| '' | |
| }}" >> "${GITHUB_OUTPUT}" | |
| - name: Setup Docker Builder | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd #v4.0.0 | |
| with: | |
| name: ais-builder | |
| driver: docker-container | |
| cache-binary: false # True uses the GHA Cache Backend. | |
| - name: Build & Push latest image for AIS CI | |
| run: | | |
| docker buildx build \ | |
| -f "${GITHUB_WORKSPACE}/util/docker/DOCKERFILE.${AIS_CI_IMAGE_NAME}" \ | |
| --label "org.opencontainers.image.description= \ | |
| Latest AIS CI Image for ${AIS_INPUT_PLATFORM} using ROCm ${{ matrix.rocm_versions }}." \ | |
| --build-arg ROCM_VERSION=${{ matrix.rocm_versions }} \ | |
| --cache-to=type=registry,ref="${{ steps.ci-image.outputs.AIS_CI_IMAGE }}-cache" \ | |
| ${{ steps.use-cache.outputs.CACHE_FROM_CMD }} \ | |
| --push \ | |
| -t "${{ steps.ci-image.outputs.AIS_CI_IMAGE }}" \ | |
| ${GITHUB_WORKSPACE} |