Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 4.10.1 into 4.10.2 #114

Merged
merged 42 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5855d12
Add header and build files steps
Enaraque Sep 17, 2024
44f72dd
Add step to upload artifacts to s3
Enaraque Sep 19, 2024
dc81d33
Remove acl
Enaraque Sep 19, 2024
202c097
Add short commmit sha and fix s3 repository path
Enaraque Sep 19, 2024
9a57c77
Add s3 bucket as secret
Enaraque Sep 24, 2024
71882dd
Change version to reference in the branch
Enaraque Sep 24, 2024
814be0d
Update changelog
Enaraque Sep 24, 2024
aa18f6c
Change changelog and update artifact execution
Enaraque Sep 25, 2024
56a48d1
Remove branch reference and generate artifact step
Enaraque Sep 25, 2024
b3b1e4c
Merge pull request #77 from wazuh/enhancement/55-create-a-gha-workflo…
c-bordon Sep 26, 2024
4c99a43
added wazuh-installation-assistant reference input
CarlosALgit Oct 8, 2024
4df3157
changed actions/checkout to v4
CarlosALgit Oct 8, 2024
42738d8
Testing function check prerequisites
c-bordon Oct 8, 2024
3792933
changelog updated
CarlosALgit Oct 8, 2024
af78494
Merge pull request #98 from wazuh/change/97-new-input-for-wazuh-autom…
c-bordon Oct 8, 2024
7b9b80d
Fix dependences variables values in offline install
Enaraque Oct 8, 2024
65c9685
unified ifs
CarlosALgit Oct 9, 2024
ef980f5
updated the changelog
CarlosALgit Oct 9, 2024
e2f3938
Resolve changelog conflicts
Enaraque Oct 9, 2024
52f7704
Merge pull request #99 from wazuh/bug/96-the-offline_checkprerequisit…
c-bordon Oct 9, 2024
d53eb30
Change source branch
teddytpc1 Oct 10, 2024
b37eee4
Merge pull request #103 from wazuh/change/102-source-branch
c-bordon Oct 10, 2024
69daafd
Revert source branch
c-bordon Oct 10, 2024
1680666
Merge pull request #104 from wazuh/revert/102-source-branch
c-bordon Oct 10, 2024
1c4433a
Add checksum step with artifact to test it
Enaraque Oct 11, 2024
6b9698f
Fix file basename
Enaraque Oct 11, 2024
31f0d42
Add upload to s3 steps
Enaraque Oct 11, 2024
2480879
Add bucket as string
Enaraque Oct 11, 2024
2867c50
Fix s3 path
Enaraque Oct 11, 2024
fc19b19
Change URI echo ti maintain consistency
Enaraque Oct 11, 2024
231805a
Changed GitHub Runner version to fix Python error
c-bordon Oct 15, 2024
4240e02
Updated changelog
c-bordon Oct 15, 2024
28c6c2f
Merge pull request #110 from wazuh/bug/wa-1891-Update-GitHub-Runner-V…
c-bordon Oct 16, 2024
b0b7347
Change variables name
Enaraque Oct 16, 2024
3a194d8
Merge branch '4.10.0' into bug/105-wazuh-installation-assistant-workf…
Enaraque Oct 16, 2024
5b13891
Update changelog
Enaraque Oct 16, 2024
d24d2a5
Fix s3 bucket env variable
Enaraque Oct 16, 2024
632a162
Remove -tool from echo in upload files to S3 step
Enaraque Oct 16, 2024
f4e98fe
Merge pull request #106 from wazuh/bug/105-wazuh-installation-assista…
c-bordon Oct 16, 2024
7aa178b
Merge 4.10.0 into 4.10.1
c-bordon Oct 17, 2024
8bf006e
Merge pull request #113 from wazuh/merge-4.10.0-into-4.10.1
teddytpc1 Oct 17, 2024
13b9b64
Merge 4.10.1 into 4.10.2
c-bordon Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions .github/workflows/Test_installation_assistant.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run-name: Test installation assistant - ${{ github.run_id }} - ${{ inputs.SYSTEMS }} - Launched by @${{ github.actor }}
name: Test installation assistant
name: Test installation assistant

