|
| 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 |
0 commit comments