Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ZE Theia workflow #12

Merged
merged 5 commits into from
Jun 21, 2024
Merged
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
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