Skip to content

Commit

Permalink
Merge pull request #12 from zowe/build/theia-docker-1.49
Browse files Browse the repository at this point in the history
Fix ZE Theia workflow
  • Loading branch information
t1m0thyj authored Jun 21, 2024
2 parents 75c9e5c + 35fb899 commit 1cb76e8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ze-theia-slim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
- .github/workflows/docker-reusable.yaml
workflow_dispatch:
inputs:
theia-version:
description: "Specify Theia version (e.g., 1.37)"
default: "latest"
docker-tags:
description: "Docker tags to build (space-separated - e.g., '1.37 latest')"
default: "next"
required: false
type: string
deploy:
Expand All @@ -33,7 +33,7 @@ jobs:

- name: Get Theia version
id: load-env
run: node ze/theia-slim/getTheiaVersion.js ${{ inputs.theia-version || 'next' }}
run: node ze/theia-slim/getTheiaVersion.js ${{ inputs.docker-tags }}

build-and-deploy:
needs: setup
Expand Down
4 changes: 2 additions & 2 deletions ze/theia-slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright Contributors to the Zowe Project.

ARG NODE_VERSION=lts
FROM node:${NODE_VERSION}-alpine
FROM node:${NODE_VERSION}-alpine3.19
RUN apk add --no-cache curl make pkgconfig gcc g++ python3 libx11-dev libxkbfile-dev libsecret-dev chromium
WORKDIR /home/theia
ADD buildPackageJson.js ./buildPackageJson.js
Expand All @@ -32,7 +32,7 @@ RUN yarn global add node-gyp && \
# curl -fLOJ https://github.com/zowe/vscode-extension-for-zowe/releases/download/v${ZOWE_EXPLORER_VERSION}/vscode-extension-for-zowe-${ZOWE_EXPLORER_VERSION}.vsix && \
# curl -fLOJ https://github.com/zowe/vscode-extension-for-zowe/releases/download/v${ZOWE_EXPLORER_VERSION}/zowe-explorer-ftp-extension-${ZOWE_EXPLORER_VERSION}.vsix

FROM node:${NODE_VERSION}-alpine
FROM node:${NODE_VERSION}-alpine3.19
# See : https://github.com/theia-ide/theia-apps/issues/34
RUN addgroup theia && \
adduser -G theia -s /bin/sh -D theia;
Expand Down
26 changes: 14 additions & 12 deletions ze/theia-slim/getTheiaVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,24 @@ async function getTheiaReleases() {
(async () => {
const dockerTags = [];
let theiaVersion;
if (process.argv[2] == null || process.argv[2] === "latest") {
// "latest" tag (default) = latest community release of Theia
const release = (await getTheiaReleases()).find(obj => obj.body.includes("community release"));
theiaVersion = release.tag_name.slice(1);
dockerTags.push(...expandImageTag("latest"),
...expandImageTag(theiaVersion.slice(0, theiaVersion.lastIndexOf("."))));
} else if (process.argv[2] === "next") {
if (process.argv[2] == null || process.argv[2] === "next") {
// "next" tag = latest version of Theia on master branch
theiaVersion = "latest";
dockerTags.push(...expandImageTag("next"));
} else {
// "1.XX" tag = older community release of Theia
const release = (await getTheiaReleases()).find(obj => obj.body.includes("community release") &&
obj.tag_name.startsWith(`v${process.argv[2]}`));
theiaVersion = release.tag_name.slice(1);
dockerTags.push(...expandImageTag(theiaVersion.slice(0, theiaVersion.lastIndexOf("."))));
// "1.XX" and "latest" tag = community releases of Theia
for (const tagName of process.argv.slice(2)) {
if (tagName === "latest") {
dockerTags.push(...expandImageTag("latest"));
} else {
const release = (await getTheiaReleases()).find(obj => obj.tag_name.startsWith("v" + tagName));
theiaVersion = release?.tag_name.slice(1);
dockerTags.push(...expandImageTag(tagName));
}
};
}
if (theiaVersion == null) {
throw new Error("Could not find Theia version that matches these tags: " + process.argv.slice(2).join(" "));
}
fs.appendFileSync(outputPath, "DOCKER_TAGS<<EOF\n" + dockerTags.join("\n") + "\nEOF\n");
fs.appendFileSync(outputPath, `THEIA_VERSION=${theiaVersion}\n`);
Expand Down

0 comments on commit 1cb76e8

Please sign in to comment.