From 39ad0e18c74926723fc9ff682ae20d3072cfd5e8 Mon Sep 17 00:00:00 2001 From: c-bordon Date: Thu, 5 Sep 2024 14:45:08 -0300 Subject: [PATCH] Fixed var definitions --- .github/workflows/builder_OVA.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/builder_OVA.yaml b/.github/workflows/builder_OVA.yaml index f611b70..d3f6f9e 100644 --- a/.github/workflows/builder_OVA.yaml +++ b/.github/workflows/builder_OVA.yaml @@ -102,7 +102,7 @@ jobs: - name: Create OVA VM id: alloc_vm_ova run: | - instance=$(aws ec2 run-instances --image-id "${{ OVA_AMI }}" --count 1 --instance-type "${{ INSTANCE_TYPE }}" --key-name Ephemeral --security-group-ids "${{ SECURITY_GROUP }}" --subnet-id "${{ SUBNET }}" \ + instance=$(aws ec2 run-instances --image-id "${{ env.OVA_AMI }}" --count 1 --instance-type "${{ env.INSTANCE_TYPE }}" --key-name Ephemeral --security-group-ids "${{ env.SECURITY_GROUP }}" --subnet-id "${{ env.SUBNET }}" \ --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=gha_${{ github.run_id }}_ova_build},{Key=team,Value=devops}]') INSTANCE_ID=$(echo $instance | jq -r '.Instances[0].InstanceId') echo "INSTANCE_ID=${INSTANCE_ID}" >> $GITHUB_ENV @@ -112,7 +112,7 @@ jobs: MAX_RETRIES=40 NUM_RETRIES=0 while true; do - STATUS=$(aws ec2 describe-instances --instance-ids "${{ INSTANCE_ID }}" | jq -r '.Reservations[0].Instances[0].State.Name') + STATUS=$(aws ec2 describe-instances --instance-ids "${{ env.INSTANCE_ID }}" | jq -r '.Reservations[0].Instances[0].State.Name') if [ "${STATUS}" == "running" ]; then break fi @@ -120,11 +120,11 @@ jobs: NUM_RETRIES=$((NUM_RETRIES+1)) if [ ${NUM_RETRIES} -eq ${MAX_RETRIES} ]; then echo "Error creating OVA VM" - aws ec2 terminate-instances --instance-ids "${{ INSTANCE_ID }}" + aws ec2 terminate-instances --instance-ids "${{ env.INSTANCE_ID }}" exit 1 fi done - ansible_host=$(aws ec2 describe-instances --instance-ids "${{ INSTANCE_ID }}" | jq -r '.Reservations[0].Instances[0].PublicIpAddress') + ansible_host=$(aws ec2 describe-instances --instance-ids "${{ env.INSTANCE_ID }}" | jq -r '.Reservations[0].Instances[0].PublicIpAddress') mkdir -p /tmp/allocatorvm_ova echo "[gha_instance]" > /tmp/allocatorvm_ova/inventory echo "$ansible_host ansible_user=wazuh-user ansible_password=wazuh ansible_ssh_common_args='-o StrictHostKeyChecking=no'" >> /tmp/allocatorvm_ova/inventory @@ -196,4 +196,4 @@ jobs: - name: Delete allocated VM if: always() && steps.alloc_vm_ova.outcome == 'success' run: | - aws ec2 terminate-instances --instance-ids "${{ INSTANCE_ID }}" + aws ec2 terminate-instances --instance-ids "${{ env.INSTANCE_ID }}"