on:
pull_request:
Expand All @@ -20,10 +20,14 @@ on:
options:
- staging
- pre-release
WAZUH_INSTALLATION_ASSISTANT_REFERENCE:
description: 'Branch or tag of the wazuh-installation-assistant repository'
required: true
default: '4.10.2'
AUTOMATION_REFERENCE:
description: 'Branch or tag of the wazuh-automation repository'
required: true
default: '4.10.1'
default: '4.10.2'
SYSTEMS:
description: 'Operating Systems (list of comma-separated quoted strings enclosed in square brackets)'
required: true
Expand Down Expand Up @@ -62,7 +66,7 @@ permissions:

jobs:
run-test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
fail-fast: false # If a job fails, the rest of jobs will not be canceled
matrix:
Expand All @@ -71,10 +75,12 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.WAZUH_INSTALLATION_ASSISTANT_REFERENCE }}

- name: View parameters
run: echo "${{ toJson(inputs) }}"

- name: Set COMPOSITE_NAME variable
run: |
case "${{ matrix.system }}" in
Expand Down Expand Up @@ -115,7 +121,7 @@ jobs:

- name: Install Ansible
run: sudo apt-get update && sudo apt install -y python3 && python3 -m pip install --user ansible-core==2.16

- name: Set up AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down Expand Up @@ -144,7 +150,7 @@ jobs:
sed 's/: */=/g' $ALLOCATOR_PATH/inventory.yml > $ALLOCATOR_PATH/inventory_mod.yml
sed -i 's/-o StrictHostKeyChecking=no/\"-o StrictHostKeyChecking=no\"/g' $ALLOCATOR_PATH/inventory_mod.yml
source $ALLOCATOR_PATH/inventory_mod.yml

echo "[gha_instance]" > $ALLOCATOR_PATH/inventory
echo "$ansible_host ansible_port=$ansible_port ansible_user=$ansible_user ansible_ssh_private_key_file=$ansible_ssh_private_key_file ansible_ssh_common_args='$ansible_ssh_common_args'" >> $ALLOCATOR_PATH/inventory

Expand Down Expand Up @@ -186,13 +192,13 @@ jobs:
-e "logs_path=$LOGS_PATH" \
-e "test_name=$TEST_NAME" \
"${{ inputs.VERBOSITY }}"

- name: Compress Allocator VM directory
id: compress_allocator_files
if: always() && steps.allocator_instance.outcome == 'success' && inputs.DESTROY == false
run: |
zip -P "${{ secrets.ZIP_ARTIFACTS_PASSWORD }}" -r $ALLOCATOR_PATH.zip $ALLOCATOR_PATH

- name: Upload Allocator VM directory as artifact
if: always() && steps.compress_allocator_files.outcome == 'success' && inputs.DESTROY == false
uses: actions/upload-artifact@v4
Expand All @@ -203,4 +209,4 @@ jobs:
- name: Delete allocated VM
if: always() && steps.allocator_instance.outcome == 'success' && inputs.DESTROY == true
run: python3 wazuh-automation/deployability/modules/allocation/main.py --action delete --track-output $ALLOCATOR_PATH/track.yml

44 changes: 25 additions & 19 deletions .github/workflows/Test_installation_assistant_distributed.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run-name: (Distributed) Test installation assistant - ${{ github.run_id }} - ${{ inputs.SYSTEMS }} - Launched by @${{ github.actor }}
name: (Distributed) Test installation assistant
name: (Distributed) Test installation assistant

on:
pull_request:
Expand All @@ -20,10 +20,14 @@ on:
options:
- staging
- pre-release
WAZUH_INSTALLATION_ASSISTANT_REFERENCE:
description: 'Branch or tag of the wazuh-installation-assistant repository'
required: true
default: '4.10.2'
AUTOMATION_REFERENCE:
description: 'Branch or tag of the wazuh-automation repository'
required: true
default: '4.10.1'
default: '4.10.2'
SYSTEMS:
description: 'Operating Systems (list of comma-separated quoted strings enclosed in square brackets)'
required: true
Expand Down Expand Up @@ -64,7 +68,7 @@ permissions:

