forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Attemtp to automate package's testing * Fix typo * Add sudo * Split test steps and manage errors * Add --no-pager to journalctl * Add certs generator * Improve error handling * Update r_test.yml Fix indentation Signed-off-by: Álex Ruiz <[email protected]> * Fix error handling * Add testing of RPM packages * Improve multi-os testing * Add TEST env var * Add braces to if conditionals * Remove all curly braches from if conditionals * braces again * Install RPM package in Docker * Remove sudo for RPM installation * Bind artifacts/dist to RPM docker test container * Bind artifacts/dist to RPM docker test container * Avoid prompt during yum install * Fix bind volume --------- Signed-off-by: Álex Ruiz <[email protected]>
- Loading branch information
Showing
3 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Test (reusable) | ||
|
||
# This workflow runs when any of the following occur: | ||
# - Run from another workflow | ||
on: | ||
workflow_call: | ||
inputs: | ||
package: | ||
description: "The name of the package to download." | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
r_test_rpm: | ||
if: ${{ endsWith(inputs.package, 'rpm') }} | ||
runs-on: ubuntu-latest | ||
# Permissions to upload the package | ||
permissions: | ||
packages: read | ||
contents: read | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.package }} | ||
path: artifacts/dist | ||
|
||
- name: Install package | ||
uses: addnab/docker-run-action@v3 | ||
with: | ||
image: redhat/ubi9:latest | ||
options: -v ${{ github.workspace }}/artifacts/dist:/artifacts/dist | ||
run: | | ||
yum localinstall "/artifacts/dist/${{ inputs.package }}" -y | ||
r_test_deb: | ||
if: ${{ endsWith(inputs.package, 'deb') }} | ||
runs-on: ubuntu-latest | ||
# Permissions to upload the package | ||
permissions: | ||
packages: read | ||
contents: read | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.package }} | ||
path: artifacts/dist | ||
|
||
- name: Install package | ||
run: | | ||
sudo dpkg -i "artifacts/dist/${{ inputs.package }}" | ||
- uses: actions/checkout@v4 | ||
- name: Generate and deploy certificates | ||
uses: addnab/docker-run-action@v3 | ||
with: | ||
image: wazuh/wazuh-certs-generator:0.0.1 | ||
options: -v ${{ github.workspace }}/integrations/docker/config/certs.yml:/config/certs.yml -v /etc/wazuh-indexer/certs:/certs | ||
shell: sh | ||
run: | | ||
mkdir -p /certificates /certs | ||
/entrypoint.sh | ||
chown -R 1000:999 /certificates | ||
chmod 740 /certificates | ||
chmod 440 /certificates/* | ||
mv /certificates/wazuh.indexer-key.pem /certs/indexer-key.pem | ||
mv /certificates/wazuh.indexer.pem /certs/indexer.pem | ||
mv /certificates/root-ca.pem /certs/root-ca.pem | ||
ls /certs | ||
- run: sudo systemctl daemon-reload | ||
- run: | | ||
if ! sudo systemctl enable wazuh-indexer.service; then | ||
sudo journalctl --no-pager -u wazuh-indexer.service | ||
exit 1 | ||
fi | ||
- run: | | ||
if ! sudo systemctl start wazuh-indexer; then | ||
sudo journalctl --no-pager -u wazuh-indexer.service | ||
exit 1 | ||
fi | ||
- run: | | ||
if ! sudo systemctl status --no-pager wazuh-indexer -n 100; then | ||
sudo journalctl --no-pager -u wazuh-indexer.service | ||
exit 1 | ||
fi |