name: new_CI_image run-name: Build the Docker image for hipFile CI env: AIS_INPUT_CI_IMAGE_NAME: ${{ inputs.ci_image_name }} AIS_INPUT_CI_IMAGE_CACHE: ${{ inputs.ci_image_cache }} AIS_INPUT_CI_IMAGE_NAME_NVIDIA: ${{ inputs.ci_image_name_nvidia }} AIS_INPUT_CI_IMAGE_CACHE_NVIDIA: ${{ inputs.ci_image_cache_nvidia }} AIS_INPUT_ROCM_VERSION: ${{ inputs.rocm_version }} AIS_INPUT_ROCM_NIGHTLY_BUILD: ${{ inputs.rocm_nightly_build }} AIS_INPUT_PLATFORM: ${{ inputs.platform }} # When publish_cache is set, also produce the floating registry cache. AIS_BASE_CACHE_TO: ${{ case(inputs.publish_cache, format('--cache-to=type=registry,ref={0}', inputs.ci_image_cache), '') }} AIS_NVIDIA_CACHE_TO: ${{ case(inputs.publish_cache, format('--cache-to=type=registry,ref={0}', inputs.ci_image_cache_nvidia), '') }} on: workflow_call: inputs: ci_image_name: description: "Full CI image name & tag to build/push" required: true type: string ci_image_cache: description: "Full CI cache image name & tag for Docker build cache" required: true type: string ci_image_name_nvidia: description: "Full CI image name & nvidia tag to build/push" required: true type: string ci_image_cache_nvidia: description: "Full CI cache image name & nvidia tag for Docker build cache" required: true type: string platform: required: true type: string rocm_version: description: "Target ROCm MAJOR.MINOR.PATCH Version" required: true type: string rocm_nightly_build: description: "Nightly build id (YYYYMMDD-); empty for non-nightly" required: false default: "" type: string publish_cache: description: "Also push the floating registry cache (--cache-to); for nightly fallback builds only." required: false default: false type: boolean outputs: ci_image: description: "The full name & tag of the CI image to use." value: ${{ inputs.ci_image_name }} ci_image_nvidia: description: "The full name & nvidia tag of the CI image to use." value: ${{ inputs.ci_image_name_nvidia }} permissions: contents: read packages: write jobs: build_AIS_image: runs-on: [ubuntu-24.04] container: docker:28.5 steps: - name: Fetching code repository... uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: sparse-checkout: | projects/hipfile .github/workflows - name: Authenticating to GitHub Container Registry. uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Setup Docker Builder uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 with: name: ais-builder driver: docker-container cache-binary: false # True uses the GHA Cache Backend - name: Build base image for AIS CI # The floating nightly cache is normally produced by # hipfile-image-update-nightly.yml; publish_cache lets a per-PR nightly # fallback build refresh it too (no other version should set publish_cache). run: | docker buildx build \ -f "${GITHUB_WORKSPACE}/projects/hipfile/util/docker/DOCKERFILE.ais_ci_${AIS_INPUT_PLATFORM}" \ --target base \ --build-arg BUILDKIT_INLINE_CACHE=1 \ --build-arg ROCM_VERSION=${AIS_INPUT_ROCM_VERSION} \ --build-arg ROCM_NIGHTLY_BUILD=${AIS_INPUT_ROCM_NIGHTLY_BUILD} \ --cache-from=type=registry,ref="${AIS_INPUT_CI_IMAGE_NAME}" \ --cache-from=type=registry,ref="${AIS_INPUT_CI_IMAGE_CACHE}" \ ${AIS_BASE_CACHE_TO} \ --push \ -t "${AIS_INPUT_CI_IMAGE_NAME}" \ "${GITHUB_WORKSPACE}/projects/hipfile/util/docker" - name: Build NVIDIA image for AIS CI run: | docker buildx build \ -f "${GITHUB_WORKSPACE}/projects/hipfile/util/docker/DOCKERFILE.ais_ci_${AIS_INPUT_PLATFORM}" \ --target nvidia \ --build-arg BUILDKIT_INLINE_CACHE=1 \ --build-arg ROCM_VERSION=${AIS_INPUT_ROCM_VERSION} \ --build-arg ROCM_NIGHTLY_BUILD=${AIS_INPUT_ROCM_NIGHTLY_BUILD} \ --cache-from=type=registry,ref="${AIS_INPUT_CI_IMAGE_NAME}" \ --cache-from=type=registry,ref="${AIS_INPUT_CI_IMAGE_NAME_NVIDIA}" \ --cache-from=type=registry,ref="${AIS_INPUT_CI_IMAGE_CACHE_NVIDIA}" \ ${AIS_NVIDIA_CACHE_TO} \ --push \ -t "${AIS_INPUT_CI_IMAGE_NAME_NVIDIA}" \ "${GITHUB_WORKSPACE}/projects/hipfile/util/docker"