From 85222330960c75de7c2d3210f368e38665e5f1bf Mon Sep 17 00:00:00 2001 From: Mykhailo Kuznietsov Date: Wed, 30 Aug 2023 13:26:34 +0300 Subject: [PATCH] feat: add devworkspace-generator to the release orchestration (#78) Signed-off-by: Mykhailo Kuznietsov --- README.md | 9 +++++---- make-release.sh | 22 +++++++++++++++------- utils/util.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c782f3b..5f65c3d 100644 --- a/README.md +++ b/README.md @@ -57,18 +57,19 @@ Currently there are several phases, representing an order of projects, which we * Phase 1: * [che-code](https://github.com/che-incubator/che-code), * [che-machine-exec](https://github.com/eclipse-che/che-machine-exec), - * [che-dashboard](https://github.com/eclipse-che/che-dashboard), * [che-server](https://github.com/eclipse-che/che-server); + * [devworkspace-generator](https://github.com/eclipse-che/che-devfile-registry/tree/main/tools/devworkspace-generator) * then creation of branches for: * [configbump](https://github.com/che-incubator/configbump), * [kubernetes-image-puller](https://github.com/che-incubator/kubernetes-image-puller) * Phase 2: - * [che-e2e](https://github.com/eclipse/che), - * [che-plugin-registry](https://github.com/eclipse-che/che-plugin-registry) + * [che-e2e](https://github.com/eclipse/che) - depends on devworkspace-generator, che-server (typescript dto) + * [che-plugin-registry](https://github.com/eclipse-che/che-plugin-registry) - depends on che-machine-exec + * [che-dashboard](https://github.com/eclipse-che/che-dashboard) - depends on devworkspace-generator * Phase 3: - * [che-devfile-registry](https://github.com/eclipse-che/che-devfile-registry) + * [che-devfile-registry](https://github.com/eclipse-che/che-devfile-registry) - depends on plugin-registry, devworkspace-generator * Phase 4: * [che-operator](https://github.com/eclipse-che/che-operator) - depends on phases 1 to 3 and performs several e2e validation tests diff --git a/make-release.sh b/make-release.sh index 57c5912..c73e9c1 100755 --- a/make-release.sh +++ b/make-release.sh @@ -14,8 +14,8 @@ usage () echo "Usage: $0 --version [CHE VERSION TO RELEASE] --parent-version [CHE PARENT VERSION] --phases [LIST OF PHASES] # Comma-separated phases to perform. -#1: Code, MachineExec, Dashboard, Server, createBranches; -#2: E2E, PluginRegistry; +#1: Code, MachineExec, Server, devworkspace-generator, createBranches; +#2: E2E, PluginRegistry, Dashboard; #3: DevfileRegistry; #4: Operator; # Default: 1,2,3,4 @@ -89,6 +89,11 @@ releaseCheCode() { invokeAction che-incubator/che-code "Release Che Code" "34764281" "version=${CHE_VERSION}" } + +releaseDevworkspaceGenerator() { + invokeAction eclipse-che/che-devfile-registry "Release Che Devworkspace Generator" "67742638" "version=${CHE_VERSION}" +} + releaseDevfileRegistry() { invokeAction eclipse-che/che-devfile-registry "Release Che Devfile Registry" "4191260" "version=${CHE_VERSION}" } @@ -166,8 +171,8 @@ set +x if [[ ${PHASES} == *"1"* ]]; then releaseCheCode releaseMachineExec - releaseDashboard releaseCheServer + releaseDevworkspaceGenerator createBranches fi wait @@ -176,26 +181,29 @@ verifyContainerExistsWithTimeout ${REGISTRY}/che-incubator/che-code:${CHE_VERSIO # shellcheck disable=SC2086 verifyContainerExistsWithTimeout ${REGISTRY}/${ORGANIZATION}/che-machine-exec:${CHE_VERSION} 60 # shellcheck disable=SC2086 -verifyContainerExistsWithTimeout ${REGISTRY}/${ORGANIZATION}/che-dashboard:${CHE_VERSION} 60 -# shellcheck disable=SC2086 verifyContainerExistsWithTimeout ${REGISTRY}/${ORGANIZATION}/che-server:${CHE_VERSION} 60 # shellcheck disable=SC2086 verifyBranchExistsWithTimeoutAndExit "https://github.com/che-incubator/configbump.git" ${BRANCH} 60 # shellcheck disable=SC2086 verifyBranchExistsWithTimeoutAndExit "https://github.com/che-incubator/kubernetes-image-puller.git" ${BRANCH} 60 - +# shellcheck disable=SC2086 +verifyNpmJsPackageExistsWithTimeoutAndExit "@eclipse-che/che-devworkspace-generator@${CHE_VERSION}" 60 set +x -# Release e2e (depends on dashboard) +# Release e2e (depends on che-server, devworkspace-generator) # Release plugin registry (depends on machine-exec) if [[ ${PHASES} == *"2"* ]]; then releaseCheE2E releasePluginRegistry + releaseDashboard fi wait # shellcheck disable=SC2086 verifyContainerExistsWithTimeout ${REGISTRY}/${ORGANIZATION}/che-e2e:${CHE_VERSION} 30 +# shellcheck disable=SC2086 verifyContainerExistsWithTimeout ${REGISTRY}/${ORGANIZATION}/che-plugin-registry:${CHE_VERSION} 30 +# shellcheck disable=SC2086 +verifyContainerExistsWithTimeout ${REGISTRY}/${ORGANIZATION}/che-dashboard:${CHE_VERSION} 60 # Release devfile registry (depends on plugin registry) if [[ ${PHASES} == *"3"* ]]; then releaseDevfileRegistry diff --git a/utils/util.sh b/utils/util.sh index 717c396..74b7aa5 100755 --- a/utils/util.sh +++ b/utils/util.sh @@ -145,3 +145,51 @@ verifyContainerExistsWithTimeout() exit 1; fi } + + +# for a given url of project hosten on NPMJS, check if it exists +# package name must be in format "/name@version" +# e.g. "@eclipse-che/che-devworkspace-generator@7.70.0" +verifyNpmJsPackageExists() +{ + this_package=${1} + this_name="${this_package%@*}" + this_version="${this_package##*@}" + registry_json="$(curl -s https://registry.npmjs.org/${this_name}/)" + if echo "$registry_json" | jq -e '."versions"."'${this_version}'"'; then + echo "[INFO] Found ${this_package}" + packageExists=1 + else + # echo "[INFO] Did not find ${this_package}" + packageExists=0 + fi +} + +verifyNpmJsPackagexistsWithTimeout() +{ + this_package=$1 + this_timeout=$2 + packageExists=0 + count=1 + (( timeout_intervals=this_timeout*3 )) + while [[ $count -le $timeout_intervals ]]; do # echo $count + echo " [$count/$timeout_intervals] Verify ${1} exists..." + # check if the package exists + verifyNpmJsPackageExists "$1" + if [[ ${containerExists} -eq 1 ]]; then break; fi + (( count=count+1 )) + sleep 20s + done + # or report an error + if [[ ${packageExists} -eq 0 ]]; then + echo "[ERROR] Did not find ${1} after ${this_timeout} minutes - script must exit!" + exit 1; + fi +} + +verifyNpmJsPackageExistsWithTimeoutAndExit() { + verifyNpmJsPackagexistsWithTimeout "$@" + if [[ $? -gt 0 ]]; then + exit 1 + fi +} \ No newline at end of file