Skip to content

Commit

Permalink
feat: add devworkspace-generator to the release orchestration (#78)
Browse files Browse the repository at this point in the history
Signed-off-by: Mykhailo Kuznietsov <[email protected]>
  • Loading branch information
mkuznyetsov committed Aug 30, 2023
1 parent 8db1a70 commit 8522233
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 11 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 15 additions & 7 deletions make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
}
Expand Down Expand Up @@ -166,8 +171,8 @@ set +x
if [[ ${PHASES} == *"1"* ]]; then
releaseCheCode
releaseMachineExec
releaseDashboard
releaseCheServer
releaseDevworkspaceGenerator
createBranches
fi
wait
Expand All @@ -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
Expand Down
48 changes: 48 additions & 0 deletions utils/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<scope>/name@version"
# e.g. "@eclipse-che/[email protected]"
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
}

0 comments on commit 8522233

Please sign in to comment.