jobs:
run-test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
fail-fast: false # If a job fails, the rest of jobs will not be canceled
matrix:
Expand All @@ -73,10 +77,12 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.WAZUH_INSTALLATION_ASSISTANT_REFERENCE }}

- name: View parameters
run: echo "${{ toJson(inputs) }}"

- name: Set COMPOSITE_NAME variable
run: |
case "${{ matrix.system }}" in
Expand Down Expand Up @@ -117,7 +123,7 @@ jobs:

- name: Install Ansible
run: sudo apt-get update && sudo apt install -y python3 && python3 -m pip install --user ansible-core==2.16 && pip install pyyaml && ansible-galaxy collection install community.general

- name: Set up AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down Expand Up @@ -152,7 +158,7 @@ jobs:
echo "[managers]" > $inventory_managers
echo "[dashboards]" > $inventory_dashboards
echo "[all:vars]" > $inventory_common

for i in ${!instance_names[@]}; do
instance_name=${instance_names[$i]}
# Provision instance in parallel
Expand All @@ -178,7 +184,7 @@ jobs:
if [[ $i -eq 0 ]]; then
echo "indexer1 ansible_host=$ansible_host private_ip=$private_ip ansible_ssh_private_key_file=$ansible_ssh_private_key_file" >> $inventory_indexers
echo "master ansible_host=$ansible_host private_ip=$private_ip ansible_ssh_private_key_file=$ansible_ssh_private_key_file manager_type=master instance_type=indexer_manager" >> $inventory_managers

echo "ansible_user=$ansible_user" >> $inventory_common
echo "ansible_port=$ansible_port" >> $inventory_common
echo "ansible_ssh_common_args='$ansible_ssh_common_args'" >> $inventory_common
Expand All @@ -201,7 +207,7 @@ jobs:
cat $inventory_managers >> $inventory_file
cat $inventory_dashboards >> $inventory_file
cat $inventory_common >> $inventory_file

- name: Execute provision playbook
run: |
INSTALL_DEPS=true
Expand All @@ -218,14 +224,14 @@ jobs:
-e "install_python=$INSTALL_PYTHON" \
-e "install_pip_deps=$INSTALL_PIP_DEPS" \
"${{ inputs.VERBOSITY }}"

- name: Execute certificates generation playbook
run: |
ANSIBLE_STDOUT_CALLBACK=$ANSIBLE_CALLBACK ansible-playbook .github/workflows/ansible-playbooks/distributed_generate_certificates.yml \
-i $ALLOCATOR_PATH/inventory \
-e "resources_path=$RESOURCES_PATH" \
"${{ inputs.VERBOSITY }}"

- name: Copy certificates to nodes
run: |
ANSIBLE_STDOUT_CALLBACK=$ANSIBLE_CALLBACK ansible-playbook .github/workflows/ansible-playbooks/distributed_copy_certificates.yml \
Expand All @@ -243,7 +249,7 @@ jobs:
-e "tmp_path=$TMP_PATH" \
-e "pkg_repository=$PKG_REPOSITORY" \
"${{ inputs.VERBOSITY }}"

- name: Execute indexer cluster start playbook
run: |
INDEXER_ADMIN_PASSWORD="admin"
Expand All @@ -253,7 +259,7 @@ jobs:
-e "tmp_path=$TMP_PATH" \
-e "pkg_repository=$PKG_REPOSITORY" \
"${{ inputs.VERBOSITY }}"

- name: Execute server installation playbook
run: |
ANSIBLE_STDOUT_CALLBACK=$ANSIBLE_CALLBACK ansible-playbook .github/workflows/ansible-playbooks/distributed_install_wazuh.yml \
Expand All @@ -262,7 +268,7 @@ jobs:
-e "tmp_path=$TMP_PATH" \
-e "pkg_repository=$PKG_REPOSITORY" \
"${{ inputs.VERBOSITY }}"

