fleet/.github/workflows/fleetctl-preview.yml
Lucas Manuel Rodriguez 4627a92447
Move external dependency osquery-in-a-box to monorepo (#15871)
#15563 

- [X] Manual QA for all new/changed functionality

Tested by running the following:

If the changes haven't been merged to `main`:
```sh
fleetctl preview --preview-config 15563-move-external-dep-osquery-in-a-box-to-monorepo
fleetctl preview stop
fleetctl preview reset
```
If the changes were already merged to `main`:
```sh
fleetctl preview 
fleetctl preview stop
fleetctl preview reset
```
2024-01-10 11:45:52 -03:00

60 lines
1.9 KiB
YAML

# Tests the `fleetctl preview` command with latest npm released version of fleetctl.
name: Test fleetctl preview
on:
workflow_dispatch: # Manual
schedule:
- cron: '0 2 * * *' # Nightly 2AM UTC
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id}}
cancel-in-progress: true
permissions:
contents: read
jobs:
test-preview:
timeout-minutes: 60
strategy:
matrix:
# Only run on Linux because:
# - Linux Docker containers are not supported in Windows.
# - Unattended installation of Docker on macOS fails. (see
# https://github.com/docker/for-mac/issues/6450)
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- name: Test fleetctl preview
run: |
npm install -g fleetctl
fleetctl preview
sleep 10
fleetctl get hosts | tee hosts.txt
[ $( cat hosts.txt | grep online | wc -l) -eq 9 ]
shell: bash
- name: Get fleet logs
if: always()
run: |
FLEET_LICENSE_KEY=foo docker compose -f ~/.fleet/preview/docker-compose.yml logs fleet01 fleet02 > fleet-logs.txt
# Copying logs, otherwise the upload-artifact action uploads the logs in a hidden folder (.fleet)
# Old location of orbit logs before v4.43.0
cp ~/.fleet/preview/orbit.log orbit.log || true
# New location of orbit logs since v4.43.0
cp ~/.fleet/preview/orbit/orbit.log orbit.log || true
cp -r ~/.fleet/preview/logs osquery_result_status_logs
shell: bash
- name: Upload logs
if: always()
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v2
with:
name: ${{ matrix.os }}-log
path: |
fleet-logs.txt
orbit.log
osquery_result_status_logs