From 4bceffbf9272abeeb7f37324461010a5a3dd752d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Anguita=20L=C3=B3pez?= Date: Mon, 27 Jan 2025 14:34:01 +0100 Subject: [PATCH 1/2] fix the ova workflow for stages --- .github/workflows/builder_OVA.yaml | 2 +- ova/provision.sh | 6 ++++++ ova/workflow_assets/ova_configurer.py | 9 +++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/builder_OVA.yaml b/.github/workflows/builder_OVA.yaml index 802e6c1..d7359db 100644 --- a/.github/workflows/builder_OVA.yaml +++ b/.github/workflows/builder_OVA.yaml @@ -216,5 +216,5 @@ jobs: echo "S3 sha512 OVA URI: ${s3uri}" - name: Delete allocated VM - if: always() && steps.alloc_vm == 'success' + if: always() && steps.alloc_vm.outcome == 'success' run: python3 wazuh-automation/deployability/modules/allocation/main.py --action delete --track-output ${{ env.ALLOCATOR_PATH }}/track.yml diff --git a/ova/provision.sh b/ova/provision.sh index e91f873..b4118fa 100755 --- a/ova/provision.sh +++ b/ova/provision.sh @@ -13,6 +13,12 @@ ASSETS_PATH="${CURRENT_PATH}/assets" CUSTOM_PATH="${ASSETS_PATH}/custom" INSTALL_ARGS="-a" +if [[ "${PACKAGES_REPOSITORY}" == "dev" ]]; then + INSTALL_ARGS+=" -d pre-release" +elif [[ "${PACKAGES_REPOSITORY}" == "staging" ]]; then + INSTALL_ARGS+=" -d staging" +fi + if [[ "${DEBUG}" = "yes" ]]; then INSTALL_ARGS+=" -v" fi diff --git a/ova/workflow_assets/ova_configurer.py b/ova/workflow_assets/ova_configurer.py index 86119d1..4da95a7 100644 --- a/ova/workflow_assets/ova_configurer.py +++ b/ova/workflow_assets/ova_configurer.py @@ -28,7 +28,7 @@ def clone_repositories(): subprocess.run(f"git clone {repo['url']} {repo['dest']}", shell=True, check=True) -def build_wazuh_install(repo_path, wia_branch, repository): +def build_wazuh_install(repo_path, wia_branch): """ Builds the wazuh-install.sh script and moves it to /tmp @@ -41,10 +41,7 @@ def build_wazuh_install(repo_path, wia_branch, repository): if os.path.exists(repo_path): os.chdir(repo_path) subprocess.run(f"git checkout {wia_branch}", shell=True, check=True) - command = "sudo bash builder.sh -i" - if repository in ["dev", "staging"]: - command += " -d" - subprocess.run(command, shell=True, check=True) + subprocess.run("sudo bash builder.sh -i", shell=True, check=True) if os.path.exists("wazuh-install.sh"): subprocess.run("sudo mv wazuh-install.sh /tmp/wazuh-install.sh", shell=True, check=True) @@ -130,7 +127,7 @@ def main(): set_hostname() install_git() clone_repositories() - build_wazuh_install("/home/ec2-user/wazuh-installation-assistant", args.wia_branch, args.repository) + build_wazuh_install("/home/ec2-user/wazuh-installation-assistant", args.wia_branch) run_provision_script(args.wvm_branch, args.repository, args.debug) create_network_config() clean() From 29901ffb0e1ba2597b01ff92ebe5c37c5a35ffc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Anguita=20L=C3=B3pez?= Date: Mon, 27 Jan 2025 14:38:35 +0100 Subject: [PATCH 2/2] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dda6c1..b17dc9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file. ### Fixed +- Fix the ova workflow for stages support and AWS instance deletion. ([#175](https://github.com/wazuh/wazuh-virtual-machines/pull/176)) - Fixed the OVA workflow to add support in stages. ([#173](https://github.com/wazuh/wazuh-virtual-machines/pull/173)) ### Deleted