Skip to content

Commit ec4465f

Browse files
authored
Merge pull request #61 from leooamaral/feat/add-arm-lifecycle
feat: add arm container image in the lifecycle manager pipeline
2 parents bd49e03 + eab33e5 commit ec4465f

File tree

1 file changed

+66
-27
lines changed

1 file changed

+66
-27
lines changed
Lines changed: 66 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
name: Build and Publish Extension [Container and Helm Chart]
1+
name: Build and Publish Extension [Container and Helm Chart - Multi-Arch]
22

33
on: [push, pull_request, workflow_dispatch]
44

55
env:
66
CHART_PATH: charts/suse-ai-lifecycle-manager
77
CHART_REGISTRY: oci://ghcr.io/suse/chart
8+
IMAGE_NAME: ghcr.io/suse/suse-ai-lifecycle-manager
89

910
jobs:
10-
build-extension:
11-
name: Build Container Image and Helm Chart
11+
prepare:
1212
runs-on: ubuntu-latest
13-
permissions:
14-
actions: write
15-
contents: read
16-
packages: write
17-
steps:
18-
- name: Checkout repository
19-
uses: actions/checkout@v5
20-
13+
outputs:
14+
release_tag: ${{ steps.tags.outputs.TAGS }}
15+
steps:
2116
- name: Calculate tags
2217
id: tags
2318
shell: bash
@@ -34,8 +29,28 @@ jobs:
3429
esac
3530
echo "##" >> "$GITHUB_OUTPUT"
3631
37-
- name: Enable Corepack
38-
run: corepack enable
32+
build:
33+
strategy:
34+
matrix:
35+
arch:
36+
- amd64
37+
- arm64
38+
include:
39+
- arch: amd64
40+
runner: ubuntu-24.04
41+
- arch: arm64
42+
runner: ubuntu-24.04-arm
43+
runs-on: ${{ matrix.runner }}
44+
name: Build Container Image
45+
needs: prepare
46+
env:
47+
RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }}
48+
permissions:
49+
contents: read
50+
packages: write
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v5
3954

4055
- name: Configure Git
4156
run: |
@@ -55,6 +70,9 @@ jobs:
5570
node-version: '20'
5671
cache: yarn
5772

73+
- name: Enable Corepack
74+
run: corepack enable
75+
5876
- name: Install dependencies
5977
run: yarn
6078

@@ -63,36 +81,57 @@ jobs:
6381
id: parsed-name
6482
env:
6583
GH_TOKEN: ${{ github.token }}
66-
RELEASE_TAG: ${{ steps.tags.outputs.TAGS }}
6784
run: |
6885
yarn parse-tag-name ${{ env.RELEASE_TAG }} ${{ github.run_id }} "catalog"
6986
70-
- name: Build and push UI image
87+
- name: Build image
7188
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
72-
env:
73-
RELEASE_TAG: ${{ steps.tags.outputs.TAGS }}
7489
run: |
75-
publish=(yarn publish-pkgs -c -p -i '' -r ghcr.io -o 'suse')
90+
yarn publish-pkgs -c -i '' -r ghcr.io -o 'suse' -t "${{ env.RELEASE_TAG }}"
7691
77-
if [[ -n "${{ env.RELEASE_TAG }}" ]]; then
78-
publish+=(-t "$RELEASE_TAG")
79-
fi
92+
- name: Tag and Push Image
93+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
94+
run: |
95+
VERSION=${RELEASE_TAG##*-}
96+
docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:$VERSION-${{ matrix.arch }}
97+
docker push $IMAGE_NAME:$VERSION-${{ matrix.arch }}
8098
81-
"${publish[@]}"
99+
manifest:
100+
name: Create Container Manifest and Helm Chart
101+
needs: [prepare, build]
102+
env:
103+
RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }}
104+
runs-on: ubuntu-latest
105+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
106+
permissions:
107+
contents: read
108+
packages: write
109+
steps:
110+
- name: Checkout repository
111+
uses: actions/checkout@v5
112+
113+
- uses: docker/login-action@v3
114+
with:
115+
registry: ghcr.io
116+
username: ${{ github.actor }}
117+
password: ${{ secrets.GITHUB_TOKEN }}
82118

83-
- name: Re-checkout repository
84-
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
85-
uses: actions/checkout@v4
119+
- name: Create multi-arch manifest
120+
run: |
121+
VERSION=${RELEASE_TAG##*-}
122+
123+
docker buildx imagetools create \
124+
-t $IMAGE_NAME:$VERSION \
125+
$IMAGE_NAME:$VERSION-amd64 \
126+
$IMAGE_NAME:$VERSION-arm64
86127

87128
- name: Package Helm Chart
88-
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
89129
id: package
90130
run: |
91131
chart_package=$(helm package $CHART_PATH --destination . | awk '{print $NF}')
92132
echo "chart_package=$chart_package" >> $GITHUB_OUTPUT
93133
94134
- name: Publish Helm Chart
95-
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
96135
run: |
97136
helm push ${{ steps.package.outputs.chart_package }} \
98137
$CHART_REGISTRY

0 commit comments

Comments
 (0)