diff --git a/RELEASE.md b/RELEASE.md index 644f81ebc..481e7ac67 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -5,7 +5,3 @@ Launch the [release script](make-release.sh) and wait until [CI Job](https://ci. ``` ./make-release.sh --repo git@github.com:eclipse/che-theia --version --trigger-release ``` - -**NOTE:** before doing a minor release (x.y.0), update [`THEIA_VERSION`](THEIA_VERSION) file with a required version of Eclipse Theia. - -Go to [npm registry](https://www.npmjs.com/package/@theia/core) and pick the latest `next` Theia version, e.g. `0.15.0-next.15995cd0` diff --git a/THEIA_VERSION b/THEIA_VERSION deleted file mode 100644 index 1ed7a3b2a..000000000 --- a/THEIA_VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1.0-next.9bc52ad1 diff --git a/build.include b/build.include index bfeef857b..bd39547ae 100644 --- a/build.include +++ b/build.include @@ -13,6 +13,7 @@ set -u IMAGE_TAG="next" THEIA_VERSION="master" THEIA_BRANCH="master" +THEIA_COMMIT_SHA= THEIA_GIT_REFS="refs\\/heads\\/master" THEIA_DOCKER_IMAGE_VERSION= @@ -78,8 +79,8 @@ buildImages() { GITHUB_TOKEN_ARG="GITHUB_TOKEN=${GITHUB_TOKEN:-}" echo "Building image in ${image_dir}" if [ "$image_dir" == "dockerfiles/theia" ]; then - bash $(pwd)/$image_dir/build.sh --build-args:${GITHUB_TOKEN_ARG},THEIA_VERSION=${THEIA_VERSION} --tag:${IMAGE_TAG} --branch:${THEIA_BRANCH} --git-ref:${THEIA_GIT_REFS} ${FILTERED_ARGS} - elif [ "$image_dir" == "dockerfiles/theia-dev" ]; then + bash $(pwd)/$image_dir/build.sh --build-args:${GITHUB_TOKEN_ARG},THEIA_VERSION=${THEIA_VERSION},THEIA_COMMIT_SHA=${THEIA_COMMIT_SHA} --tag:${IMAGE_TAG} --branch:${THEIA_BRANCH} --git-ref:${THEIA_GIT_REFS} ${FILTERED_ARGS} + elif [ "$image_dir" == "dockerfiles/theia-dev" ]; then bash $(pwd)/$image_dir/build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:${IMAGE_TAG} ${FILTERED_ARGS} else bash $(pwd)/$image_dir/build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:${IMAGE_TAG} ${FILTERED_ARGS} diff --git a/dockerfiles/theia/Dockerfile b/dockerfiles/theia/Dockerfile index 9102fdfe8..bf7465508 100644 --- a/dockerfiles/theia/Dockerfile +++ b/dockerfiles/theia/Dockerfile @@ -23,6 +23,8 @@ ARG THEIA_GITHUB_REPO=eclipse-theia/theia # Define upstream version of theia to use ARG THEIA_VERSION=master +ARG THEIA_COMMIT_SHA='' + ENV NODE_OPTIONS="--max-old-space-size=4096" #{IF:DO_REMOTE_CHECK} diff --git a/dockerfiles/theia/docker/alpine/builder-clone-theia.dockerfile b/dockerfiles/theia/docker/alpine/builder-clone-theia.dockerfile index 3e6f94859..833716da8 100644 --- a/dockerfiles/theia/docker/alpine/builder-clone-theia.dockerfile +++ b/dockerfiles/theia/docker/alpine/builder-clone-theia.dockerfile @@ -1,2 +1,3 @@ # Clone theia and keep source code in home -RUN git clone --branch ${GIT_BRANCH_NAME} --single-branch --depth 1 https://github.com/${THEIA_GITHUB_REPO} ${HOME}/theia-source-code +RUN git clone --branch ${GIT_BRANCH_NAME} --single-branch https://github.com/${THEIA_GITHUB_REPO} ${HOME}/theia-source-code && \ + cd ${HOME}/theia-source-code && git checkout ${THEIA_COMMIT_SHA} diff --git a/dockerfiles/theia/docker/ubi8/builder-clone-theia.dockerfile b/dockerfiles/theia/docker/ubi8/builder-clone-theia.dockerfile index 3e6f94859..833716da8 100644 --- a/dockerfiles/theia/docker/ubi8/builder-clone-theia.dockerfile +++ b/dockerfiles/theia/docker/ubi8/builder-clone-theia.dockerfile @@ -1,2 +1,3 @@ # Clone theia and keep source code in home -RUN git clone --branch ${GIT_BRANCH_NAME} --single-branch --depth 1 https://github.com/${THEIA_GITHUB_REPO} ${HOME}/theia-source-code +RUN git clone --branch ${GIT_BRANCH_NAME} --single-branch https://github.com/${THEIA_GITHUB_REPO} ${HOME}/theia-source-code && \ + cd ${HOME}/theia-source-code && git checkout ${THEIA_COMMIT_SHA} diff --git a/make-release.sh b/make-release.sh index 1ebec2e9d..d1ddaef2d 100755 --- a/make-release.sh +++ b/make-release.sh @@ -66,38 +66,24 @@ if [[ "${BASEBRANCH}" != "${BRANCH}" ]]; then fi apply_files_edits () { - read THEIA_VERSION < THEIA_VERSION + THEIA_VERSION=$(curl --silent http://registry.npmjs.org/-/package/@theia/core/dist-tags | sed 's/.*"next":"\(.*\)".*/\1/') if [[ ! ${THEIA_VERSION} ]]; then - echo "THEIA_VERSION file is not found"; echo + echo "Failed to get Theia next version from npmjs.org"; echo exit 1 fi - # Che Theia release may depend on Theia next or latest - if [[ ${THEIA_VERSION} == *"-next."* ]]; then - THEIA_PATCHES_DIR=master - THEIA_BRANCH=master - THEIA_GIT_REFS=refs\\\\\\\\/heads\\\\\\\\/master - else - THEIA_PATCHES_DIR=${THEIA_VERSION} - THEIA_BRANCH=v${THEIA_VERSION} - THEIA_GIT_REFS=refs\\\\\\\\/tags\\\\\\\\/v${THEIA_VERSION} - fi - # update config for Che Theia generator sed -i che-theia-init-sources.yml -e "/checkoutTo:/s/master/${BRANCH}/" - # set the variables for an image build + # set the variables for building the images sed -i build.include \ -e 's/IMAGE_TAG="..*"/IMAGE_TAG="latest"/' \ - -e 's/THEIA_VERSION="..*"/THEIA_VERSION="'${THEIA_PATCHES_DIR}'"/' \ - -e 's/THEIA_BRANCH="..*"/THEIA_BRANCH="'${THEIA_BRANCH}'"/' \ - -e 's#THEIA_GIT_REFS="..*"#THEIA_GIT_REFS="'${THEIA_GIT_REFS}'"#' \ + -e 's/^THEIA_COMMIT_SHA=$/THEIA_COMMIT_SHA="'${THEIA_VERSION##*.}'"/' \ -e 's/THEIA_DOCKER_IMAGE_VERSION=.*/THEIA_DOCKER_IMAGE_VERSION="'${VERSION}'"/' # Update extensions/plugins package.json files: # - set packages' version - # - update versions of Theia dependencies - # - update versions of Che dependencies + # - update versions of Theia and Che dependencies for m in "extensions/*" "plugins/*"; do sed -i ./${m}/package.json \ -r -e 's/("version": )(".*")/\1"'$VERSION'"/' \ @@ -105,28 +91,9 @@ apply_files_edits () { -r -e '/@eclipse-che\/api|@eclipse-che\/workspace-client|@eclipse-che\/workspace-telemetry-client/!s/("@eclipse-che\/..*": )(".*")/\1"'$VERSION'"/' done - if [[ ${THEIA_BRANCH} == master ]]; then - THEIA_COMMIT_SHA=${THEIA_VERSION##*.} - - if [[ ${VERSION} == *".0" ]]; then - # if depending on Theia next (from master), need to checkout to the corresponding commit - for m in "dockerfiles/theia/docker/alpine/builder-clone-theia.dockerfile" "dockerfiles/theia/docker/ubi8/builder-clone-theia.dockerfile"; do - sed -i ./${m} \ - -e 's/ --depth 1//' \ - -e '/RUN git clone/s#$# \&\& cd ${HOME}/theia-source-code \&\& git checkout '${THEIA_COMMIT_SHA}'#' - done - - sed -i dockerfiles/theia/docker/ubi8/builder-clone-theia.dockerfile \ - -e '/RUN git clone/s#$# \&\& cd ${HOME} \&\& tar zcf ${HOME}/theia-source-code.tgz theia-source-code#' - else - # Doing a .z release. So, both (alpine/ubi8) builder-clone-theia.dockerfile are already patched. - # Just need to ensure that using a correct $THEIA_COMMIT_SHA - # as .z release may be based on a different Theia version comparing to a .0 release. - sed -i dockerfiles/theia/docker/alpine/builder-clone-theia.dockerfile \ - -r -e 's/( git checkout )(.*)/\1'${THEIA_COMMIT_SHA}'/' - sed -i dockerfiles/theia/docker/ubi8/builder-clone-theia.dockerfile \ - -r -e 's/( git checkout )(.*)( \&\& cd )/\1'${THEIA_COMMIT_SHA}'\3/' - fi + if [[ ${VERSION} == *".0" ]]; then + sed -i dockerfiles/theia/docker/ubi8/builder-clone-theia.dockerfile \ + -e '$ a RUN cd ${HOME} \&\& tar zcf ${HOME}/theia-source-code.tgz theia-source-code' fi }