-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add a dispatch job to manually trigger cloud packages builds (
#1337) * feat(ci): add a dispatch job to manually trigger cloud packages builds * fix linting yaml * Apply sugestions from code review * fix release runs url * Update release-trigger-builds.yml
- Loading branch information
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
name: release-trigger-builds | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dispatch_target_release_branch: | ||
description: "Cloud release branch to trigger" | ||
required: true | ||
dispatch_content: | ||
description: "Regular (only centreon named components) or Full (every component, including php and extra libs)" | ||
required: true | ||
type: choice | ||
options: | ||
- REGULAR | ||
- FULL | ||
|
||
jobs: | ||
release-trigger-builds: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Install Github CLI | ||
run: | | ||
set -eux | ||
if ! command -v gh &> /dev/null; then | ||
echo "Installing GH CLI." | ||
type -p curl >/dev/null || (sudo apt-get update && sudo apt-get install curl -y) | ||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg | ||
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg | ||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | ||
sudo apt-get update | ||
sudo apt-get install gh -y | ||
else | ||
echo "GH CLI is already installed." | ||
fi | ||
shell: bash | ||
|
||
- name: Trigger selected branches | ||
run: | | ||
set -eux | ||
# VARS | ||
# names defined in workflow files per components | ||
#COMPONENTS_OSS=("awie" "dsm" "gorgone" "ha" "open-tickets" "web") | ||
#COMPONENTS_OSS_FULL=("awie" "dsm" "gorgone" "ha" "open-tickets" "web") | ||
#COMPONENTS_MODULES=("anomaly-detection" "autodiscovery" "bam" "cloud-business-extensions" "cloud-extensions" "it-edition-extensions" "lm" "map" "mbi" "ppm") | ||
#COMPONENTS_MODULES_FULL=("anomaly-detection" "autodiscovery" "bam" "cloud-business-extensions" "cloud-extensions" "it-edition-extensions" "lm" "map" "mbi" "ppm" "php-pecl-gnupg" "sourceguardian-loader") | ||
COMPONENTS_COLLECT=("Centreon collect") | ||
COMPONENTS_COLLECT_FULL=("Centreon collect") | ||
RUNS_URL="" | ||
if [[ ${{ inputs.dispatch_target_release_branch }} =~ ^release-2[0-9]\.[0-9]+-next$ ]];then | ||
echo "Using ${{ inputs.dispatch_target_release_branch }} as release branch to build testing packages." | ||
RUNS_URL="https://github.com/centreon/centreon-collect/actions?query=branch%3A${{ inputs.dispatch_target_release_branch }}" | ||
else | ||
echo "::error::Invalid release branch name, please check the release branch name." | ||
exit 1 | ||
fi | ||
if [[ "${{ inputs.dispatch_content }}" == "FULL" ]]; then | ||
echo "Requested ${{ inputs.dispatch_content }} content, triggering all component workflows." | ||
for COMPONENT in ${COMPONENTS_COLLECT_FULL[@]}; do | ||
gh workflow run $COMPONENT -r ${{ inputs.dispatch_target_release_branch }} | ||
done | ||
else | ||
echo "Requested ${{ inputs.dispatch_content }} content, triggering centreon named components only." | ||
for COMPONENT in ${COMPONENTS_COLLECT[@]}; do | ||
gh workflow run $COMPONENT -r ${{ inputs.dispatch_target_release_branch }} | ||
done | ||
fi | ||
echo "Dispatch was successfully triggered. Runs can be found at ${RUNS_URL}" | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |