Skip to content

Commit 54d2b33

Browse files
authored
Merge branch '4.9.0' into ci/155-upload-packages-to-s3
Signed-off-by: Álex Ruiz <[email protected]>
2 parents a85db14 + ad95578 commit 54d2b33

File tree

9 files changed

+114
-13
lines changed

9 files changed

+114
-13
lines changed

.github/workflows/build.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
push:
77
# Sequence of patterns matched against refs/heads
88
branches:
9-
- 'ci/*'
9+
- "ci/*"
1010
workflow_dispatch:
1111
inputs:
1212
revision:
@@ -40,7 +40,7 @@ jobs:
4040
uses: ./.github/workflows/r_commit_sha.yml
4141

4242
build:
43-
needs: [ version, commit_sha ]
43+
needs: [version, commit_sha]
4444
strategy:
4545
matrix:
4646
distribution: [tar, rpm, deb]
@@ -69,15 +69,21 @@ jobs:
6969
distribution: ${{ matrix.distribution }}
7070
min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }}
7171

72-
upload:
72+
test:
7373
needs: [version, commit_sha, assemble]
74-
# Upload only on 'workflow_dispatch' event and if 'upload=true'
75-
if: ${{ github.event_name == 'push' && inputs.upload }}
7674
strategy:
7775
fail-fast: false
7876
matrix:
7977
os: [{ suffix: "amd64", ext: "deb" }, { suffix: "x86_64", ext: "rpm" }]
78+
uses: ./.github/workflows/r_test.yml
79+
with:
80+
package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}_${{ matrix.os.suffix }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.os.ext }}
81+
82+
upload:
83+
needs: [version, commit_sha, test]
84+
# Upload only on 'workflow_dispatch' event and if 'upload=true'
85+
if: ${{ github.event_name == 'push' && inputs.upload }}
8086
uses: ./.github/workflows/r_upload.yml
8187
with:
8288
package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}_${{ matrix.os.suffix }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.os.ext }}
83-
secrets: inherit
89+
secrets: inherit

.github/workflows/r_assemble.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Assemble (reusable)
22

3+
env:
4+
TEST: true
5+
36
# This workflow runs when any of the following occur:
47
# - Run from another workflow
58
on:

.github/workflows/r_build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
java-version: 11
4141

4242
- name: Setup Gradle
43-
uses: gradle/[email protected]
43+
uses: gradle/actions/setup-gradle@v3
4444

4545
- name: Run `build.sh`
4646
run: |

.github/workflows/r_test.yml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Test (reusable)
2+
3+
# This workflow runs when any of the following occur:
4+
# - Run from another workflow
5+
on:
6+
workflow_call:
7+
inputs:
8+
package:
9+
description: "The name of the package to download."
10+
required: true
11+
type: string
12+
13+
jobs:
14+
r_test_rpm:
15+
if: ${{ endsWith(inputs.package, 'rpm') }}
16+
runs-on: ubuntu-latest
17+
# Permissions to upload the package
18+
permissions:
19+
packages: read
20+
contents: read
21+
steps:
22+
- name: Download artifact
23+
uses: actions/download-artifact@v4
24+
with:
25+
name: ${{ inputs.package }}
26+
path: artifacts/dist
27+
28+
- name: Install package
29+
uses: addnab/docker-run-action@v3
30+
with:
31+
image: redhat/ubi9:latest
32+
options: -v ${{ github.workspace }}/artifacts/dist:/artifacts/dist
33+
run: |
34+
yum localinstall "/artifacts/dist/${{ inputs.package }}" -y
35+
36+
r_test_deb:
37+
if: ${{ endsWith(inputs.package, 'deb') }}
38+
runs-on: ubuntu-latest
39+
# Permissions to upload the package
40+
permissions:
41+
packages: read
42+
contents: read
43+
steps:
44+
- name: Download artifact
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: ${{ inputs.package }}
48+
path: artifacts/dist
49+
50+
- name: Install package
51+
run: |
52+
sudo dpkg -i "artifacts/dist/${{ inputs.package }}"
53+
54+
- uses: actions/checkout@v4
55+
- name: Generate and deploy certificates
56+
uses: addnab/docker-run-action@v3
57+
with:
58+
image: wazuh/wazuh-certs-generator:0.0.1
59+
options: -v ${{ github.workspace }}/integrations/docker/config/certs.yml:/config/certs.yml -v /etc/wazuh-indexer/certs:/certs
60+
shell: sh
61+
run: |
62+
mkdir -p /certificates /certs
63+
/entrypoint.sh
64+
chown -R 1000:999 /certificates
65+
chmod 740 /certificates
66+
chmod 440 /certificates/*
67+
68+
mv /certificates/wazuh.indexer-key.pem /certs/indexer-key.pem
69+
mv /certificates/wazuh.indexer.pem /certs/indexer.pem
70+
mv /certificates/root-ca.pem /certs/root-ca.pem
71+
ls /certs
72+
73+
- run: sudo systemctl daemon-reload
74+
- run: |
75+
if ! sudo systemctl enable wazuh-indexer.service; then
76+
sudo journalctl --no-pager -u wazuh-indexer.service
77+
exit 1
78+
fi
79+
- run: |
80+
if ! sudo systemctl start wazuh-indexer; then
81+
sudo journalctl --no-pager -u wazuh-indexer.service
82+
exit 1
83+
fi
84+
- run: |
85+
if ! sudo systemctl status --no-pager wazuh-indexer -n 100; then
86+
sudo journalctl --no-pager -u wazuh-indexer.service
87+
exit 1
88+
fi

ecs/vulnerability-detector/event-generator/event_generator.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ def generate_random_wazuh():
176176
},
177177
'manager': {
178178
'name': f'wazuh-manager-{random.randint(0,10)}'
179+
},
180+
'schema': {
181+
'version': '1.7.0'
179182
}
180183
}
181184
return wazuh
@@ -187,7 +190,7 @@ def generate_random_data(number):
187190
event_data = {
188191
'@timestamp': generate_random_date(),
189192
'agent': generate_random_agent(),
190-
'ecs': {'version': '1.7.0'},
193+
# 'ecs': {'version': '1.7.0'},
191194
# 'event': generate_random_event(),
192195
'host': generate_random_host(),
193196
# 'labels': generate_random_labels(),

ecs/vulnerability-detector/fields/custom/wazuh.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@
1818
type: keyword
1919
level: custom
2020
description: >
21-
Wazuh manager name. Used by dashboards to filter results on single node deployments.
21+
Wazuh manager name. Used by dashboards to filter results on single node deployments.
22+
- name: schema.version
23+
type: keyword
24+
level: custom
25+
description: >
26+
Wazuh schema version.

ecs/vulnerability-detector/fields/subset.yml

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ fields:
88
message: ""
99
agent:
1010
fields: "*"
11-
ecs:
12-
fields: "*"
1311
package:
1412
fields: "*"
1513
host:

ecs/vulnerability-detector/fields/template-settings-legacy.json

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"query.default_field": [
1818
"base.tags",
1919
"agent.id",
20-
"ecs.version",
2120
"host.os.family",
2221
"host.os.full.text",
2322
"host.os.version",

ecs/vulnerability-detector/fields/template-settings.json

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"query.default_field": [
1919
"base.tags",
2020
"agent.id",
21-
"ecs.version",
2221
"host.os.family",
2322
"host.os.full.text",
2423
"host.os.version",

0 commit comments

Comments
 (0)