Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 115 additions & 46 deletions .github/workflows/image-publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2021-2024 Red Hat, Inc.
# Copyright (c) 2021-2025 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
Expand All @@ -24,68 +24,151 @@ jobs:
fail-fast: false
matrix:
dist: [ 'musl', 'libc-ubi8', 'libc-ubi9' ]
arch: ['amd64']
runs-on: ubuntu-22.04
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
runs-on: ${{matrix.runners}}
steps:
- name: Set arch environment variable
run: |
if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then
echo arch="amd64" >> $GITHUB_ENV
else
echo arch="arm64" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: actions/checkout@v4
- name: Docker Build
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
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}} .
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}} .
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
uses: ishworkh/container-image-artifact-upload@v2.0.0
with:
image: "linux-${{matrix.dist}}-${{matrix.arch}}"
image: "linux-${{matrix.dist}}-${{env.arch}}"

assemble:
name: assemble
needs: build
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
runs-on: ${{matrix.runners}}
steps:
- name: Set variables
- name: Checkout
uses: actions/checkout@v4
- name: Set branch environment variable
run: |
BRANCH_NAME=${{ github.ref }}
echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Set arch environment variable
run: |
if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then
echo arch="amd64" >> $GITHUB_ENV
else
echo arch="arm64" >> $GITHUB_ENV
fi
- name: Set tag suffix environment variable
run: |
SHORT_SHA1=$(git rev-parse --short=7 HEAD)
if [[ ${{env.BRANCH_NAME}} == main ]]; then
echo "tag_suffix=${SHORT_SHA1}" >> $GITHUB_ENV
elif [[ ${{env.BRANCH_NAME}} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
echo "tag_suffix=${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
fi
- name: Download linux-libc-ubi8-amd64 image
uses: ishworkh/docker-image-artifact-download@v1
uses: ishworkh/container-image-artifact-download@v2.0.0
with:
image: "linux-libc-ubi8-amd64"
image: "linux-libc-ubi8-${{env.arch}}"
- name: Download linux-libc-ubi9-amd64 image
uses: ishworkh/docker-image-artifact-download@v1
uses: ishworkh/container-image-artifact-download@v2.0.0
with:
image: "linux-libc-ubi9-amd64"
image: "linux-libc-ubi9-${{env.arch}}"
- name: Download linux-musl image
uses: ishworkh/docker-image-artifact-download@v1
uses: ishworkh/container-image-artifact-download@v2.0.0
with:
image: "linux-musl-amd64"
image: "linux-musl-${{env.arch}}"
- name: Display docker images
run: docker images
- name: Update assembly.Dockerfile
run: |
docker images
sed "s|FROM linux-libc-ubi8|FROM linux-libc-ubi8-${{env.arch}}|" -i "build/dockerfiles/assembly.Dockerfile"
sed "s|FROM linux-libc-ubi9|FROM linux-libc-ubi9-${{env.arch}}|" -i "build/dockerfiles/assembly.Dockerfile"
sed "s|FROM linux-musl|FROM linux-musl-${{env.arch}}|" -i "build/dockerfiles/assembly.Dockerfile"
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Docker Build and Push
password: ${{ secrets.QUAY_PASSWORD }}
- name: Assemble che-code
run: |
docker buildx build \
--platform linux/${{env.arch}} \
--progress=plain \
--push \
-f build/dockerfiles/assembly.Dockerfile \
-t quay.io/che-incubator/che-code:${{env.arch}}-${{env.tag_suffix}} .

publish:
name: publish
needs: assemble
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set branch environment variable
run: |
BRANCH_NAME=${{ github.ref }}
echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
- name: Set tag suffix environment variable
run: |
SHORT_SHA1=$(git rev-parse --short=7 HEAD)
if [[ ${{ env.BRANCH_NAME }} == main ]]; then
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} .
elif [[ ${{ env.BRANCH_NAME }} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
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 .
if [[ ${{env.BRANCH_NAME}} == main ]]; then
echo "tag_suffix=${SHORT_SHA1}" >> $GITHUB_ENV
elif [[ ${{env.BRANCH_NAME}} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
echo "tag_suffix=${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
fi
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: publish
run: |
SHORT_SHA1=$(git rev-parse --short=7 HEAD)
if [[ ${{env.BRANCH_NAME}} == main ]]; then
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}}
docker manifest annotate quay.io/che-incubator/che-code:next quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
docker manifest annotate quay.io/che-incubator/che-code:next quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
docker manifest push quay.io/che-incubator/che-code:next

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}}
docker manifest annotate quay.io/che-incubator/che-code:insiders quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
docker manifest annotate quay.io/che-incubator/che-code:insiders quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
docker manifest push quay.io/che-incubator/che-code:insiders

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}}
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
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
docker manifest push quay.io/che-incubator/che-code:insiders-${SHORT_SHA1}
elif [[ ${{env.BRANCH_NAME}} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
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}}
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
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
docker manifest push quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }}

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}}
docker manifest annotate quay.io/che-incubator/che-code:latest quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
docker manifest annotate quay.io/che-incubator/che-code:latest quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
docker manifest push quay.io/che-incubator/che-code:latest
fi

