(Tier) Test installation assistant - Launched by @davidcr01 #190
Workflow file for this run
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
run-name: (Tier) Test installation assistant - Launched by @${{ github.actor }} | |
name: (Tier) Test installation assistant | |
on: | |
workflow_dispatch: | |
inputs: | |
REPOSITORY: | |
description: 'Repository environment' | |
required: true | |
default: 'pre-release' | |
type: choice | |
options: | |
- staging | |
- pre-release | |
AUTOMATION_REFERENCE: | |
description: 'Branch or tag of the wazuh-automation repository' | |
required: true | |
default: '4.10.0' | |
OPERATING_SYSTEMS: | |
description: 'Operating systems (comma-separated numbers, e.g., "2,5,9"). Mapping: -------------------------------------------- | 1 = CentOS 7 | ---------------------- | 2 = CentOS 8 | ---------------------- | 3 = Amazon Linux 2 | --------------- | 4 = Ubuntu 16 | -------------------- | 5 = Ubuntu 18 | -------------------- | 6 = Ubuntu 20 | -------------------- | 7 = Ubuntu 22 | -------------------- | 8 = RHEL 7 | ----------------------- | 9 = RHEL 8 | -----------------------' | |
required: true | |
default: '2,5,9' | |
VERBOSITY: | |
description: 'Verbosity level on playbooks execution' | |
required: true | |
default: '-v' | |
type: choice | |
options: | |
- -v | |
- -vv | |
- -vvv | |
- -vvvv | |
DESTROY: | |
description: 'Destroy instances after run' | |
required: true | |
default: true | |
type: boolean | |
env: | |
ASSISTANT_WORKFLOW_ID: "Test_installation_assistant.yml" | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
launch-tests: | |
permissions: | |
actions: write | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Git | |
uses: actions/checkout@v4 | |
- name: Parse operating systems | |
id: parse-os | |
run: | | |
OPERATING_SYSTEMS_MAP=( | |
"1:CentOS_7" | |
"2:CentOS_8" | |
"3:AmazonLinux_2" | |
"4:Ubuntu_16" | |
"5:Ubuntu_18" | |
"6:Ubuntu_20" | |
"7:Ubuntu_22" | |
"8:RHEL7" | |
"9:RHEL8" | |
) | |
IFS=',' read -ra SELECTED_OS <<< "${{ inputs.OPERATING_SYSTEMS }}" | |
SELECTED_SYSTEMS=() | |
for os_num in "${SELECTED_OS[@]}"; do | |
for os_pair in "${OPERATING_SYSTEMS_MAP[@]}"; do | |
if [[ $os_pair == "$os_num:"* ]]; then | |
SELECTED_SYSTEMS+=("${os_pair#*:}") | |
break | |
fi | |
done | |
done | |
echo "systems=${SELECTED_SYSTEMS[@]}" >> $GITHUB_ENV | |
- name: Trigger system-specific workflows asynchronously | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const workflowId = process.env.ASSISTANT_WORKFLOW_ID; | |
const systems = process.env.systems.split(" "); | |
const promises = systems.map(system => { | |
return github.rest.actions.createWorkflowDispatch({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
workflow_id: workflowId, | |
ref: context.ref, | |
inputs: { | |
REPOSITORY: '${{ inputs.REPOSITORY }}', | |
AUTOMATION_REFERENCE: '${{ inputs.AUTOMATION_REFERENCE }}', | |
SYSTEM: system, | |
VERBOSITY: '${{ inputs.VERBOSITY }}', | |
DESTROY: '${{ inputs.DESTROY }}' | |
} | |
}); | |
}); | |
await Promise.all(promises); |