- name: Execute dashboard installation playbook
run: |
ANSIBLE_STDOUT_CALLBACK=$ANSIBLE_CALLBACK ansible-playbook .github/workflows/ansible-playbooks/distributed_install_dashboard.yml \
Expand All @@ -271,7 +277,7 @@ jobs:
-e "tmp_path=$TMP_PATH" \
-e "pkg_repository=$PKG_REPOSITORY" \
"${{ inputs.VERBOSITY }}"

- name: Execute Python test playbook
run: |
ANSIBLE_STDOUT_CALLBACK=$ANSIBLE_CALLBACK ansible-playbook .github/workflows/ansible-playbooks/distributed_tests.yml \
Expand All @@ -280,13 +286,13 @@ jobs:
-e "tmp_path=$TMP_PATH" \
-e "test_name=$TEST_NAME" \
"${{ inputs.VERBOSITY }}"

- name: Compress Allocator VM directory
id: compress_allocator_files
if: always() && steps.allocator_instance.outcome == 'success' && inputs.DESTROY == false
run: |
zip -P "${{ secrets.ZIP_ARTIFACTS_PASSWORD }}" -r $ALLOCATOR_PATH.zip $ALLOCATOR_PATH

- name: Upload Allocator VM directory as artifact
if: always() && steps.compress_allocator_files.outcome == 'success' && inputs.DESTROY == false
uses: actions/upload-artifact@v4
Expand All @@ -298,13 +304,13 @@ jobs:
if: always() && steps.allocator_instance.outcome == 'success' && inputs.DESTROY == true
run: |
instance_names=($INSTANCE_NAMES)

for i in ${!instance_names[@]}; do
instance_name=${instance_names[$i]}
track_file="$ALLOCATOR_PATH/track_${instance_name}.yml"

echo "Deleting instance: $instance_name using track file $track_file"

(
# Delete instance
python3 wazuh-automation/deployability/modules/allocation/main.py \
Expand Down
136 changes: 136 additions & 0 deletions .github/workflows/builder_installation_assistant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
run-name: Build Installation Assistant ${{ inputs.id }} - Branch ${{ github.ref_name }} - Launched by @${{ github.actor }}
name: Build Installation Assistant

on:
workflow_dispatch:
inputs:
wazuh_installation_assistant_reference:
description: "Branch or tag of the wazuh-installation-assistant repository."
required: true
default: 4.10.2
is_stage:
description: "Is stage?"
type: boolean
default: false
checksum:
description: "Add checksum"
type: boolean
default: false
id:
description: "ID used to identify the workflow uniquely."
type: string
required: false
workflow_call:
inputs:
wazuh_installation_assistant_reference:
description: "Branch or tag of the wazuh-installation-assistant repository."
type: string
required: true
default: 4.10.2
is_stage:
description: "Is stage?"
type: boolean
default: false
checksum:
description: "Add checksum"
type: boolean
default: false
id:
type: string
required: false

env:
S3_BUCKET: ${{ vars.AWS_S3_BUCKET }}
S3_REPOSITORY_PATH: "development/wazuh/4.x/secondary/installation-assistant"
BUILDER_PATH: "builder.sh"
WAZUH_INSTALL_NAME: "wazuh-install"
WAZUH_CERT_TOOL_NAME: "wazuh-certs-tool"
WAZUH_PASSWORD_TOOL_NAME: "wazuh-passwords-tool"

permissions:
id-token: write
contents: read

jobs:
Build_Installation_Assistant:
runs-on: ubuntu-latest

steps:
- name: View parameters
run: echo "${{ toJson(inputs) }}"

- name: Checkout wazuh-installation-assistant repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.wazuh_installation_assistant_reference }}

- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_IAM_ROLE }}
aws-region: us-east-1