release-finish:
name: release-finish
needs: [build, assemble]
needs: [build, assemble, publish]
runs-on: ubuntu-22.04
# don't notify for cancelled builds
if: (success() || failure()) && github.ref != 'refs/heads/main'
Expand All @@ -94,34 +177,20 @@ jobs:
run: |
BRANCH_NAME=${{ github.ref }}
echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
#- name: Create failure MM message
#if: contains(join(needs.*.result, ','), 'failure')
#run: |
#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
#- name: Create success MM message
#run: |
#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
#- name: Send MM message
# don't notify for cancelled builds
#if: success() || failure()
#uses: mattermost/action-mattermost-notify@1.1.0
#env:
#MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
#MATTERMOST_CHANNEL: eclipse-che-releases
#MATTERMOST_USERNAME: che-bot

dev:
name: dev
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Docker Build and Push
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/pull-request-check-publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2021 Red Hat, Inc.
# Copyright (c) 2021-2025 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
Expand Down Expand Up @@ -58,30 +58,38 @@ jobs:

- name: Load Docker images
run: |
docker load -i che-code.tgz
docker load -i che-code-amd64.tgz
docker load -i che-code-arm64.tgz
docker load -i che-dev.tgz

- name: Login to Quay.io
uses: docker/login-action@v3
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_PULL_REQUESTS_USERNAME }}
password: ${{ secrets.QUAY_PULL_REQUESTS_PASSWORD }}

- name: Push che-code docker image
- name: Push che-code-amd64 docker image
run: |
export IMAGE=quay.io/che-incubator-pull-requests/che-code:pr-${{env._PR_NUMBER}}-amd64
docker tag che-code ${IMAGE}
export IMAGE=quay.io/che-incubator/che-code:pr-${{env._PR_NUMBER}}-amd64
docker tag che-code-amd64 ${IMAGE}
docker push ${IMAGE}
echo "_CHE_CODE_IMAGE=${IMAGE}" >> $GITHUB_ENV
echo "_CHE_CODE_AMD64_IMAGE=${IMAGE}" >> $GITHUB_ENV

- name: Push che-code-arm64 docker image
run: |
export IMAGE=quay.io/che-incubator/che-code:pr-${{env._PR_NUMBER}}-arm64
docker tag che-code-arm64 ${IMAGE}
docker push ${IMAGE}
echo "_CHE_CODE_ARM64_IMAGE=${IMAGE}" >> $GITHUB_ENV

- name: Push che-dev docker image
run: |
export IMAGE=quay.io/che-incubator-pull-requests/che-code-dev:pr-${{env._PR_NUMBER}}-dev-amd64
export IMAGE=quay.io/che-incubator/che-code-dev:pr-${{env._PR_NUMBER}}-dev-amd64
docker tag che-dev ${IMAGE}
docker push ${IMAGE}
echo "_CHE_DEV_IMAGE=${IMAGE}" >> $GITHUB_ENV

- name: 'Comment PR'
uses: actions/github-script@v7
with:
Expand All @@ -91,5 +99,5 @@ jobs:
issue_number: process.env._PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Pull Request images published ✨\n\nEditor: [${process.env._CHE_CODE_IMAGE}](https://${process.env._CHE_CODE_IMAGE})\nDev image: [${process.env._CHE_DEV_IMAGE}](https://${process.env._CHE_DEV_IMAGE})`
body: `Pull Request images published ✨\n\nEditor amd64: [${process.env._CHE_CODE_AMD64_IMAGE}](https://${process.env._CHE_CODE_AMD64_IMAGE})\nEditor arm64: [${process.env._CHE_CODE_ARM64_IMAGE}](https://${process.env._CHE_CODE_ARM64_IMAGE})\nDev image: [${process.env._CHE_DEV_IMAGE}](https://${process.env._CHE_DEV_IMAGE})`
})
Loading
Loading