11#
2- # Copyright (c) 2021-2024 Red Hat, Inc.
2+ # Copyright (c) 2021-2025 Red Hat, Inc.
33# This program and the accompanying materials are made
44# available under the terms of the Eclipse Public License 2.0
55# which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -24,68 +24,151 @@ jobs:
2424 fail-fast : false
2525 matrix :
2626 dist : [ 'musl', 'libc-ubi8', 'libc-ubi9' ]
27- arch : ['amd64 ']
28- runs-on : ubuntu-22.04
27+ runners : ['ubuntu-22.04', 'ubuntu-22.04-arm ']
28+ runs-on : ${{matrix.runners}}
2929 steps :
30+ - name : Set arch environment variable
31+ run : |
32+ if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then
33+ echo arch="amd64" >> $GITHUB_ENV
34+ else
35+ echo arch="arm64" >> $GITHUB_ENV
36+ fi
3037 - name : Checkout
31- uses : actions/checkout@v3
32- - name : Set up QEMU
33- uses : docker/setup-qemu-action@v2
34- - name : Set up Docker Buildx
35- uses : docker/setup-buildx-action@v2
38+ uses : actions/checkout@v4
3639 - name : Docker Build
3740 env :
3841 # https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
3942 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4043 run : |
41- docker buildx build --memory-swap -1 --memory 10g --platform linux/${{matrix .arch}} -f build/dockerfiles/linux-${{matrix.dist}}.Dockerfile --load -t linux-${{matrix.dist}}-${{matrix .arch}} .
44+ docker buildx build --memory-swap -1 --memory 10g --platform linux/${{env .arch}} -f build/dockerfiles/linux-${{matrix.dist}}.Dockerfile --load -t linux-${{matrix.dist}}-${{env .arch}} .
4245 - name : Upload image
4346 uses : ishworkh/container-image-artifact-upload@v2.0.0
4447 with :
45- image : " linux-${{matrix.dist}}-${{matrix.arch}}"
48+ image : " linux-${{matrix.dist}}-${{env.arch}}"
49+
4650 assemble :
4751 name : assemble
4852 needs : build
49- runs-on : ubuntu-22.04
53+ strategy :
54+ fail-fast : false
55+ matrix :
56+ runners : ['ubuntu-22.04', 'ubuntu-22.04-arm']
57+ runs-on : ${{matrix.runners}}
5058 steps :
51- - name : Set variables
59+ - name : Checkout
60+ uses : actions/checkout@v4
61+ - name : Set branch environment variable
5262 run : |
5363 BRANCH_NAME=${{ github.ref }}
5464 echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
55- - name : Checkout
56- uses : actions/checkout@v3
65+ - name : Set arch environment variable
66+ run : |
67+ if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then
68+ echo arch="amd64" >> $GITHUB_ENV
69+ else
70+ echo arch="arm64" >> $GITHUB_ENV
71+ fi
72+ - name : Set tag suffix environment variable
73+ run : |
74+ SHORT_SHA1=$(git rev-parse --short=7 HEAD)
75+ if [[ ${{env.BRANCH_NAME}} == main ]]; then
76+ echo "tag_suffix=${SHORT_SHA1}" >> $GITHUB_ENV
77+ elif [[ ${{env.BRANCH_NAME}} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
78+ echo "tag_suffix=${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
79+ fi
5780 - name : Download linux-libc-ubi8-amd64 image
5881 uses : ishworkh/container-image-artifact-download@v2.0.0
5982 with :
60- image : " linux-libc-ubi8-amd64 "
83+ image : " linux-libc-ubi8-${{env.arch}} "
6184 - name : Download linux-libc-ubi9-amd64 image
6285 uses : ishworkh/container-image-artifact-download@v2.0.0
6386 with :
64- image : " linux-libc-ubi9-amd64 "
87+ image : " linux-libc-ubi9-${{env.arch}} "
6588 - name : Download linux-musl image
6689 uses : ishworkh/container-image-artifact-download@v2.0.0
6790 with :
68- image : " linux-musl-amd64 "
91+ image : " linux-musl-${{env.arch}} "
6992 - name : Display docker images
93+ run : docker images
94+ - name : Update assembly.Dockerfile
7095 run : |
71- docker images
96+ sed "s|FROM linux-libc-ubi8|FROM linux-libc-ubi8-${{env.arch}}|" -i "build/dockerfiles/assembly.Dockerfile"
97+ sed "s|FROM linux-libc-ubi9|FROM linux-libc-ubi9-${{env.arch}}|" -i "build/dockerfiles/assembly.Dockerfile"
98+ sed "s|FROM linux-musl|FROM linux-musl-${{env.arch}}|" -i "build/dockerfiles/assembly.Dockerfile"
7299 - name : Login to Quay.io
73100 uses : docker/login-action@v2
74101 with :
75102 registry : quay.io
76103 username : ${{ secrets.QUAY_USERNAME }}
77- password : ${{ secrets.QUAY_PASSWORD }}
78- - name : Docker Build and Push
104+ password : ${{ secrets.QUAY_PASSWORD }}
105+ - name : Assemble che-code
106+ run : |
107+ docker buildx build \
108+ --platform linux/${{env.arch}} \
109+ --progress=plain \
110+ --push \
111+ -f build/dockerfiles/assembly.Dockerfile \
112+ -t quay.io/che-incubator/che-code:${{env.arch}}-${{env.tag_suffix}} .
113+
114+ publish :
115+ name : publish
116+ needs : assemble
117+ runs-on : ubuntu-22.04
118+ steps :
119+ - name : Checkout
120+ uses : actions/checkout@v4
121+ - name : Set branch environment variable
122+ run : |
123+ BRANCH_NAME=${{ github.ref }}
124+ echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
125+ - name : Set tag suffix environment variable
79126 run : |
80127 SHORT_SHA1=$(git rev-parse --short=7 HEAD)
81- if [[ ${{ env.BRANCH_NAME }} == main ]]; then
82- docker buildx build --platform linux/amd64 -f build/dockerfiles/assembly.Dockerfile --push -t quay.io/che-incubator/che-code:insiders -t quay.io/che-incubator/che-code:next -t quay.io/che-incubator/che-code:insiders- ${SHORT_SHA1} .
83- elif [[ ${{ env.BRANCH_NAME }} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
84- docker buildx build --platform linux/amd64 -f build/dockerfiles/assembly.Dockerfile --push -t quay.io/che-incubator/che-code: ${{ env.BRANCH_NAME }} -t quay.io/che-incubator/che-code:latest .
128+ if [[ ${{env.BRANCH_NAME}} == main ]]; then
129+ echo "tag_suffix= ${SHORT_SHA1}" >> $GITHUB_ENV
130+ elif [[ ${{env.BRANCH_NAME}} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
131+ echo "tag_suffix= ${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
85132 fi
133+ - name : Login to Quay.io
134+ uses : docker/login-action@v2
135+ with :
136+ registry : quay.io
137+ username : ${{ secrets.QUAY_USERNAME }}
138+ password : ${{ secrets.QUAY_PASSWORD }}
139+ - name : publish
140+ run : |
141+ SHORT_SHA1=$(git rev-parse --short=7 HEAD)
142+ if [[ ${{env.BRANCH_NAME}} == main ]]; then
143+ docker manifest create quay.io/che-incubator/che-code:next --amend quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --amend quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}}
144+ docker manifest annotate quay.io/che-incubator/che-code:next quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
145+ docker manifest annotate quay.io/che-incubator/che-code:next quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
146+ docker manifest push quay.io/che-incubator/che-code:next
147+
148+ docker manifest create quay.io/che-incubator/che-code:insiders --amend quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --amend quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}}
149+ docker manifest annotate quay.io/che-incubator/che-code:insiders quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
150+ docker manifest annotate quay.io/che-incubator/che-code:insiders quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
151+ docker manifest push quay.io/che-incubator/che-code:insiders
152+
153+ docker manifest create quay.io/che-incubator/che-code:insiders-${SHORT_SHA1} --amend quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --amend quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}}
154+ docker manifest annotate quay.io/che-incubator/che-code:insiders-${SHORT_SHA1} quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
155+ docker manifest annotate quay.io/che-incubator/che-code:insiders-${SHORT_SHA1} quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
156+ docker manifest push quay.io/che-incubator/che-code:insiders-${SHORT_SHA1}
157+ elif [[ ${{env.BRANCH_NAME}} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
158+ docker manifest create quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }} --amend quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --amend quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}}
159+ docker manifest annotate quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }} quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
160+ docker manifest annotate quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }} quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
161+ docker manifest push quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }}
162+
163+ docker manifest create quay.io/che-incubator/che-code:latest --amend quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --amend quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}}
164+ docker manifest annotate quay.io/che-incubator/che-code:latest quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
165+ docker manifest annotate quay.io/che-incubator/che-code:latest quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
166+ docker manifest push quay.io/che-incubator/che-code:latest
167+ fi
168+
86169 release-finish :
87170 name : release-finish
88- needs : [build, assemble]
171+ needs : [build, assemble, publish ]
89172 runs-on : ubuntu-22.04
90173 # don't notify for cancelled builds
91174 if : (success() || failure()) && github.ref != 'refs/heads/main'
@@ -94,34 +177,20 @@ jobs:
94177 run : |
95178 BRANCH_NAME=${{ github.ref }}
96179 echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
97- # - name: Create failure MM message
98- # if: contains(join(needs.*.result, ','), 'failure')
99- # run: |
100- # echo "{\"text\":\":no_entry_sign: Che Code ${{ env.BRANCH_NAME }} release has failed: https://github.com/che-incubator/che-code/actions/workflows/image-publish.yml\"}" > mattermost.json
101- # - name: Create success MM message
102- # run: |
103- # echo "{\"text\":\":white_check_mark: Che Code ${{ env.BRANCH_NAME }} has been released: https://quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }}\"}" > mattermost.json
104- # - name: Send MM message
105- # don't notify for cancelled builds
106- # if: success() || failure()
107- # uses: mattermost/action-mattermost-notify@1.1.0
108- # env:
109- # MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
110- # MATTERMOST_CHANNEL: eclipse-che-releases
111- # MATTERMOST_USERNAME: che-bot
180+
112181 dev :
113182 name : dev
114183 runs-on : ubuntu-22.04
115184 if : github.ref == 'refs/heads/main'
116185 steps :
117186 - name : Checkout
118- uses : actions/checkout@v3
187+ uses : actions/checkout@v4
119188 - name : Login to Quay.io
120189 uses : docker/login-action@v2
121190 with :
122191 registry : quay.io
123192 username : ${{ secrets.QUAY_USERNAME }}
124- password : ${{ secrets.QUAY_PASSWORD }}
193+ password : ${{ secrets.QUAY_PASSWORD }}
125194 - name : Docker Build and Push
126195 env :
127196 # https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
0 commit comments