From d724bc41f079ce6f7e5be77a32041a96ec861780 Mon Sep 17 00:00:00 2001 From: Riley Dixon Date: Tue, 4 Nov 2025 20:34:27 -0700 Subject: [PATCH 1/3] Use Artifacts instead of Registry for moving CI Image We would like to eventually move to a fork-based development model. However, PR's from fork's are unable to push images to the GHCR registry (they could push something bad). So instead, this changes CI to use artifacts instead to pass around the container image. Surprisingly, this actually slightly reduces the time it takes to load & start the Docker container. --- .github/workflows/build_ais.yml | 48 ++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_ais.yml b/.github/workflows/build_ais.yml index a7650964..2d6361ac 100644 --- a/.github/workflows/build_ais.yml +++ b/.github/workflows/build_ais.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Set AIS CI image environment variables run: | - echo "AIS_CI_DEV_IMAGE=${{ env.AIS_DOCKER_REGISTRY }}/${{ env.AIS_CI_IMAGE_NAME }}_dev:$(echo ${{ github.ref }} \ + echo "AIS_CI_DEV_IMAGE=${{ env.AIS_CI_IMAGE_NAME }}_dev:$(echo ${{ github.ref }} \ | sed 's|[^a-zA-Z0-9]|-|g')" >> "$GITHUB_ENV" echo "AIS_CI_LATEST_IMAGE=${{ env.AIS_DOCKER_REGISTRY }}/${{ env.AIS_CI_IMAGE_NAME }}:latest" >> "$GITHUB_ENV" echo "AIS_PR_NUMBER=$(echo ${{ github.ref }} | sed 's|[^0-9]||g')" >> "$GITHUB_ENV" @@ -47,11 +47,18 @@ jobs: ${{ env.AIS_CI_IMAGE_NAME }} Development Image for AIS CI using branch \ ${{ github.head_ref }} for PR #${AIS_PR_NUMBER}. \ PR URL: ${{ env.AIS_PR_BASE_URL }}/${AIS_PR_NUMBER}" \ - --cache-to=type=registry,ref="${{ env.AIS_DOCKER_REGISTRY }}/${{ env.AIS_CI_IMAGE_NAME }}_dev:cache" \ --cache-from=type=registry,ref="${{ env.AIS_DOCKER_REGISTRY }}/${{ env.AIS_CI_IMAGE_NAME }}_dev:cache" \ - --push \ - -t ${AIS_CI_DEV_IMAGE} \ + --output=type=docker,dest=${GITHUB_WORKSPACE}/${{ env.AIS_CI_IMAGE_NAME}}_dev.tar \ + -t ${{ env.AIS_CI_IMAGE_NAME }}_dev \ ${GITHUB_WORKSPACE} + - name: Upload AIS CI image as an artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.AIS_CI_IMAGE_NAME }}_dev.tar + path: ${{ github.workspace }}/${{ env.AIS_CI_IMAGE_NAME }}_dev.tar + compression-level: 0 + if-no-files-found: error + retention-days: 1 compile_on_AMD: runs-on: [ubuntu-24.04] needs: build_AIS_image @@ -71,6 +78,13 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Download AIS CI image artifact + uses: actions/download-artifact@v4 + with: + name: ${{ env.AIS_CI_IMAGE_NAME }}_dev.tar + path: ${{ github.workspace }} + - name: Load AIS CI image into Docker + run: docker load --input ${GITHUB_WORKSPACE}/${{ env.AIS_CI_IMAGE_NAME }}_dev.tar # Detach the container and run separate commands to it. # Thus we can make separate explicit steps in the Github CI # as if we were able to parameterize the container image in the first place. @@ -79,11 +93,10 @@ jobs: docker run \ -dt \ --rm \ - --pull always \ -v ${GITHUB_WORKSPACE}:/mnt/ais:ro \ -v ${{ env.AIS_MOUNT_PATH }}:/mnt/ais-fs \ --name ${AIS_CONTAINER_NAME} \ - ${AIS_CI_DEV_IMAGE} + ${{ env.AIS_CI_IMAGE_NAME }}_dev - name: Make copy of the code repository and create build directories # Single quotes necessary to ensure string/command substitutions happen # in the container and not on the host. @@ -181,16 +194,22 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Download AIS CI image artifact + uses: actions/download-artifact@v4 + with: + name: ${{ env.AIS_CI_IMAGE_NAME }}_dev.tar + path: ${{ github.workspace }} + - name: Load AIS CI image into Docker + run: docker load --input ${GITHUB_WORKSPACE}/${{ env.AIS_CI_IMAGE_NAME }}_dev.tar - name: Starting Docker Container run: | docker run \ -dt \ --rm \ - --pull always \ -v ${GITHUB_WORKSPACE}:/mnt/ais:ro \ -v ${{ env.AIS_MOUNT_PATH }}:/mnt/ais-fs \ --name ${AIS_CONTAINER_NAME} \ - ${AIS_CI_DEV_IMAGE} + ${{ env.AIS_CI_IMAGE_NAME }}_dev - name: Make copy of the code repository and create build directories run: | docker exec \ @@ -246,6 +265,13 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Download AIS CI image artifact + uses: actions/download-artifact@v4 + with: + name: ${{ env.AIS_CI_IMAGE_NAME }}_dev.tar + path: ${{ github.workspace }} + - name: Load AIS CI image into Docker + run: docker load --input ${GITHUB_WORKSPACE}/${{ env.AIS_CI_IMAGE_NAME }}_dev.tar # Detach the container and run separate commands to it. # Thus we can make separate explicit steps in the Github CI # as if we were able to parameterize the container image in the first place. @@ -257,11 +283,10 @@ jobs: --device=/dev/kfd \ --device=/dev/dri \ --security-opt seccomp=unconfined \ - --pull always \ -v ${GITHUB_WORKSPACE}:/mnt/ais:ro \ -v ${{ env.AIS_MOUNT_PATH }}:/mnt/ais-fs \ --name ${AIS_CONTAINER_NAME} \ - ${AIS_CI_DEV_IMAGE} + ${{ env.AIS_CI_IMAGE_NAME }}_dev - name: Make copy of the code repository and create build directories run: | docker exec \ @@ -349,11 +374,10 @@ jobs: docker run \ -dt \ --rm \ - --pull always \ -v ${GITHUB_WORKSPACE}:/mnt/ais:ro \ -v ${{ env.AIS_MOUNT_PATH }}:/mnt/ais-fs \ --name ${AIS_CONTAINER_NAME} \ - ${AIS_CI_DEV_IMAGE} + ${{ env.AIS_CI_IMAGE_NAME }}_dev - name: Make copy of the code repository and create build directories run: | docker exec \ From 3795d6591996041bf33e1c8ebb7e18a675c64db5 Mon Sep 17 00:00:00 2001 From: Riley Dixon Date: Tue, 4 Nov 2025 20:35:45 -0700 Subject: [PATCH 2/3] Update hipfile-nvidia.yml --- .github/workflows/hipfile-nvidia.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/hipfile-nvidia.yml b/.github/workflows/hipfile-nvidia.yml index 2234e80e..9d4ef7bb 100644 --- a/.github/workflows/hipfile-nvidia.yml +++ b/.github/workflows/hipfile-nvidia.yml @@ -32,6 +32,13 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Download AIS CI image artifact + uses: actions/download-artifact@v4 + with: + name: ${{ env.AIS_CI_IMAGE_NAME }}_dev.tar + path: ${{ github.workspace }} + - name: Load AIS CI image into Docker + run: docker load --input ${GITHUB_WORKSPACE}/${{ env.AIS_CI_IMAGE_NAME }}_dev.tar # Detach the container and run separate commands to it. # Thus we can make separate explicit steps in the Github CI # as if we were able to parameterize the container image in the first place. @@ -44,12 +51,11 @@ jobs: -e NVIDIA_GDS=enabled \ --runtime=nvidia \ --gpus all \ - --pull always \ --cap-add=CAP_SYSLOG \ -v $(pwd):/mnt/ais:ro \ -v ${{ env.AIS_MOUNT_PATH }}:/mnt/ais-fs \ --name ${AIS_CONTAINER_NAME} \ - ${AIS_CI_DEV_IMAGE} + ${{ env.AIS_CI_IMAGE_NAME }}_dev - name: Make copy of the code repository run: | docker exec \ From ad74c3e8b324e3902558bbc4e1cde32f046d1403 Mon Sep 17 00:00:00 2001 From: Riley Dixon Date: Tue, 4 Nov 2025 20:50:47 -0700 Subject: [PATCH 3/3] Add forgotten download step for compile_on_NVIDIA --- .github/workflows/build_ais.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build_ais.yml b/.github/workflows/build_ais.yml index 2d6361ac..798e5d62 100644 --- a/.github/workflows/build_ais.yml +++ b/.github/workflows/build_ais.yml @@ -366,6 +366,13 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Download AIS CI image artifact + uses: actions/download-artifact@v4 + with: + name: ${{ env.AIS_CI_IMAGE_NAME }}_dev.tar + path: ${{ github.workspace }} + - name: Load AIS CI image into Docker + run: docker load --input ${GITHUB_WORKSPACE}/${{ env.AIS_CI_IMAGE_NAME }}_dev.tar # Detach the container and run separate commands to it. # Thus we can make separate explicit steps in the Github CI # as if we were able to parameterize the container image in the first place.