Skip to content

Commit

Permalink
Merge conlfict are resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
c-bordon committed Nov 4, 2024
1 parent a6c7596 commit 84e9466
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 14 deletions.
143 changes: 143 additions & 0 deletions .github/workflows/Puppet_module_builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
run-name: Puppet module ${{ inputs.is_stage && ' - is stage' || '' }}${{ inputs.checksum && ' - checksum' || '' }} ${{ inputs.id }}
name: Puppet Module Builder

on:
workflow_dispatch:
inputs:
upload:
description: "Upload ?"
type: boolean
default: false
is_stage:
description: "Is stage ?"
type: boolean
default: false
checksum:
description: "Checksum ?"
type: boolean
default: false
wazuh_puppet_reference:
description: "wazuh-puppet reference"
type: string
default: "4.10.0"
required: false
id:
description: "ID used to identify the workflow uniquely."
type: string
required: false
workflow_call:
inputs:
upload:
description: "Upload ?"
type: boolean
default: false
is_stage:
description: "Is stage ?"
type: boolean
default: false
checksum:
description: "Checksum ?"
type: boolean
default: false
wazuh_puppet_reference:
description: "wazuh-puppet reference"
type: string
default: "4.10.0"
required: false
id:
type: string
required: false

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

env:
S3_PATH: "development/wazuh/4.x/secondary/puppet-module/"

jobs:
build_module:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.wazuh_puppet_reference }}

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

- name: Create environment variables for workflow
run: |
PUPPET_MODULE_REPO=$(jq .name ${{ github.workspace }}/metadata.json | sed -e 's|["'\'']||g')
PUPPET_MODULE_VERSION=$(jq .version ${{ github.workspace }}/metadata.json | sed -e 's|["'\'']||g')
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "PUPPET_MODULE_REPO=$PUPPET_MODULE_REPO" >> "$GITHUB_ENV"
echo "PUPPET_MODULE_VERSION=$PUPPET_MODULE_VERSION" >> "$GITHUB_ENV"
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
- name: Install dependencies
run: |
curl -O https://apt.puppet.com/puppet-tools-release-jammy.deb
sudo dpkg -i puppet-tools-release-jammy.deb
sudo apt-get update
sudo apt-get install pdk
pdk set config user.analytics.disabled false --type boolean --force
- name: Modify name for stage build
if: ${{ inputs.is_stage == false }}
run: |
pip install sde
PUPPET_MODULE_VERSION="${PUPPET_MODULE_VERSION}-${{ env.COMMIT_SHORT_SHA}}"
sde version $PUPPET_MODULE_VERSION ${{ github.workspace }}/metadata.json
echo "PUPPET_MODULE_VERSION=$PUPPET_MODULE_VERSION" >> "$GITHUB_ENV"
- name: Build Wazuh Puppet module
run: |
mkdir -p ${{ github.workspace }}/output
pdk build --force --target-dir=${{ github.workspace }}/output/
PUPPET_MODULE_NAME=${{ env.PUPPET_MODULE_REPO }}-${{ env.PUPPET_MODULE_VERSION }}.tar.gz
echo "PUPPET_MODULE_NAME=$PUPPET_MODULE_NAME" >> "$GITHUB_ENV"
- name: Build Wazuh Puppet module checksum
if: ${{ inputs.checksum == true }}
run: |
sha512sum ${{ github.workspace }}/output/${{ env.PUPPET_MODULE_NAME }} > ${{ github.workspace }}/output/${{ env.PUPPET_MODULE_NAME }}.sha512
- name: Create Puppet module artifact
uses: actions/upload-artifact@v4
with:
name: Puppet module artifact
path: ${{ github.workspace }}/output/${{ env.PUPPET_MODULE_NAME }}
retention-days: 1

- name: Create Puppet module checksum artifact
if: ${{ inputs.checksum == true }}
uses: actions/upload-artifact@v4
with:
name: Puppet module checksum artifact
path: ${{ github.workspace }}/output/${{ env.PUPPET_MODULE_NAME }}.sha512
retention-days: 1

- name: Configure aws credentials
if: ${{ inputs.upload == true }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_IAM_PUPPET_ROLE }}
aws-region: "${{ secrets.AWS_REGION }}"

