Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

This patch makes the metrics container build/push job use the common container build/push actions to simplify the workflow by quite a bit.

This patch makes the metrics container build/push job use the common
container build/push actions to simplify the workflow by quite a bit.
@llvmbot
Copy link
Member

llvmbot commented Nov 19, 2025

@llvm/pr-subscribers-github-workflow

Author: Aiden Grossman (boomanaiden154)

Changes

This patch makes the metrics container build/push job use the common container build/push actions to simplify the workflow by quite a bit.


Full diff: https://github.com/llvm/llvm-project/pull/168667.diff

1 Files Affected:

  • (modified) .github/workflows/build-metrics-container.yml (+12-36)
diff --git a/.github/workflows/build-metrics-container.yml b/.github/workflows/build-metrics-container.yml
index 786c41214d853..f768d66dceb3a 100644
--- a/.github/workflows/build-metrics-container.yml
+++ b/.github/workflows/build-metrics-container.yml
@@ -21,39 +21,17 @@ jobs:
   build-metrics-container:
     if: github.repository_owner == 'llvm'
     runs-on: ubuntu-24.04
-    outputs:
-      container-name: ${{ steps.vars.outputs.container-name }}
-      container-name-tag: ${{ steps.vars.outputs.container-name-tag }}
-      container-filename: ${{ steps.vars.outputs.container-filename }}
     steps:
       - name: Checkout LLVM
         uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
         with:
           sparse-checkout: .ci/metrics/
-      - name: Write Variables
-        id: vars
-        run: |
-          tag=`date +%s`
-          container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/metrics"
-          echo "container-name=$container_name" >> $GITHUB_OUTPUT
-          echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
-          echo "container-filename=$(echo $container_name:$tag  | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
       - name: Build Container
-        working-directory: ./.ci/metrics
-        run: |
-          podman build -t ${{ steps.vars.outputs.container-name-tag }} -f Dockerfile .
-      # Save the container so we have it in case the push fails.  This also
-      # allows us to separate the push step into a different job so we can
-      # maintain minimal permissions while building the container.
-      - name: Save Container Image
-        run: |
-          podman save  ${{ steps.vars.outputs.container-name-tag }} >  ${{ steps.vars.outputs.container-filename }}
-      - name: Upload Container Image
-        uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
+        uses: ./.github/actions/build-container
         with:
-          name: container
-          path: ${{ steps.vars.outputs.container-filename }}
-          retention-days: 14
+          container-name: metrics
+          context: .ci/metrics
+          dockerfile: .ci/metrics/Dockerfile
   
   push-metrics-container:
     if: github.event_name == 'push'
@@ -65,14 +43,12 @@ jobs:
     env:
       GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     steps:
-      - name: Download Container
-        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
+      - name: Checkout LLVM
+        uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+        with:
+          sparse-checkout: |
+            .github/actions/push-container
+
+      - uses: ./.github/actions/push-container
         with:
-          name: container
-      - name: Push Container
-        run: |
-          podman load -i ${{ needs.build-metrics-container.outputs.container-filename }}
-          podman tag ${{ needs.build-metrics-container.outputs.container-name-tag }} ${{ needs.build-metrics-container.outputs.container-name }}:latest
-          podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
-          podman push ${{ needs.build-metrics-container.outputs.container-name-tag }}
-          podman push ${{ needs.build-metrics-container.outputs.container-name }}:latest
+          token: ${{ secrets.GITHUB_TOKEN }}

sparse-checkout: |
.github/actions/push-container
- uses: ./.github/actions/push-container
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the hyphen in front of "uses" a typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It's needed to denote an item in a YAML list, in this case the list of steps.

@boomanaiden154 boomanaiden154 merged commit 0f615dc into llvm:main Nov 19, 2025
14 checks passed
@boomanaiden154 boomanaiden154 deleted the metrics-container-use-actions branch November 19, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants