mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
4627a92447
#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 ```
100 lines
3.2 KiB
YAML
100 lines
3.2 KiB
YAML
name: Test latest changes in fleetctl preview
|
|
|
|
# Tests the `fleetctl preview` command with latest changes in fleetctl and
|
|
# docs/01-Using-Fleet/standard-query-library/standard-query-library.yml
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- patch-*
|
|
- prepare-*
|
|
paths:
|
|
- 'cmd/fleetctl/**.go'
|
|
- 'pkg/**.go'
|
|
- 'server/service/**.go'
|
|
- 'server/context/**.go'
|
|
- 'orbit/**.go'
|
|
- 'ee/fleetctl/**.go'
|
|
- 'docs/01-Using-Fleet/standard-query-library/standard-query-library.yml'
|
|
- 'tools/osquery/in-a-box'
|
|
pull_request:
|
|
paths:
|
|
- 'cmd/fleetctl/**.go'
|
|
- 'pkg/**.go'
|
|
- 'server/service/**.go'
|
|
- 'server/context/**.go'
|
|
- 'orbit/**.go'
|
|
- 'ee/fleetctl/**.go'
|
|
- 'docs/01-Using-Fleet/standard-query-library/standard-query-library.yml'
|
|
- 'tools/osquery/in-a-box'
|
|
workflow_dispatch: # Manual
|
|
|
|
# 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
|
|
|
|
defaults:
|
|
run:
|
|
# fail-fast using bash -eo pipefail. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
|
|
shell: bash
|
|
|
|
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-latest]
|
|
go-version: ['${{ vars.GO_VERSION }}']
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- name: Checkout Code
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
|
|
- name: Build Fleetctl
|
|
run: make fleetctl
|
|
|
|
- name: Run fleetctl preview
|
|
run: |
|
|
./build/fleetctl preview \
|
|
--preview-config-path ./tools/osquery/in-a-box \
|
|
--std-query-lib-file-path $(pwd)/docs/01-Using-Fleet/standard-query-library/standard-query-library.yml
|
|
sleep 10
|
|
./build/fleetctl get hosts | tee hosts.txt
|
|
[ $( cat hosts.txt | grep online | wc -l) -eq 9 ]
|
|
|
|
- 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
|
|
|
|
- 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
|