diff --git a/.github/workflows/release-orchestrate-overall.yml b/.github/workflows/release-orchestrate-overall.yml index 4345315..a389a1a 100644 --- a/.github/workflows/release-orchestrate-overall.yml +++ b/.github/workflows/release-orchestrate-overall.yml @@ -1,5 +1,5 @@ # This Workflow performs a full release of Che -name: Release - Phases 1-3 +name: Release - Orchestration on: workflow_dispatch: inputs: @@ -9,12 +9,18 @@ on: default: '' phases: description: ' -# Comma-separated phases to perform (see README.md). -# Default: 1,2,3,4 +# Comma-separated phases to perform, e.g. 1,2,3,4 +# see README.md / che-release.yaml for declared phases. +# Default: auto (all phases with orchestration:true) # Omit phases that have successfully run. ' - required: true - default: '1,2,3,4' + required: false + default: '' + dry_run: + description: 'Run in dry-run mode (no workflows will be triggered)' + required: false + type: boolean + default: false jobs: pre_job: runs-on: ubuntu-22.04 @@ -73,10 +79,21 @@ jobs: CHE_VERSION="${{ github.event.inputs.version }}" echo "CHE_VERSION=${CHE_VERSION}" PHASES="${{ github.event.inputs.phases }}" + DRY_RUN="${{ github.event.inputs.dry_run }}" git config --global user.name "Mykhailo Kuznietsov" git config --global user.email "mkuznets@redhat.com" export CHE_BOT_GITHUB_TOKEN=${{ secrets.CHE_BOT_GITHUB_TOKEN }} export CHE_INCUBATOR_BOT_GITHUB_TOKEN=${{ secrets.CHE_INCUBATOR_BOT_GITHUB_TOKEN }} set -e - ./scripts/make-release.sh -v ${CHE_VERSION} -p ${PHASES} --parent-version ${PARENT_VERSION} + + # Build command with optional parameters + CMD="./scripts/make-release.sh -v ${CHE_VERSION}" + if [ -n "${PHASES}" ]; then + CMD="${CMD} -p ${PHASES}" + fi + if [ "${DRY_RUN}" = "true" ]; then + CMD="${CMD} --dry-run" + fi + + eval ${CMD} diff --git a/README.md b/README.md index e035287..cd1c89c 100644 --- a/README.md +++ b/README.md @@ -2,96 +2,30 @@ ## Permissions -1. Get push permission from @mkuznets @SDawley to push applications - * https://quay.io/organization/eclipse-che-operator-openshift/teams/pushers - * https://quay.io/application/eclipse-che-operator-openshift +Contact [repository maintaners](https://github.com/eclipse-che/che-release/blob/main/.github/CODEOWNERS#L2) for any additional permissions for running release scripts manually. +Some scripts may require a GitHub personal access token with read/write access to Eclipse Che repositories. -2. Get commit rights from @mkuznets @SDawley to push community PRs - * https://github.com/che-incubator/community-operators +## Projects Overview +This repository contains a number of key scripts, docs, configurations that pertain to the release of Eclipse Che. +- [che-release.yaml](https://github.com/eclipse-che/che-release/blob/main/che-release.yaml) - this file acts as a source of truth for all release scripts in this repository. It contains information about all projects involved in the release process, their respective workflows, release artifacts, associated pull requests, and other useful information. -## Automated release workflows +In this document, projects are arranged into **phases**. The main purpose of the phase, is to ensure the correct order of release workflows. For example, if Che operands should be released before Che Operator, the operands must belong to the phase, that is lower that the phase for the operator. It should not be possible to begin release of projects of any later phase, if projects in previous phases have not been released. -Currently all projects have automated release process, that consists of GitHub Actions workflow. -Additionally, release logic is mostly contained within `make-release.sh` file, which allows to perform the release outside of GitHub Actions framework, should the need for it arises. -For example, in the [Che server](https://github.com/eclipse-che/che-server) repo, GitHub action [release.yml](https://github.com/eclipse-che/che-server/actions/workflows/release.yml) runs the [make-release.sh](https://github.com/eclipse-che/che-server/blob/main/make-release.sh) release script. +When the release order is updated, you must ensure that every project is correctly placed in respective phase (add or remove phases if needed). -GitHub Actions release workflows can be run by any user with write access to the repo in which the workflow is located. They use repository secrets, such as Quay or Docker.io credentials, that are required by most of the release workflows. If run outside GitHub, authorized users will need to provide their own secrets. +- [make-release.sh](https://github.com/eclipse-che/che-release/blob/main/scripts/make-release.sh) - a release orchestrator script for starting a release - used in [Release - Orchestration](https://github.com/eclipse-che/che-release/actions/workflows/release-orchestrate-overall.yml) workflow. -## Projects overview -The Che projects that are part of the release cycle are orchestrated into a single action: [Orchestrate Overall Release](https://github.com/eclipse-che/che-release/actions/workflows/release-orchestrate-overall.yml), which runs [make-release.sh](https://github.com/eclipse-che/che-release/blob/main/make-release.sh). +It is intended to only work with phases that are specifically marked for orchestration with a respective `orchestration: true` field. Note that you can run this script with a custom phase order, e.g. if you are re-running the release, and all projects in phase 1 have already been released, although the script will still perform verification of existence of release artifacts for any preceding phases. +- [release-info.sh](https://github.com/eclipse-che/che-release/blob/main/scripts/release-info.sh) - a script, that is useful for monitoring the state of ongoing release. It will collect and print out the information about any associated release artifacts, pull requests and other useful information. -The projects covered by this workflow release container images, NPM artifacts, or CLI binaries versioned 7.yy.0 every sprint: +The Che projects that are part of the release cycle are orchestrated into a single action: [Orchestrate Overall Release](https://github.com/eclipse-che/che-release/actions/workflows/release-orchestrate-overall.yml), which runs [make-release.sh](https://github.com/eclipse-che/che-release/blob/main/make-release.sh). -### Statuses -| Phase | Project | Workflow Status | Quay Image / Artifact | -| :--- | :--- | :--- | :--- | -| **Phase 1** | [che-code](https://github.com/che-incubator/che-code) | [![Release](https://github.com/che-incubator/che-code/actions/workflows/release.yml/badge.svg)](https://github.com/che-incubator/che-code/actions/workflows/release.yml) | [che-code](https://quay.io/che-incubator/che-code) | -| | [jetbrains-ide-dev-server](https://github.com/che-incubator/jetbrains-ide-dev-server) | [![Release](https://github.com/che-incubator/jetbrains-ide-dev-server/actions/workflows/release.yml/badge.svg)](https://github.com/che-incubator/jetbrains-ide-dev-server/actions/workflows/release.yml) | [jetbrains-ide-dev-server](https://quay.io/che-incubator/che-idea-dev-server) | -| | [configbump](https://github.com/che-incubator/configbump) | [![Release](https://github.com/che-incubator/configbump/actions/workflows/release.yml/badge.svg)](https://github.com/che-incubator/configbump/actions/workflows/release.yml) | [configbump](https://quay.io/che-incubator/configbump) | -| | [che-machine-exec](https://github.com/eclipse-che/che-machine-exec) | [![Release](https://github.com/eclipse-che/che-machine-exec/actions/workflows/release.yml/badge.svg)](https://github.com/eclipse-che/che-machine-exec/actions/workflows/release.yml) | [che-machine-exec](https://quay.io/eclipse/che-machine-exec) | -| | [che server](https://github.com/eclipse-che/che-server) | [![Release](https://github.com/eclipse-che/che-server/actions/workflows/release.yml/badge.svg)](https://github.com/eclipse-che/che-server/actions/workflows/release.yml) | [che-server](https://quay.io/eclipse/che-server) | -| | [devworkspace-generator](https://github.com/devfile/devworkspace-generator ) | [![Release](https://github.com/devfile/devworkspace-generator/actions/workflows/devworkspace-generator-release.yml/badge.svg)](https://github.com/devfile/devworkspace-generator/actions/workflows/devworkspace-generator-release.yml) | NPM [@eclipse-che/che-devworkspace-generator](https://www.npmjs.com/package/@eclipse-che/che-devworkspace-generator) -| | [kubernetes-image-puller](https://github.com/che-incubator/kubernetes-image-puller) | [![Branch](https://github.com/che-incubator/kubernetes-image-puller/actions/workflows/make-branch.yaml/badge.svg)](https://github.com/che-incubator/kubernetes-image-puller/actions/workflows/make-branch.yaml) | [kubernetes-image-puller/branches](https://github.com/che-incubator/kubernetes-image-puller/branches/active) -| | | -| **Phase 2** | [che-e2e](https://github.com/eclipse-che/che) | [![Release](https://github.com/eclipse-che/che/actions/workflows/release.yml/badge.svg)](https://github.com/eclipse-che/che/actions/workflows/release.yml) | [che-e2e](https://quay.io/eclipse/che-e2e) | -| | [che-plugin-registry](https://github.com/eclipse-che/che-plugin-registry) | [![Release](https://github.com/eclipse-che/che-plugin-registry/actions/workflows/release.yml/badge.svg)](https://github.com/eclipse-che/che-plugin-registry/actions/workflows/release.yml) | [che-plugin-registry](https://quay.io/eclipse/che-plugin-registry) | -| | [che-dashboard](https://github.com/eclipse-che/che-dashboard) | [![release latest stable](https://github.com/eclipse-che/che-dashboard/actions/workflows/release.yml/badge.svg)](https://github.com/eclipse-che/che-dashboard/actions/workflows/release.yml) | [che-dashboard](https://quay.io/eclipse/che-dashboard) | -| | | -| **Phase 3** | [che-operator](https://github.com/eclipse-che/che-operator) | [![Release](https://github.com/eclipse-che/che-operator/actions/workflows/release.yml/badge.svg)](https://github.com/eclipse-che/che-operator/actions/workflows/release.yml) | [che-operator](https://quay.io/eclipse/che-operator) | -| | | -| **Phase 4** | [community-operator](https://github.com/redhat-openshift-ecosystem/community-operators-prod) | [![Release](https://github.com/eclipse-che/che-operator/actions/workflows/release-community-operator-PRs.yml/badge.svg)](https://github.com/eclipse-che/che-operator/actions/workflows/release-community-operator-PRs.yml) | [create pull requests](https://github.com/operator-framework/community-operators/pulls?q=%22Update+eclipse-che+operator%22+is%3Aopen) to update to latest released version of Che in OperatorHub -| | [chectl](https://github.com/che-incubator/chectl) | [![Release](https://github.com/eclipse-che/che-operator/actions/workflows/release-chectl.yml/badge.svg)](https://github.com/eclipse-che/che-operator/actions/workflows/release-chectl.yml) | [CLI tarballs](https://github.com/che-incubator/chectl/releases) -| | [che-docs](https://github.com/eclipse/che-docs) | [![Release](https://github.com/eclipse-che/che-docs/actions/workflows/publication-builder.yaml/badge.svg)](https://github.com/eclipse-che/che-docs/actions/workflows/publication-builder.yaml) | tag and 3 pull requests to update to [latest Che](https://github.com/eclipse-che/che-docs/tree/publication) -| | | -| **Phase 5** | [che-website-publish](https://github.com/eclipse-cheche-website-publish) | [![Publish](https://github.com/eclipse-che/che-website-publish/actions/workflows/publish.yaml/badge.svg)](https://github.com/eclipse-che/che-website-publish/actions/workflows/publish.yaml) | update live [Che Docs website](https://eclipse.dev/che/docs/stable/) with published documentation (when che-docs PRs are merged) -| | | -| **Phase 6** | [release-check-unmerged-PRs](https://github.com/eclipse-cheche-website-publish) | [![Publish](https://github.com/eclipse-che/che-website-publish/actions/workflows/publish.yaml/badge.svg)](https://github.com/eclipse-che/che-website-publish/actions/workflows/publish.yaml) | update live [Che Docs website](https://eclipse.dev/che/docs/stable/) with published documentation (when che-docs PRs are merged) - -### Notifications - -[Notifications](https://github.com/integrations/slack#features) can be seen in the ECD Slack, across the following channels. - -### [#forum-che-release](https://app.slack.com/client/TMU5A34SW/C0612PAJ4SX) - -``` -/github subscribe che-incubator/chectl releases workflows:{event:"workflow_dispatch","push" branch:"main"} -/github unsubscribe che-incubator/chectl issues pulls commits deployments branches - -/github subscribe eclipse-che/che-operator workflows:{event:"workflow_dispatch","push" branch:"main"} -/github unsubscribe eclipse-che/che-operator issues pulls commits releases deployments branches - -/github subscribe eclipse-che/che-release workflows:{event:"workflow_dispatch","push" branch:"main"} -/github unsubscribe eclipse-che/che-release issues pulls commits releases deployments branches - -/github subscribe eclipse-che/che issues releases +label:'status/need-triage' -/github unsubscribe eclipse-che/che pulls commits deployments branches - -/github subscribe list features -``` - -See [#forum-che-release](https://app.slack.com/client/TMU5A34SW/C0612PAJ4SX) - -### [#forum-che](https://app.slack.com/client/TMU5A34SW/C05SD64M85R) - -``` -/github subscribe eclipse-che/che issues releases +label:'status/need-triage' -/github unsubscribe eclipse-che/che pulls commits deployments branches - -/github subscribe list features -``` - -See [#forum-che](https://app.slack.com/client/TMU5A34SW/C05SD64M85R) - -## Release phases - -The [Release - Orchestrate Overall Release Phases]((https://github.com/eclipse-che/che-release/actions?query=workflow%3A%22Release+-+Orchestrate+Overall+Release+Phases%22)) action runs [make-release.sh](https://github.com/eclipse-che/che-release/blob/main/make-release.sh) to release the various Che containers and packages in the correct order. This ensures that dependencies between containers or packages can be met. See [make-release.sh](https://github.com/eclipse-che/che-release/blob/main/make-release.sh) for these dependencies. The list of phases is above. - -## Release procedure +## Release Procedure 1. [Create a new release issue and include it into the sprint planning](https://github.com/eclipse-che/che/issues/new?assignees=&labels=kind%2Frelease&template=release.md&title=Release+Eclipse+Che+7.NEWVERSION), -2. Once all pending PRs/blocker issues are resolved, use the [Release - Phases 1-3](https://github.com/eclipse-che/che-release/actions/workflows/release-orchestrate-overall.yml) workflow to trigger Che release workflows. Workflows triggered align to the repos, that are corresponding with 1,2 and 3 phases. In the input, provide the version of Che, and phases to run. +2. Once all pending PRs/blocker issues are resolved, use the [Release - Orchestration](https://github.com/eclipse-che/che-release/actions/workflows/release-orchestrate-overall.yml) workflow to trigger Che release workflows. This should begin the orderly release of all Che Operator dependencies and Che operator itself (create Che operator artifacts and pull requests with CSV files). 2.1 If one of the workflows has crashed, inspect it. Apply fixes if needed, and restart it. You can restart individual workflow, or whole phase in orchestration job, whichever is simpler. @@ -99,7 +33,8 @@ The [Release - Orchestrate Overall Release Phases]((https://github.com/eclipse-c 2.3 Sometimes, the hotfix changes to the workflow can take too long to get approved and merged. In certain situations, we can use the modified workflow file, which is pushed in its own branch, and then trigger the workflow, while specifying the branch with our modified workflow. -3. When Che Operator PRs have been generated, you must wait for the approval of PR checks, that are in that repository. If there are any questions, you can forward them to the [repository maintaners](https://github.com/eclipse-che/che-operator/blob/main/.github/CODEOWNERS#L2). When PRs are merged, the last batch of projects will be triggered to release +3. When Che Operator PRs have been generated, you must wait for the approval of PR checks, that are in that repository. The PR checks include running of various tests, so if something is wrong with operator or its dependencies, it should be possible to apply the fixes and re-release any of them if needed, but only at this stage, before operator PRs are merged. +If there are any questions, you can forward them to the [repository maintaners](https://github.com/eclipse-che/che-operator/blob/main/.github/CODEOWNERS#L2). When PRs are merged, the last batch of projects will be triggered to release 3.1 Chectl PR has to be closed manually, after they're generated, and all its associated PR checks are passed. @@ -107,9 +42,9 @@ The [Release - Orchestrate Overall Release Phases]((https://github.com/eclipse-c 3.3 Docs PR has to be merged by Docs team. -4. When the release is complete, an e-mail should be sent to the `che-dev` mailing list. +4. When the release is complete, the release notes should be published, as well as any other respective announcements. -5. TODO: a Slack notification should be sent to the ECD Slack. See https://github.com/eclipse-che/che/issues/22551 + 4.1 Ensure that all PRs that were created during the release (like ones that bump the project to the next version). Run the job [Release - Check for unmerged PRs](https://github.com/eclipse-che/che-release/actions/workflows/release-check-unmerged-PRs.yml) to help locate any remaining open PRs. -------------- @@ -118,12 +53,8 @@ The [Release - Orchestrate Overall Release Phases]((https://github.com/eclipse-c Here is the information about projects related to Che, but are not a part of Che release process/versioning -https://github.com/devfile/devworkspace-operator - used in Che operator. -https://github.com/che-incubator/kubernetes-image-puller-operator - used in Che operator. -https://github.com/eclipse-che/blog - Eclipse Che blog. -https://github.com/eclipse-che/che-website - Eclipse Che website sources. [che-website-publish](https://github.com/eclipse-che/che-website-publish) will publish this website, along with Che Docs - -# Che release known issues + - https://github.com/devfile/devworkspace-operator - used in Che operator. + - https://github.com/che-incubator/kubernetes-image-puller-operator - used in Che operator. + - https://github.com/eclipse-che/blog - Eclipse Che blog. + - https://github.com/eclipse-che/che-website - Eclipse Che website sources. [che-website-publish](https://github.com/eclipse-che/che-website-publish) will publish this website, along with Che Docs -* Enable slack notifications #[22551](https://github.com/eclipse-che/che/issues/22551) -* Autorelease the Che Release Notes after chectl release #[22550](https://github.com/eclipse-che/che/issues/22550) diff --git a/che-release.yaml b/che-release.yaml index 8457c13..2aa50d2 100644 --- a/che-release.yaml +++ b/che-release.yaml @@ -13,7 +13,6 @@ # - image: Quay.io container image (checks if tag exists) # - npmjs: NPM package (checks if version published) # - github-release: GitHub release (checks if tag exists) -# - website: Website URL (checks if accessible) # - website-version: Website with version verification (checks if HTML element with class # "version-menu-toggle" contains the release version) # - pull-requests: Expected PRs with title patterns and merge requirements @@ -22,6 +21,7 @@ release_config: phases: phase_1: description: "Independent projects (no Che dependencies)" + orchestration: true projects: - name: jetbrains-ide-dev-server repo: che-incubator/jetbrains-ide-dev-server @@ -118,6 +118,7 @@ release_config: phase_2: description: "Projects depending on Phase 1" + orchestration: true projects: - name: che-e2e repo: eclipse/che @@ -168,6 +169,7 @@ release_config: pull-requests: [] phase_3: description: "Projects depending on Phase 2" + orchestration: true projects: - name: che-plugin-registry repo: eclipse-che/che-plugin-registry @@ -185,6 +187,7 @@ release_config: - "{branch}" phase_4: description: "Operator (depends on all previous phases)" + orchestration: true projects: - name: che-operator repo: eclipse-che/che-operator @@ -194,7 +197,6 @@ release_config: parameters: - key: version value: "{version}" - pause: true artifacts: - type: image name: quay.io/eclipse/che-operator diff --git a/scripts/lib/github-api.sh b/scripts/lib/github-api.sh index 249eeca..48504f4 100644 --- a/scripts/lib/github-api.sh +++ b/scripts/lib/github-api.sh @@ -5,7 +5,10 @@ computeWorkflowId() { this_repo=$1 this_action_name=$2 - workflow_id=$(curl -sSL "https://api.github.com/repos/${this_repo}/actions/workflows" -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" | jq --arg search_field "${this_action_name}" '.workflows[] | select(.name == $search_field).id'); + local this_github_token + this_github_token=$(get_github_token "$this_repo") + + workflow_id=$(curl -sSL "https://api.github.com/repos/${this_repo}/actions/workflows" -H "Authorization: token ${this_github_token}" -H "Accept: application/vnd.github.v3+json" | jq --arg search_field "${this_action_name}" '.workflows[] | select(.name == $search_field).id'); # echo "workflow_id = $workflow_id" if [[ ! $workflow_id ]]; then echo "[ERROR] Could not compute workflow id from https://api.github.com/repos/${this_repo}/actions/workflows - check your GITHUB_TOKEN is active" @@ -50,11 +53,8 @@ invokeAction() { inputsJson=$(echo "${inputsJson}" | jq ". + {\"${key}\": \"${value}\"}") done - if [[ ${this_repo} == "che-incubator"* ]] || [[ ${this_repo} == "devfile"* ]] || [[ ${this_repo} == "che-dockerfiles"* ]]; then - this_github_token=${CHE_INCUBATOR_BOT_GITHUB_TOKEN} - else - this_github_token=${GITHUB_TOKEN} - fi + local this_github_token + this_github_token=$(get_github_token "$this_repo") curl -sSL "https://api.github.com/repos/${this_repo}/actions/workflows/${workflow_id}/dispatches" -X POST -H "Authorization: token ${this_github_token}" -H "Accept: application/vnd.github.v3+json" -d "{\"ref\":\"${workflow_ref}\",\"inputs\": ${inputsJson} }" || die_with "[ERROR] Problem invoking action https://github.com/${this_repo}/actions?query=workflow%3A%22${this_action_name// /+}%22" echo "[INFO] Invoked '${this_action_name}' action ($workflow_id) - see https://github.com/${this_repo}/actions?query=workflow%3A%22${this_action_name// /+}%22" @@ -92,11 +92,28 @@ verifyBranchExistsWithTimeoutAndExit() } get_github_token() { - local repo="$1" + local repo="${1:-}" + + # If no repo specified, return any available token + if [[ -z "$repo" ]]; then + echo "${CHE_BOT_GITHUB_TOKEN:-${CHE_INCUBATOR_BOT_GITHUB_TOKEN:-${GITHUB_TOKEN:-}}}" + return + fi + + # Priority 1: Use repo-specific bot tokens if provided + # Priority 2: Fall back to GITHUB_TOKEN (user's personal access token) if [[ "$repo" == "che-incubator"* ]] || [[ "$repo" == "devfile"* ]] || [[ "$repo" == "che-dockerfiles"* ]]; then - echo "${CHE_INCUBATOR_BOT_GITHUB_TOKEN:-}" + if [[ -n "${CHE_INCUBATOR_BOT_GITHUB_TOKEN:-}" ]]; then + echo "${CHE_INCUBATOR_BOT_GITHUB_TOKEN}" + else + echo "${GITHUB_TOKEN:-}" + fi else - echo "${CHE_BOT_GITHUB_TOKEN:-}" + if [[ -n "${CHE_BOT_GITHUB_TOKEN:-}" ]]; then + echo "${CHE_BOT_GITHUB_TOKEN}" + else + echo "${GITHUB_TOKEN:-}" + fi fi } diff --git a/scripts/lib/yaml-parser.sh b/scripts/lib/yaml-parser.sh index 62f31ee..f3b97a5 100644 --- a/scripts/lib/yaml-parser.sh +++ b/scripts/lib/yaml-parser.sh @@ -37,6 +37,11 @@ get_phase_description() { yq -r ".release_config.phases.${phase_key}.description" "$RELEASE_CONFIG_FILE" } +get_phase_orchestration() { + local phase_key="$1" + yq -r ".release_config.phases.${phase_key}.orchestration // false" "$RELEASE_CONFIG_FILE" +} + get_phase_projects_json() { local phase_key="$1" yq ".release_config.phases.${phase_key}.projects" "$RELEASE_CONFIG_FILE" diff --git a/scripts/make-release.sh b/scripts/make-release.sh index 1563e13..d5a98ea 100755 --- a/scripts/make-release.sh +++ b/scripts/make-release.sh @@ -15,15 +15,17 @@ source "${SCRIPTS_DIR}"/lib/yaml-parser.sh usage () { - echo "Usage: $0 --version [CHE VERSION TO RELEASE] --parent-version [CHE PARENT VERSION] --phases [LIST OF PHASES] [--dry-run] + echo "Usage: $0 --version [CHE VERSION TO RELEASE] [--phases [LIST OF PHASES]] [--dry-run] -# Comma-separated phases to perform. -# Default: 1,2,3 +# Comma-separated phases to perform, e.g. (1,2,3,4). +# If omitted: automatically run all phases with orchestration:true # Omit phases that have successfully run. # --dry-run: Show what would be done without making any API calls or changes " + echo "Example: $0 --version 7.75.0"; echo echo "Example: $0 --version 7.75.0 --phases 1,2,3"; echo echo "Example: $0 --version 7.75.0 --phases 1,2,3 --dry-run"; echo + echo "Example: $0 --version 7.75.0 --dry-run"; echo exit 1 } @@ -52,10 +54,6 @@ setupGitconfig() { # suppress warnings about how to reconcile divergent branches git config --global pull.ff only - - # NOTE when invoking action from che-incubator/* repos (not eclipse/che* repos), must use CHE_INCUBATOR_BOT_GITHUB_TOKEN - # default to CHE_BOT GH token - export GITHUB_TOKEN="${CHE_BOT_GITHUB_TOKEN}" } evaluateCheVariables() { @@ -227,7 +225,7 @@ while [[ "$#" -gt 0 ]]; do shift 1 done -if [[ ! ${CHE_VERSION} ]] || [[ ! ${PHASES} ]] ; then +if [[ ! ${CHE_VERSION} ]]; then usage fi @@ -267,6 +265,31 @@ set -e # Parse YAML config parse_release_config "$REPO_ROOT/che-release.yaml" +# Auto-determine phases if not provided +if [[ -z "${PHASES}" ]]; then + echo "[INFO] No phases specified, auto-determining phases to run..." + auto_phases="" + for phase_key in $(get_phase_keys); do + phase_num="${phase_key#phase_}" + orchestration=$(get_phase_orchestration "$phase_key") + + if [[ "$orchestration" == "true" ]]; then + # Phase has orchestration:true, add it + if [[ -n "$auto_phases" ]]; then + auto_phases="${auto_phases},${phase_num}" + else + auto_phases="${phase_num}" + fi + echo "[INFO] Including phase ${phase_num} (orchestration: true)" + else + echo "[INFO] Skipping phase ${phase_num} (orchestration: false or not set)" + fi + done + + PHASES="$auto_phases" + echo "[INFO] Auto-determined phases: ${PHASES}" +fi + #################### DYNAMIC PHASE EXECUTION #################### # Find the first requested phase number @@ -298,13 +321,23 @@ if [[ -n "$first_requested_phase" ]]; then done fi -# Execute requested phases, stopping after any phase with a "pause" workflow +# Execute requested phases, continuing as long as orchestration is true for phase_key in $(get_phase_keys); do phase_num="${phase_key#phase_}" phase_desc=$(get_phase_description "$phase_key") + orchestration=$(get_phase_orchestration "$phase_key") # Check if this phase is requested if [[ ${PHASES} == *"${phase_num}"* ]]; then + # Check if orchestration is enabled for this phase + if [[ "$orchestration" != "true" ]]; then + echo "[INFO] ==========================================" + echo "[INFO] Phase ${phase_num}: ${phase_desc}" + echo "[INFO] Stopping: orchestration is not enabled for this phase" + echo "[INFO] ==========================================" + break + fi + echo "[INFO] ==========================================" echo "[INFO] Phase ${phase_num}: ${phase_desc}" echo "[INFO] ==========================================" @@ -312,13 +345,6 @@ for phase_key in $(get_phase_keys); do set +x executePhaseWorkflows "$phase_key" "$CHE_VERSION" "$BRANCH" verifyPhaseArtifacts "$phase_key" "$CHE_VERSION" "$BRANCH" - - # Check if any workflow in this phase has pause:true - projects_json=$(get_phase_projects_json "$phase_key") - if echo "$projects_json" | jq -e '.[] | select(.workflow.pause == true)' > /dev/null 2>&1; then - echo "[INFO] Phase ${phase_num} contains a workflow with pause=true, stopping here." - break - fi fi done diff --git a/scripts/release-info.sh b/scripts/release-info.sh index 26eeb57..4cea6ad 100755 --- a/scripts/release-info.sh +++ b/scripts/release-info.sh @@ -25,7 +25,9 @@ usage() { echo " version Version in format X.Y.Z (e.g., 7.120.0)" echo " --debug Show detailed API call information" echo "" - echo "Example: $0 7.120.0" + echo "Environment Variables:" + echo " GITHUB_TOKEN GitHub personal access token or organization bot token" + echo " Required for API access to check release status" exit 1 } @@ -477,27 +479,35 @@ fi validate_version "$VERSION" BRANCH=$(calculate_branch "$VERSION") -# Check tokens -if [[ -z "${CHE_BOT_GITHUB_TOKEN:-}" ]]; then - echo "[ERROR] CHE_BOT_GITHUB_TOKEN is not set" >&2 - echo "Set it with: export CHE_BOT_GITHUB_TOKEN=" >&2 +# Check token availability +check_token=$(get_github_token) +if [[ -z "$check_token" ]]; then + echo "[ERROR] No GitHub token available" >&2 + echo "Set one of: GITHUB_TOKEN, CHE_BOT_GITHUB_TOKEN, or CHE_INCUBATOR_BOT_GITHUB_TOKEN" >&2 exit 1 fi -if [[ -z "${CHE_INCUBATOR_BOT_GITHUB_TOKEN:-}" ]]; then - echo "[WARN] CHE_INCUBATOR_BOT_GITHUB_TOKEN is not set, using CHE_BOT_GITHUB_TOKEN for all repos" >&2 - export CHE_INCUBATOR_BOT_GITHUB_TOKEN="$CHE_BOT_GITHUB_TOKEN" -fi +# Validate token by checking rate limit +debug_log "Validating GitHub token..." +remaining=$(check_rate_limit "$check_token") || { + echo "[ERROR] Failed to authenticate with GitHub API" >&2 + echo "One of the provided tokens (GITHUB_TOKEN, CHE_BOT_GITHUB_TOKEN, or CHE_INCUBATOR_BOT_GITHUB_TOKEN) may be invalid or expired" >&2 + exit 1 +} -# Check rate limit -remaining=$(check_rate_limit "$CHE_BOT_GITHUB_TOKEN") || true -if [[ "$remaining" == "0" ]]; then +if [[ "$remaining" == "unknown" ]]; then + echo "[ERROR] Failed to validate GitHub token" >&2 + echo "The token may be invalid, expired, or lack required permissions" >&2 + exit 1 +elif [[ "$remaining" == "0" ]]; then echo "[ERROR] GitHub API rate limit exhausted. Try again later." >&2 exit 1 -elif [[ "$remaining" != "unknown" ]] && [[ "$remaining" -lt 100 ]]; then +elif [[ "$remaining" -lt 100 ]]; then echo "[WARN] GitHub API rate limit low: ${remaining} requests remaining" >&2 fi +debug_log "Token validated successfully. Rate limit remaining: ${remaining}" + # Parse config parse_release_config "$REPO_ROOT/che-release.yaml"