-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[Github] Make metrics container build use common actions #168667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Github] Make metrics container build use common actions #168667
Conversation
This patch makes the metrics container build/push job use the common container build/push actions to simplify the workflow by quite a bit.
|
@llvm/pr-subscribers-github-workflow Author: Aiden Grossman (boomanaiden154) ChangesThis 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:
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
This patch makes the metrics container build/push job use the common container build/push actions to simplify the workflow by quite a bit.