Skip to content

Include SCA policy for Alma Linux 9 in SPECS #392

Include SCA policy for Alma Linux 9 in SPECS

Include SCA policy for Alma Linux 9 in SPECS #392

name: Build Wazuh Packages - RPM - x86_64 and i386
on:
pull_request:
paths:
- 'rpms/SPECS/*'
- 'rpms/generate_rpm_package.sh'
workflow_dispatch:
workflow_call:
jobs:
Wazuh-agent-rpm-package-build:
runs-on: ubuntu-latest
strategy:
matrix:
TYPE: [agent, manager]
ARCHITECTURE : [x86_64, i386]
exclude:
- TYPE: manager
ARCHITECTURE: i386
fail-fast: false
steps:
- name: Cancel previous runs
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: 'true'
github_token: ${{ secrets.GITHUB_TOKEN }}
skip_after_successful_duplicate: 'false'
- uses: actions/checkout@v3
- name: Get changed files
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
rpm_images:
- 'rpms/CentOS/**'
- 'rpms/build.sh'
rpm_images_agent_i386:
- 'rpms/CentOS/6/i386/**'
- 'rpms/build.sh'
rpm_images_agent_x86_64:
- 'rpms/CentOS/6/x86_64/**'
- 'rpms/build.sh'
rpm_images_manager_x86_64:
- 'rpms/CentOS/7/x86_64/**'
- 'rpms/build.sh'
rpm_packages:
- 'rpms/SPECS/**'
- 'rpms/generate_rpm_package.sh'
- name: Set tag and container name
if : steps.changes.outputs.rpm_packages == 'true' || (steps.changes.outputs.rpm_images_agent_i386 == 'true' && matrix.ARCHITECTURE == 'i386') || ((steps.changes.outputs.rpm_images_manager_x86_64 == 'true' || steps.changes.outputs.rpm_images_agent_x86_64 == 'true') && matrix.ARCHITECTURE == 'x86_64')
run: |
MAJOR=$(sed 's/\([0-9]*\.[0-9]*\)\.[0-9]*/\1/' $GITHUB_WORKSPACE/VERSION)
if [ "${{ steps.changes.outputs.rpm_images }}" == "true" ]; then echo "TAG=${{ github.head_ref }}" >> $GITHUB_ENV; else echo "TAG=$MAJOR" >> $GITHUB_ENV ; fi
if [ $MAJOR == "4.9" ]; then echo "VERSION=master" >> $GITHUB_ENV ; else echo "VERSION=$(cat $GITHUB_WORKSPACE/VERSION)" >> $GITHUB_ENV; fi
if [ "${{ matrix.ARCHITECTURE }}" == "x86_64" ]; then echo "CONTAINER_NAME=rpm_${{ matrix.TYPE }}_builder_x86" >> $GITHUB_ENV ; else echo "CONTAINER_NAME=rpm_${{ matrix.TYPE }}_builder_${{ matrix.ARCHITECTURE }}" >> $GITHUB_ENV ; fi
- name: Download docker image for package building
if : steps.changes.outputs.rpm_packages == 'true' || (steps.changes.outputs.rpm_images_agent_i386 == 'true' && matrix.ARCHITECTURE == 'i386') || ((steps.changes.outputs.rpm_images_manager_x86_64 == 'true' || steps.changes.outputs.rpm_images_agent_x86_64 == 'true') && matrix.ARCHITECTURE == 'x86_64')
run: |
bash $GITHUB_WORKSPACE/.github/actions/ghcr-pull-and-push/pull_image_from_ghcr.sh ${{ secrets.GITHUB_TOKEN }} ${{ github.actor}} $CONTAINER_NAME ${{ env.TAG }}
- name: Build the ${{ matrix.ARCHITECTURE }} rpm Wazuh ${{ matrix.TYPE }} package
if : steps.changes.outputs.rpm_packages == 'true' || (steps.changes.outputs.rpm_images_agent_i386 == 'true' && matrix.ARCHITECTURE == 'i386') || ((steps.changes.outputs.rpm_images_manager_x86_64 == 'true' || steps.changes.outputs.rpm_images_agent_x86_64 == 'true') && matrix.ARCHITECTURE == 'x86_64')
working-directory: ./rpms
run: |
REVISION=$( echo ${{ github.head_ref }} | sed 's/-/./g; s/\//./g' )
bash generate_rpm_package.sh -b ${{ env.VERSION }} -t ${{ matrix.TYPE }} -a ${{ matrix.ARCHITECTURE }} --dev -j 2 --dont-build-docker --tag ${{ env.TAG }} -r $REVISION
echo "PACKAGE_NAME=$(ls ./output | grep .rpm | head -n 1)" >> $GITHUB_ENV
- name: Upload Wazuh ${{ matrix.TYPE }} ${{ matrix.ARCHITECTURE }} package as artifact
if : steps.changes.outputs.rpm_packages == 'true' || (steps.changes.outputs.rpm_images_agent_i386 == 'true' && matrix.ARCHITECTURE == 'i386') || ((steps.changes.outputs.rpm_images_manager_x86_64 == 'true' || steps.changes.outputs.rpm_images_agent_x86_64 == 'true') && matrix.ARCHITECTURE == 'x86_64')
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{github.workspace}}/rpms/output/${{ env.PACKAGE_NAME }}
if-no-files-found: error