Skip to content

Commit

Permalink
Conflicts resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
c-bordon committed Sep 26, 2024
2 parents 9e8e796 + 15ea6c6 commit 5c0fa05
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/packages_builder_ami.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
run-name: Build AMI - Wazuh virtual machines branch ${{ inputs.WAZUH_VIRTUAL_MACHINES_REFERENCE }} - Launched by @${{ github.actor }}
run-name: Build AMI - Wazuh virtual machines ${{ inputs.id }} - Branch ${{ github.ref_name }} - Launched by @${{ github.actor }}
name: Build AMI

on:
workflow_dispatch:
inputs:
WAZUH_VIRTUAL_MACHINES_REFERENCE:
description: 'Branch or tag of the wazuh-virtual-machines repository where the workflow will be triggered'
required: true
default: '4.10.0'
id:
description: "ID used to identify the workflow uniquely."
type: string
required: false
WAZUH_AUTOMATION_REFERENCE:
description: 'Branch or tag of the wazuh-automation repository'
required: true
Expand All @@ -26,19 +26,27 @@ on:
- -vv
- -vvv
- -vvvv
SUFFIX_AMI:
description: 'Suffix to add to the AMI name, must begin with "_" without quotes. For pre-relase, use -1'
AMI_REVISION:
description: |
'For AMI candidates must be a number, e,g: -1.'
'To build a development AMI, use another revision format, e.g: -dev'
required: false
default: '-1'
DESTROY:
type: boolean
description: 'Destroy the base instance after the AMI is created'
required: false
default: true
workflow_call:
inputs:
id:
type: string
required: false

env:
COMPOSITE_NAME: "linux-amazon-2-ami-amd64"
ALLOCATOR_PATH: "/tmp/allocatorvm_ami"
PLAYBOOKS_PATH: "${{ github.workspace }}/ami/playbooks/"

permissions:
id-token: write
Expand All @@ -53,8 +61,6 @@ jobs:

- name: Checkout wazuh/wazuh-virtual-machines repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.WAZUH_VIRTUAL_MACHINES_REFERENCE }}

- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v3
Expand Down Expand Up @@ -110,7 +116,7 @@ jobs:
- name: Run Ansible playbook to install Wazuh components
run: |
ansible-playbook -i ${{ env.ALLOCATOR_PATH }}/inventory_ansible.ini ami/playbooks/build_ami_packages.yaml --extra-vars "installation_assistant_reference=${{ inputs.WAZUH_INSTALLATION_ASSISTANT_REFERENCE }}" ${{ inputs.VERBOSITY }}
ansible-playbook -i ${{ env.ALLOCATOR_PATH }}/inventory_ansible.ini ${{ env.PLAYBOOKS_PATH }}/build_ami_packages.yaml --extra-vars "installation_assistant_reference=${{ inputs.WAZUH_INSTALLATION_ASSISTANT_REFERENCE }}" ${{ inputs.VERBOSITY }}
- name: Stop instance
run: |
Expand Down Expand Up @@ -145,7 +151,7 @@ jobs:
- name: Build AMI from instance
if: success()
run: |
AMI_NAME="Wazuh_v${{ env.WAZUH_VERSION }}${{ inputs.SUFFIX_AMI }}"
AMI_NAME="Wazuh_v${{ env.WAZUH_VERSION }}${{ inputs.AMI_REVISION }}"
aws ec2 create-image --instance-id ${{ env.identifier }} --name "$AMI_NAME" --no-reboot
AMI_ID=$(aws ec2 describe-images --filters "Name=name,Values=$AMI_NAME" --query 'Images[*].ImageId' --output text)
echo "AMI_ID=$AMI_ID" >> $GITHUB_ENV
Expand Down Expand Up @@ -180,7 +186,7 @@ jobs:
- name: Tag AMI
if: success()
run: |
aws ec2 create-tags --resources ${{ env.AMI_ID }} --tags Key=Name,Value="Wazuh_v${{ env.WAZUH_VERSION }}${{ inputs.SUFFIX_AMI }}"
aws ec2 create-tags --resources ${{ env.AMI_ID }} --tags Key=Name,Value="Wazuh_v${{ env.WAZUH_VERSION }}${{ inputs.AMI_REVISION }}"
- name: Delete allocated VM
if: always() && steps.alloc_vm_ami.outcome == 'success' && inputs.DESTROY == true
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ All notable changes to this project will be documented in this file.
### Added

- Added builder_OVA workflow ([#32](https://github.com/wazuh/wazuh-virtual-machines/pull/32))

- Added packages_builder_ami workflow header ([#31](https://github.com/wazuh/wazuh-virtual-machines/pull/31))

- Added the OVA to the wazuh-virtual-machines repository without changes ([#30](https://github.com/wazuh/wazuh-virtual-machines/pull/30)) - (OVA)

### Changed

- Adapted repository selection in OVA generation ([#58](https://github.com/wazuh/wazuh-virtual-machines/pull/58))
- Modify the AMI GHA workflow with the new Installation Assistant logic ([#55](https://github.com/wazuh/wazuh-virtual-machines/pull/55))
- Migrated the OVA construction files to the wazuh-virtual-machines repository ([#29](https://github.com/wazuh/wazuh-virtual-machines/pull/29)) - (OVA)

### Fixed

- Deleted dashboard logs cleanup in OVA local build([#57](https://github.com/wazuh/wazuh-virtual-machines/pull/57))
- Fix typos and add news inputs in the AMI workflow header ([#35](https://github.com/wazuh/wazuh-virtual-machines/pull/35))

### Deleted
Expand Down
4 changes: 2 additions & 2 deletions ami/playbooks/build_ami_packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
until: clone_result is success

- name: Build install script
shell: "bash {{ installation_assistant_directory }}/{{ builder_script_name }} -i -d"
shell: "bash {{ installation_assistant_directory }}/{{ builder_script_name }} -i"

- name: Build password change script
shell: "bash {{ installation_assistant_directory }}/{{ builder_script_name }} -p"
Expand Down Expand Up @@ -166,7 +166,7 @@
###############################

- name: Run {{ installer_script_name }} script
command: "bash {{ installation_assistant_directory }}/{{ installer_script_name }} -a -v -o"
command: "bash {{ installation_assistant_directory }}/{{ installer_script_name }} -a -v -o -d"

###############################
# Post-install stage
Expand Down
1 change: 0 additions & 1 deletion ova/assets/postProvision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ find /var/log/ -type f -exec bash -c 'cat /dev/null > {}' \;
find /var/ossec/logs -type f -execdir sh -c 'cat /dev/null > "$1"' _ {} \;
find /var/log/wazuh-indexer -type f -execdir sh -c 'cat /dev/null > "$1"' _ {} \;
find /var/log/filebeat -type f -execdir sh -c 'cat /dev/null > "$1"' _ {} \;
find /usr/share/wazuh-dashboard/data/wazuh/logs -type f -execdir sh -c 'cat /dev/null > "$1"' _ {} \;

history -c
shutdown -r now > /dev/null 2>&1

0 comments on commit 5c0fa05

Please sign in to comment.