- name: Upload Puppet module to S3
if: ${{ inputs.upload == true }}
run: |
aws s3 cp ${{ github.workspace }}/output/${{ env.PUPPET_MODULE_NAME }} s3://${{ vars.AWS_S3_BUCKET }}/${{ env.S3_PATH }}
s3uri="s3://${{ vars.AWS_S3_BUCKET }}/${{ env.S3_PATH }}/${{ env.PUPPET_MODULE_NAME }}"
echo "S3 URI: ${s3uri}"
- name: Create checksum file and upload
if: ${{ inputs.checksum == true && inputs.upload == true }}
run: |
aws s3 cp ${{ github.workspace }}/output/${{ env.PUPPET_MODULE_NAME }}.sha512 s3://${{ vars.AWS_S3_BUCKET }}/${{ env.S3_PATH }}
s3uri="s3://${{ vars.AWS_S3_BUCKET }}/${{ env.S3_PATH }}/${{ env.PUPPET_MODULE_NAME }}.sha512"
echo "S3 sha512 URI: ${s3uri}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ kitchen/.librarian/
kitchen/.pytest_cache/
kitchen/.*
kitchen/modules/
output/
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
# Change Log
All notable changes to this project will be documented in this file.

## Wazuh Puppet v4.10.0

### Added

- Wazuh Puppet module builder ([#1107](https://github.com/wazuh/wazuh-puppet/pull/1107)) \- (Puppet Module Builder)
- Wazuh Puppet module builder ([#1109](https://github.com/wazuh/wazuh-puppet/pull/1109)) \- (Puppet Module Builder)

### Changed

- Delete API parameters from wazuh.yml template ([#1155](https://github.com/wazuh/wazuh-puppet/pull/1155)) \- (Puppet Module)
- Add URI file after upload ([#1143](https://github.com/wazuh/wazuh-puppet/pull/1143)) \- (Puppet Module Builder)
- Modfy Puppet module builder ([#1113](https://github.com/wazuh/wazuh-puppet/pull/1113)) \- (Puppet Module Builder)

### Fixed

- Changed GitHub Runner OS version to Ubuntu 22.04. ([#1142](https://github.com/wazuh/wazuh-puppet/pull/1142))

### Deleted

- None

## Wazuh Puppet v4.9.2

### Added
Expand Down
2 changes: 1 addition & 1 deletion manifests/indexer.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$indexer_node_max_local_storage_nodes = '1',
$indexer_service = 'wazuh-indexer',
$indexer_package = 'wazuh-indexer',
$indexer_version = '4.10.0',
$indexer_version = '4.10.0-1',
$indexer_fileuser = 'wazuh-indexer',
$indexer_filegroup = 'wazuh-indexer',

Expand Down
3 changes: 0 additions & 3 deletions manifests/manager.pp
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,6 @@


$wazuh_api_cors_allow_credentials = $::wazuh::params_manager::wazuh_api_cors_allow_credentials,
$wazuh_api_cache_enabled = $::wazuh::params_manager::wazuh_api_cache_enabled,

$wazuh_api_cache_time = $::wazuh::params_manager::wazuh_api_cache_time,

$wazuh_api_access_max_login_attempts = $::wazuh::params_manager::wazuh_api_access_max_login_attempts,
$wazuh_api_access_block_time = $::wazuh::params_manager::wazuh_api_access_block_time,
Expand Down
8 changes: 2 additions & 6 deletions manifests/params_manager.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'Linux': {

# Installation
$server_package_version = '4.10.0'
$server_package_version = '4.10.0-1'

$manage_firewall = false

Expand Down Expand Up @@ -314,7 +314,7 @@

#API

$wazuh_api_host = '0.0.0.0'
$wazuh_api_host = ['0.0.0.0']
$wazuh_api_port = '55000'

$wazuh_api_file = undef
Expand All @@ -341,10 +341,6 @@
$wazuh_api_cors_allow_headers = '"*"'
$wazuh_api_cors_allow_credentials = 'no'

# Cache (time in seconds)
$wazuh_api_cache_enabled = 'yes'
$wazuh_api_cache_time = '0.750'

# Access parameters
$wazuh_api_access_max_login_attempts = 5
$wazuh_api_access_block_time = 300
Expand Down
Empty file modified metadata.json
100644 → 100755
Empty file.
4 changes: 0 additions & 4 deletions templates/wazuh_api_yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ cors:
expose_headers: <%= @wazuh_api_cors_expose_headers %>
allow_headers: <%= @wazuh_api_cors_allow_headers %>
allow_credentials: <%= @wazuh_api_cors_allow_credentials %>
# Cache (time in seconds)
cache:
enabled: <%= @wazuh_api_cache_enabled %>
time: <%= @wazuh_api_cache_time %>
# Access parameters
access:
max_login_attempts: <%= @wazuh_api_access_max_login_attempts %>
Expand Down

0 comments on commit 84e9466

Please sign in to comment.