- name: Get short sha and wazuh version
run: |
COMMIT_SHORT_SHA=$(git rev-parse --short ${{ github.sha }})
WAZUH_VERSION=$(grep -oP '(?<=readonly wazuh_version=").*(?=")' ${{github.workspace}}/install_functions/installVariables.sh)
echo "WAZUH_VERSION=$WAZUH_VERSION" >> $GITHUB_ENV
echo "COMMIT_SHORT_SHA=$COMMIT_SHORT_SHA" >> $GITHUB_ENV

- name: Change files name for stage build
if: ${{ inputs.is_stage == false }}
run: |
sed -i 's|${{ env.WAZUH_INSTALL_NAME }}.sh|${{ env.WAZUH_INSTALL_NAME }}-${{ env.COMMIT_SHORT_SHA }}.sh|g' "${{ env.BUILDER_PATH }}"
sed -i 's|${{ env.WAZUH_CERT_TOOL_NAME }}.sh|${{ env.WAZUH_CERT_TOOL_NAME }}-${{ env.COMMIT_SHORT_SHA }}.sh|g' "${{ env.BUILDER_PATH }}"
sed -i 's|${{ env.WAZUH_PASSWORD_TOOL_NAME }}.sh|${{ env.WAZUH_PASSWORD_TOOL_NAME }}-${{ env.COMMIT_SHORT_SHA }}.sh|g' "${{ env.BUILDER_PATH }}"

- name: Build Installation Assistant packages
run: bash builder.sh -i -c -p

- name: Save files name
run: |
WAZUH_INSTALL_NAME=$(ls ${{ github.workspace }}/${{ env.WAZUH_INSTALL_NAME }}*.sh | xargs basename)
WAZUH_CERT_TOOL_NAME=$(ls ${{ github.workspace }}/${{ env.WAZUH_CERT_TOOL_NAME }}*.sh | xargs basename)
WAZUH_PASSWORD_TOOL_NAME=$(ls ${{ github.workspace }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }}*.sh | xargs basename)
echo "WAZUH_INSTALL_NAME=$WAZUH_INSTALL_NAME" >> $GITHUB_ENV
echo "WAZUH_CERT_TOOL_NAME=$WAZUH_CERT_TOOL_NAME" >> $GITHUB_ENV
echo "WAZUH_PASSWORD_TOOL_NAME=$WAZUH_PASSWORD_TOOL_NAME" >> $GITHUB_ENV

- name: Prepare files
run: |
mkdir -p ${{ github.workspace }}/${{ env.WAZUH_VERSION }}
mv ${{ env.WAZUH_INSTALL_NAME }} ${{ github.workspace }}/${{ env.WAZUH_VERSION }}
mv ${{ env.WAZUH_CERT_TOOL_NAME }} ${{ github.workspace }}/${{ env.WAZUH_VERSION }}
mv ${{ env.WAZUH_PASSWORD_TOOL_NAME }} ${{ github.workspace }}/${{ env.WAZUH_VERSION }}

- name: Build packages checksum
if: ${{ inputs.checksum == true }}
run: |
sha512sum ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }} > ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }}.sha512
sha512sum ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }} > ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }}.sha512
sha512sum ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }} > ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }}.sha512

- name: Upload files to S3
run: |
aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }} s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/
s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }}"
echo "S3 wazuh-install URI: ${s3uri}"
aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }} s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/
s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }}"
echo "S3 wazuh-certs-tool URI: ${s3uri}"
aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }} s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/
s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }}"
echo "S3 wazuh-passwords-tool URI: ${s3uri}"

- name: Upload checksum files to S3
if: ${{ inputs.checksum == true }}
run: |
aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }}.sha512 s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/
s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }}.sha512"
echo "S3 sha512 wazuh-install checksum URI: ${s3uri}"
aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }}.sha512 s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/
s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }}.sha512"
echo "S3 sha512 wazuh-certs-tool checksum URI: ${s3uri}"
aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }}.sha512 s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/
s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }}.sha512"
echo "S3 sha512 wazuh-passwords-tool checksum URI: ${s3uri}"
Loading
Loading