Skip to content

Commit 637a948

Browse files
[CI] Make Container Build Jobs use LLVM Actions
Some common actions in llvm/llvm-project#166663 were recently introduced to make building and pushing containers much simpler. Migrate the jobs in zorg to use them to avoid the duplication.
1 parent 0f4c50a commit 637a948

File tree

1 file changed

+5
-32
lines changed

1 file changed

+5
-32
lines changed

.github/workflows/build-operations-metrics-container.yml

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,11 @@ jobs:
2828
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2929
with:
3030
sparse-checkout: premerge/ops-container
31-
- name: Write Variables
32-
id: vars
33-
run: |
34-
tag=`date +%s`
35-
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/operations-metrics"
36-
echo "container-name=$container_name" >> $GITHUB_OUTPUT
37-
echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
38-
echo "container-filename=$(echo $container_name:$tag | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
3931
- name: Build Container
40-
working-directory: premerge/ops-container
41-
run: |
42-
podman build -t ${{ steps.vars.outputs.container-name-tag }} .
43-
# Save the container so we have it in case the push fails. This also
44-
# allows us to separate the push step into a different job so we can
45-
# maintain minimal permissions while building the container.
46-
- name: Save Container Image
47-
run: |
48-
podman save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
49-
- name: Upload Container Image
50-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
32+
uses: llvm/llvm-project/.github/workflows/build-container@c940bfd7e6218c01c6a517e8d6afc8067e933ffd
5133
with:
52-
name: container
53-
path: ${{ steps.vars.outputs.container-filename }}
54-
retention-days: 14
34+
container_name: operations-metrics
35+
context: premerge/ops-container
5536

5637
push-operations-metrics-container:
5738
if: github.event_name == 'push'
@@ -63,14 +44,6 @@ jobs:
6344
env:
6445
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6546
steps:
66-
- name: Download Container Image
67-
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
47+
- uses: llvm/llvm-project/.github/workflows/push-container@c940bfd7e6218c01c6a517e8d6afc8067e933ffd
6848
with:
69-
name: container
70-
- name: Push Container
71-
run: |
72-
podman load -i ${{ needs.build-operations-metrics-container.outputs.container-filename }}
73-
podman tag ${{ needs.build-operations-metrics-container.outputs.container-name-tag }} ${{ needs.build-operations-metrics-container.outputs.container-name }}:latest
74-
podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
75-
podman push ${{ needs.build-operations-metrics-container.outputs.container-name-tag }}
76-
podman push ${{ needs.build-operations-metrics-container.outputs.container-name }}:latest
49+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)