From 94009dba654a3a080970e1d1b5d742cb3f25484d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Correa=20Rodr=C3=ADguez?= Date: Tue, 27 Aug 2024 10:56:50 +0200 Subject: [PATCH] Testing assistant workflow --- .../workflows/Test_installation_assistant.yml | 81 ++++++++++++++++++- 1 file changed, 77 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Test_installation_assistant.yml b/.github/workflows/Test_installation_assistant.yml index 6393629..435304c 100644 --- a/.github/workflows/Test_installation_assistant.yml +++ b/.github/workflows/Test_installation_assistant.yml @@ -21,9 +21,9 @@ on: - staging - pre-release AUTOMATION_REFERENCE: - description: 'wazuh-automation reference' + description: 'Branch or tag of the wazuh-automation repository' required: true - default: 'v4.10.0' + default: '4.10.0' SYSTEM: description: 'Operating System' required: true @@ -52,11 +52,84 @@ on: env: LABEL: ubuntu-latest + COMPOSITE_NAME: "linux-SUBNAME-amd64" + SESSION_NAME: "Installation-Assistant-Test" + REGION: "us-east-1" + + +permissions: + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout jobs: initialize-environment: runs-on: $LABEL steps: - - name: Set up Git - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v4 + + - name: View parameters + run: echo "${{ toJson(inputs) }}" + + - name: Set COMPOSITE_NAME variable + run: | + case ${{ inputs.SYSTEM }} in + "CentOS 7") + SUBNAME="centos-7" + ;; + "CentOS 8") + SUBNAME="centos-8" + ;; + "Amazon Linux 2") + SUBNAME="amazon-2" + ;; + "Ubuntu 16") + SUBNAME="ubuntu-16.04" + ;; + "Ubuntu 18") + SUBNAME="ubuntu-18.04" + ;; + "Ubuntu 20") + SUBNAME="ubuntu-20.04" + ;; + "Ubuntu 22") + SUBNAME="ubuntu-22.04" + ;; + "RHEL7") + SUBNAME="redhat-7" + ;; + "RHEL8") + SUBNAME="redhat-8" + ;; + *) + echo "Invalid SYSTEM selection" >&2 + exit 1 + ;; + esac + COMPOSITE_NAME="$COMPOSITE_NAME/SUBNAME/$SUBNAME" + echo "COMPOSITE_NAME=$COMPOSITE_NAME" >> $GITHUB_ENV + + - name: Install Ansible + run: sudo apt-get update && sudo apt-add-repository ppa:ansible/ansible && sudo apt install -y ansible + + - name: Set up AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_IAM_ROLE }} + role-session-name: $SESSION_NAME + aws-region: $REGION + + - name: Checkout wazuh/wazuh-automation repository + uses: actions/checkout@v4 + with: + repository: wazuh/wazuh-automation + ref: ${{ inputs.AUTOMATION_REFERENCE }} + + - name: Install and set Allocator requirements + run: | + pip3 install -r deployability/deps/requirements.txt + cd deployability/ + pip3 install modules/ + +