-
Notifications
You must be signed in to change notification settings - Fork 98
102 lines (94 loc) · 4.37 KB
/
test-install-rpm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Test install Wazuh agent and manager - RPM
on:
pull_request:
paths:
- 'rpms/SPECS/*'
- 'rpms/generate_rpm_package.sh'
workflow_dispatch:
workflow_call:
jobs:
Wait-for-package-building:
runs-on: ubuntu-latest
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'
- name: Wait for the package to be built
uses: ArcticLampyrid/[email protected]
id: wait-for-build
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build-rpm-packages.yml
sha: ${{ github.event.pull_request.head.sha || github.sha }}
wait-interval: 60
Test-install-rpm-systems:
needs: Wait-for-package-building
runs-on: ubuntu-latest
strategy:
matrix:
system:
- {NAME: 'oraclelinux:9', ARCH: "x86_64"}
- {NAME: 'almalinux:9', ARCH: "x86_64"}
- {NAME: 'rockylinux:9', ARCH: "x86_64"}
- {NAME: 'centos:7', ARCH: "x86_64"}
- {NAME: 'centos:8', ARCH: "x86_64"}
- {NAME: 'i386/centos:7', ARCH: "i386"}
- {NAME: 'redhat/ubi8:latest', ARCH: "x86_64"}
- {NAME: 'redhat/ubi9:latest', ARCH: "x86_64"}
- {NAME: 'amazonlinux:2', ARCH: "x86_64"}
- {NAME: 'fedora:34', ARCH: "x86_64"}
- {NAME: 'centos:6.9', ARCH: "x86_64", INIT: "initd"}
type: [agent, manager]
exclude:
- system: {ARCH: "i386"}
type: manager
- system: {INIT: "initd"}
type: manager
fail-fast: false
steps:
- 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_x86_64:
- 'rpms/CentOS/6/x86_64/**'
- 'rpms/CentOS/7/x86_64/**'
- 'rpms/build.sh'
rpm_packages:
- 'rpms/SPECS/**'
- 'rpms/generate_rpm_package.sh'
- name: Setup directories and variables
if : steps.changes.outputs.rpm_packages == 'true' || (steps.changes.outputs.rpm_images_agent_i386 == 'true' && matrix.ARCHITECTURE == 'i386') || (steps.changes.outputs.rpm_images_x86_64 == 'true' && matrix.ARCHITECTURE == 'x86_64')
run: |
VERSION=$(cat $GITHUB_WORKSPACE/VERSION)
REVISION=$( echo ${{ github.head_ref }} | sed 's/-/./g; s/\//./g' )
echo "PACKAGE_NAME=wazuh-${{ matrix.type }}-${VERSION}-${REVISION}.${{matrix.system.ARCH}}.rpm" >> $GITHUB_ENV
- name: Download the Wazuh ${{ matrix.type }} package for ${{ matrix.system.NAME }}
if : steps.changes.outputs.rpm_packages == 'true' || (steps.changes.outputs.rpm_images_agent_i386 == 'true' && matrix.ARCHITECTURE == 'i386') || (steps.changes.outputs.rpm_images_x86_64 == 'true' && matrix.ARCHITECTURE == 'x86_64')
id: download-artifact
continue-on-error: true
uses: dawidd6/action-download-artifact@v2
with:
workflow: build-rpm-packages.yml
workflow_conclusion: success
name: ${{env.PACKAGE_NAME}}
if_no_artifact_found: fail
- name: Move the Wazuh ${{ matrix.type }} package for ${{ matrix.system.NAME }} to the packages directory
if : steps.changes.outputs.rpm_packages == 'true' || (steps.changes.outputs.rpm_images_agent_i386 == 'true' && matrix.ARCHITECTURE == 'i386') || (steps.changes.outputs.rpm_images_x86_64 == 'true' && matrix.ARCHITECTURE == 'x86_64')
run: |
mkdir $GITHUB_WORKSPACE/packages
mv ${{env.PACKAGE_NAME}} $GITHUB_WORKSPACE/packages
- name: Launch docker
if : steps.changes.outputs.rpm_packages == 'true' || (steps.changes.outputs.rpm_images_agent_i386 == 'true' && matrix.ARCHITECTURE == 'i386') || (steps.changes.outputs.rpm_images_x86_64 == 'true' && matrix.ARCHITECTURE == 'x86_64')
run: sudo docker run -v $GITHUB_WORKSPACE/.github/actions/test-install-components/:/tests -v $GITHUB_WORKSPACE/packages/:/packages ${{ matrix.system.NAME }} bash /tests/install_component.sh $PACKAGE_NAME ${{ matrix.type }}