Skip to content

Wazuh Puppet v4.5.3 #1426

Wazuh Puppet v4.5.3

Wazuh Puppet v4.5.3 #1426

Workflow file for this run

name: Kitchen tests for Wazuh Puppet
on: [pull_request, workflow_dispatch, release]
jobs:
validate-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Create enviroment variables
run: |
cat VERSION >> $GITHUB_ENV
VER=`curl -s https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\1/' | cut -c 2-`
WAZUH_VERSION=$VER >> $GITHUB_ENV
- name: Install Puppet
uses: ./.github/debian_install
- name: Download and Install pdk
run: |
wget https://apt.puppet.com/puppet-tools-release-focal.deb
sudo dpkg -i puppet-tools-release-focal.deb
sudo apt-get update
sudo apt-get install pdk
- name: Compare versions
run: |
function compare_versions() {
operator="${2}"
echo $operator
if [ $operator == "-gt" ]; then
test "$(echo "$1" "$3" | tr " " "\n" | sort -V | head -n 1)" != "$1";
elif [ $operator == "-le" ]; then
test "$(echo "$1" "$3" | tr " " "\n" | sort -V | head -n 1)" == "$1";
elif [ $operator == "-lt" ]; then
test "$(echo "$1" "$3" | tr " " "\n" | sort -rV | head -n 1)" != "$1";
elif [ $operator == "-ge" ]; then
test "$(echo "$1" "$3" | tr " " "\n" | sort -rV | head -n 1)" == "$1";
else
echo "Operator not supported"
exit 1
fi
}
if compare_versions "{{ env.VERSION }}" -gt "{{ env.WAZUH_VERSION }}"; then
sed -i 's/packages.wazuh.com/packages-dev.wazuh.com/' manifests/repo.pp
sed -i 's/4.x/pre-release/' manifests/repo.pp
sed -i "s/'stable'/'unstable'/" manifests/repo.pp
fi
- name: Create Puppet module
run: pdk build
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: wazuh-module
path: ./pkg/wazuh-wazuh-${{ env.VERSION }}.tar.gz
#-------------------------------------------------------------------------------
ubuntu20:
runs-on: ubuntu-20.04
needs: validate-and-build
steps:
- uses: actions/checkout@v2
- name: Create enviroment variables
run: |
cat VERSION >> $GITHUB_ENV
VER=`curl -s https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\1/' | cut -c 2-`
WAZUH_VERSION=$VER >> $GITHUB_ENV
- name: Install Puppet
uses: ./.github/debian_install
- name: Configure Puppet server
uses: ./.github/configure
- name: Retrieve saved Wazuh module
uses: actions/download-artifact@v3
with:
name: wazuh-module
- name: Install Wazuh Module
run: |
sudo puppet module install ./wazuh-wazuh-${{ env.VERSION }}.tar.gz
- name: Install Wazuh Stack
uses: ./.github/install_stack
- name: Test stack
uses: ./.github/tests
#-------------------------------------------------------------------------------
ubuntu22:
runs-on: ubuntu-22.04
needs: validate-and-build
steps:
- uses: actions/checkout@v2
- name: Create enviroment variables
run: |
cat VERSION >> $GITHUB_ENV
VER=`curl -s https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\1/' | cut -c 2-`
WAZUH_VERSION=$VER >> $GITHUB_ENV
- name: Install Puppet
uses: ./.github/debian_install
- name: Configure Puppet server
uses: ./.github/configure
- name: Retrieve saved Wazuh module
uses: actions/download-artifact@v3
with:
name: wazuh-module
- name: Install Wazuh Module
run: |
sudo puppet module install ./wazuh-wazuh-${{ env.VERSION }}.tar.gz
- name: Install Wazuh Stack
uses: ./.github/install_stack
- name: Test stack
uses: ./.github/tests