Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate package's testing #178

Merged
merged 21 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ jobs:
architecture: ${{ matrix.architecture }}
distribution: ${{ matrix.distribution }}
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 }}

test:
needs: [version, commit_sha, assemble]
uses: ./.github/workflows/r_test.yml
with:
package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}_amd64_${{ needs.commit_sha.outputs.commit_sha }}.deb
65 changes: 65 additions & 0 deletions .github/workflows/r_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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:
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
Loading