Build OVA - Branch change/47-adapt-ova-generation-repository-selection - Launched by @davidcr01 #135
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: Build OVA ${{ inputs.is_stage && ' - is stage' || '' }}${{ inputs.checksum && ' - checksum' || '' }} ${{ inputs.id }} - Branch ${{ github.ref_name }} - Launched by @${{ github.actor }} | |
name: Build OVA | |
on: | |
workflow_dispatch: | |
inputs: | |
id: | |
description: "ID used to identify the workflow uniquely." | |
type: string | |
required: false | |
WAZUH_INSTALLATION_ASSISTANT_REFERENCE: | |
description: 'Branch or tag of the wazuh-installation-assistant repository' | |
required: true | |
default: '4.10.0' | |
WAZUH_PACKAGE_REPOSITORY: | |
type: choice | |
description: 'Wazuh package repository from which to download the packages' | |
required: true | |
options: | |
- prod | |
- dev | |
- staging | |
OVA_REVISION: | |
type: string | |
description: 'Revision of the OVA file. Use -0 for development builds' | |
required: true | |
default: '0' | |
is_stage: | |
description: "Is stage?" | |
type: boolean | |
default: false | |
checksum: | |
type: boolean | |
description: | | |
Generate package checksum. | |
Default is 'false'. | |
required: false | |
DEBUG: | |
type: choice | |
description: 'Debug mode' | |
required: false | |
options: | |
- -v | |
- -vv | |
- -vvv | |
workflow_call: | |
inputs: | |
id: | |
type: string | |
required: false | |
checksum: | |
type: boolean | |
required: false | |
env: | |
OVA_AMI: "ami-0d4bd55523ee67aa4" | |
INSTANCE_TYPE: "t2.xlarge" | |
SECURITY_GROUP: "sg-005cff996b335d497" | |
SUBNET: "subnet-0b6aea31fb32cffad" | |
TEMPORAL_S3_BUCKET: "warehouse.wazuh.com" | |
S3_BUCKET: "packages-dev.wazuh.com" | |
S3_PATH: "development/wazuh/4.x/secondary/OVA" | |
OVA_ENVIRONMENT: "vmware" | |
CONTAINER_FORMAT: "ova" | |
TEMPORAL_S3_PATH: "trash/vm" | |
OVA_USER: "wazuh-user" | |
OVA_USER_PASSWORD: "wazuh" | |
INVENTORY_PATH: "/tmp/allocatorvm_ova" | |
AWS_REGION: "us-east-1" | |
OVA_PATH: "/var/provision/wazuh-virtual-machines" | |
WIA_DIR: "wazuh-installation-assistant" | |
WIA_REPOSITORY: "https://github.com/wazuh/wazuh-installation-assistant" | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
build_and_run: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Ansible | |
run: sudo apt-get update && sudo apt install -y python3 jq sshpass && python3 -m pip install --user ansible-core==2.16 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Exporting OVA to final repository | |
run: | | |
touch test.txt | |
aws s3 cp ./test.txt s3://${{ secrets.AWS_S3_BUCKET }}/${{ env.S3_PATH }}/test.txt | |
- name: Delete allocated VM | |
if: always() && steps.alloc_vm_ova.outcome == 'success' | |
run: | | |
aws ec2 terminate-instances --instance-ids "${{ env.INSTANCE_ID }}" |