Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
111 changes: 77 additions & 34 deletions .github/workflows/image-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,33 @@ jobs:
strategy:
fail-fast: false
matrix:
dist: [ 'musl', 'libc-ubi8', 'libc-ubi9' ]
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
runs-on: ${{matrix.runners}}
arch:
- name: amd64-build
runner: ubuntu-22.04
arch: amd64
- name: arm64-build
runner: ubuntu-22.04-arm
arch: arm64
- name: ppc64le-build
runner: ubuntu-22.04
arch: ppc64le
dist:
- libc-ubi8
- libc-ubi9
- musl
runs-on: ${{ matrix.arch.runner }}
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
run: echo "arch=${{ matrix.arch.arch }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
Comment thread
prabhuk25 marked this conversation as resolved.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
platforms: linux/amd64,linux/arm64,linux/ppc64le
- name: Docker Build
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
Expand All @@ -56,8 +70,17 @@ jobs:
strategy:
fail-fast: false
matrix:
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
runs-on: ${{matrix.runners}}
include:
- name: amd64-build
runner: ubuntu-22.04
arch: amd64
- name: arm64-build
runner: ubuntu-22.04-arm
arch: arm64
- name: ppc64le-build
runner: ubuntu-22.04
arch: ppc64le
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v6
Expand All @@ -66,12 +89,7 @@ jobs:
BRANCH_NAME=${{ github.ref }}
echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
- 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
run: echo "arch=${{ matrix.arch }}" >> $GITHUB_ENV
- name: Set tag suffix environment variable
run: |
SHORT_SHA1=$(git rev-parse --short=7 HEAD)
Expand Down Expand Up @@ -143,33 +161,58 @@ jobs:
- 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}}
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}} \
--amend quay.io/che-incubator/che-code:ppc64le-${{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:next quay.io/che-incubator/che-code:ppc64le-${{env.tag_suffix}} --os linux --arch ppc64le
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}} \
--amend quay.io/che-incubator/che-code:ppc64le-${{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 quay.io/che-incubator/che-code:ppc64le-${{env.tag_suffix}} --os linux --arch ppc64le
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}} \
--amend quay.io/che-incubator/che-code:ppc64le-${{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:insiders-${SHORT_SHA1} quay.io/che-incubator/che-code:ppc64le-${{env.tag_suffix}} --os linux --arch ppc64le
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}} \
--amend quay.io/che-incubator/che-code:ppc64le-${{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:${{ env.BRANCH_NAME }} quay.io/che-incubator/che-code:ppc64le-${{env.tag_suffix}} --os linux --arch ppc64le
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}} \
--amend quay.io/che-incubator/che-code:ppc64le-${{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

docker manifest annotate quay.io/che-incubator/che-code:latest quay.io/che-incubator/che-code:ppc64le-${{env.tag_suffix}} --os linux --arch ppc64le
docker manifest push quay.io/che-incubator/che-code:latest
fi
release-finish:
name: release-finish
needs: [build, assemble, publish]
Expand Down
35 changes: 26 additions & 9 deletions .github/workflows/pull-request-check-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
- name: List downloaded files
run: |
ls -lahR

- name: Load che-code-amd64 image
run: |
docker load -i che-code-amd64.tgz
Expand All @@ -77,7 +78,7 @@ jobs:
docker tag che-code-amd64 ${IMAGE}
docker push ${IMAGE}
echo "_CHE_CODE_AMD64_IMAGE=${IMAGE}" >> $GITHUB_ENV

- name: Remove che-code-amd64 and prune
run: |
docker image rm che-code-amd64 || true
Expand All @@ -93,12 +94,28 @@ jobs:
docker tag che-code-arm64 ${IMAGE}
docker push ${IMAGE}
echo "_CHE_CODE_ARM64_IMAGE=${IMAGE}" >> $GITHUB_ENV

- name: Remove che-code-arm64 and prune
run: |
docker image rm che-code-arm64 || true
docker system prune -af

- name: Load che-code-ppc64le image
run: |
docker load -i che-code-ppc64le.tgz

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

- name: Remove che-code-ppc64le and prune
run: |
docker image rm che-code-ppc64le || true
docker system prune -af

- name: Load che-dev image
run: |
docker load -i che-dev.tgz
Expand All @@ -109,20 +126,20 @@ jobs:
docker tag che-dev ${IMAGE}
docker push ${IMAGE}
echo "_CHE_DEV_IMAGE=${IMAGE}" >> $GITHUB_ENV

- name: Remove che-dev and prune
run: |
docker image rm che-dev || true
docker system prune -af

- name: 'Comment PR'
uses: actions/github-script@v8
with:
script: |
const { repo: { owner, repo } } = context;
await github.rest.issues.createComment({
script: |
const { repo: { owner, repo } } = context;
await github.rest.issues.createComment({
issue_number: process.env._PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
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})`
})
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})\nEditor ppc64le: [${process.env._CHE_CODE_PPC64LE_IMAGE}](https://${process.env._CHE_CODE_PPC64LE_IMAGE})\nDev image: [${process.env._CHE_DEV_IMAGE}](https://${process.env._CHE_DEV_IMAGE})`
})
55 changes: 37 additions & 18 deletions .github/workflows/pull-request-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,45 @@ jobs:
echo "[ERROR] Run './build/artifacts/generate.sh' and include file into the commit."
exit 1
fi

build:
name: build
strategy:
fail-fast: false
matrix:
dist: ['libc-ubi8', 'libc-ubi9', 'musl']
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
runs-on: ${{matrix.runners}}
arch:
- name: amd64-build
runner: ubuntu-22.04
arch: amd64
- name: arm64-build
runner: ubuntu-22.04-arm
arch: arm64
- name: ppc64le-build
runner: ubuntu-22.04
arch: ppc64le
dist:
- libc-ubi8
- libc-ubi9
- musl
runs-on: ${{ matrix.arch.runner }}
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
run: echo "arch=${{ matrix.arch.arch }}" >> $GITHUB_ENV
- name: Checkout che-code source code
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
platforms: linux/amd64,linux/arm64,linux/ppc64le
- name: Cleanup docker images
run: docker system prune -af
- name: Compile che-code
run: |
docker buildx build \
--platform linux/${{env.arch}} \
--load \
--progress=plain \
-f build/dockerfiles/linux-${{matrix.dist}}.Dockerfile \
-t linux-${{matrix.dist}}-${{env.arch}} .
Expand All @@ -79,16 +93,20 @@ jobs:
strategy:
fail-fast: false
matrix:
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
runs-on: ${{matrix.runners}}
include:
- name: amd64-build
runner: ubuntu-22.04
arch: amd64
- name: arm64-build
runner: ubuntu-22.04-arm
arch: arm64
- name: ppc64le-build
runner: ubuntu-22.04
arch: ppc64le
runs-on: ${{ matrix.runner }}
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
run: echo "arch=${{ matrix.arch }}" >> $GITHUB_ENV
- name: Checkout che-code source code
uses: actions/checkout@v6
- name: Cleanup docker images
Expand Down Expand Up @@ -159,6 +177,7 @@ jobs:
run: |
docker buildx build \
--platform linux/amd64 \
--load \
--progress=plain \
-f build/dockerfiles/dev.Dockerfile \
-t che-dev .
Expand Down
47 changes: 46 additions & 1 deletion build/dockerfiles/linux-libc-ubi8.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,38 @@ ENV ELECTRON_SKIP_BINARY_DOWNLOAD=1 \
# Initialize a git repository for code build tools
RUN git init .

# prepareBuiltInCopilotRipgrepShim has no unsupported-arch guard unlike other
# copilot functions. Patch it to skip gracefully on ppc64le/s390x.
# hadolint ignore=SC3014
RUN if [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ]; then \
sed -i 's/export function prepareBuiltInCopilotRipgrepShim(platform: string, arch: string, builtInCopilotExtensionDir: string, appNodeModulesDir: string): void {/export function prepareBuiltInCopilotRipgrepShim(platform: string, arch: string, builtInCopilotExtensionDir: string, appNodeModulesDir: string): void {\n\tif (!copilotPlatforms.includes(toCopilotPackagePlatformArch(platform, arch))) { return; }/' \
build/lib/copilot.ts; \
fi

# change network timeout (slow using multi-arch build)
RUN npm config set fetch-retry-mintimeout 100000 && npm config set fetch-retry-maxtimeout 600000

# @vscode/vsce-sign and @github/copilot have no binary for ppc64le/s390x.
# Disable their postinstall scripts before npm install.
# hadolint ignore=SC3014
RUN if [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ]; then \
sed -i '/@vscode\/vsce-sign/,/\}/s/"hasInstallScript": true/"hasInstallScript": false/' \
build/package-lock.json \
extensions/copilot/package-lock.json; \
sed -i 's/"postinstall": "tsx \.\/script\/postinstall\.ts"/"postinstall": "echo skipped"/' \
extensions/copilot/package.json; \
fi

# On ppc64le/s390x, build_from_source in remote/.npmrc causes node-gyp to
# download headers from nodejs.org which times out. Disable it and also
# disable @parcel/watcher install script since no prebuilt exists for ppc64le.
# hadolint ignore=SC3014
RUN if [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ]; then \
sed -i '/^build_from_source/d' remote/.npmrc; \
sed -i '0,/"hasInstallScript": true/s/"hasInstallScript": true/"hasInstallScript": false/' \
remote/package-lock.json; \
fi

# node-gyp's make generator execs gyp entrypoints via shebang; UBI npm may
# ship them without +x and with a stale Python shebang (e.g. python3.8)
RUN chmod +x \
Expand All @@ -81,14 +110,29 @@ RUN chmod +x \
# Grab dependencies (and force to rebuild them)
RUN rm -rf /checode-compilation/node_modules && npm install --force

# tsgo has no native binary for ppc64le/s390x - replace with a no-op.
# Must run AFTER npm install so node_modules/.bin/tsgo exists.
# hadolint ignore=SC3014
RUN if [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ]; then \
find . -path "*/node_modules/.bin/tsgo" | while read f; do \
echo '#!/bin/sh' > "$f"; \
echo 'exit 0' >> "$f"; \
chmod +x "$f"; \
done; \
fi

# Compile
RUN NODE_ARCH=$(echo "console.log(process.arch)" | node) \
&& NODE_VERSION=$(cat /checode-compilation/remote/.npmrc | grep target | cut -d '=' -f 2 | tr -d '"') \
# cache node from this image to avoid to grab it from within the build
&& mkdir -p /checode-compilation/.build/node/v${NODE_VERSION}/linux-${NODE_ARCH} \
&& echo "caching /checode-compilation/.build/node/v${NODE_VERSION}/linux-${NODE_ARCH}/node" \
&& cp /usr/bin/node /checode-compilation/.build/node/v${NODE_VERSION}/linux-${NODE_ARCH}/node \
&& NODE_OPTIONS="--max-old-space-size=8192" ./node_modules/.bin/gulp copy-codicons compile-non-native-extensions-build compile-copilot-extension-build compile-extension-media-build \
&& if [ "$(uname -m)" = "x86_64" ] || [ "$(uname -m)" = "aarch64" ]; then \
NODE_OPTIONS="--max-old-space-size=8192" ./node_modules/.bin/gulp copy-codicons compile-non-native-extensions-build compile-copilot-extension-build compile-extension-media-build; \
else \
NODE_OPTIONS="--max-old-space-size=8192" ./node_modules/.bin/gulp copy-codicons compile-non-native-extensions-build compile-extension-media-build; \
fi \
&& npx tsgo --project src/tsconfig.json --noEmit --skipLibCheck \
&& NODE_OPTIONS="--max-old-space-size=8192" node build/next/index.ts bundle --minify --nls --mangle-privates --target server-web --out out-vscode-reh-web-min \
&& NODE_OPTIONS="--max-old-space-size=8192" ./node_modules/.bin/gulp vscode-reh-web-linux-${NODE_ARCH}-min-ci \
Expand Down Expand Up @@ -185,3 +229,4 @@ RUN npm install \
# Store the content of the result
FROM scratch as linux-libc-content
COPY --from=linux-libc-ubi8-builder /checode /checode-linux-libc/ubi8

Loading