mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 16:39:01 +00:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.0.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...2541b1294d2704b0964813337f33b291d3f8596b) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
96 lines
3.2 KiB
YAML
96 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-*
|
|
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'
|
|
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'
|
|
workflow_dispatch: # Manual
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test-preview:
|
|
timeout-minutes: 60
|
|
strategy:
|
|
matrix:
|
|
# Doesn't work on Windows because Linux Docker containers are not supported.
|
|
os: [ubuntu-latest, macos-latest]
|
|
go-version: ['1.17.9']
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
|
|
# Docker needs to be installed manually on macOS.
|
|
# From https://github.com/docker/for-mac/issues/2359#issuecomment-943131345
|
|
# FIXME: lock Docker version to 4.10.0 as newer versions fail to initialize
|
|
- name: Install Docker
|
|
timeout-minutes: 20
|
|
if: matrix.os == 'macos-latest'
|
|
run: |
|
|
curl -L https://raw.githubusercontent.com/Homebrew/homebrew-cask/c65030146a5cf2070c2499b6c68e2c3495c99731/Casks/docker.rb > docker.rb
|
|
brew install --cask docker.rb
|
|
sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components
|
|
open -a /Applications/Docker.app --args --unattended --accept-license
|
|
echo "Waiting for Docker to start up..."
|
|
while ! /Applications/Docker.app/Contents/Resources/bin/docker info &>/dev/null; do
|
|
sleep 1;
|
|
done
|
|
echo "Docker is ready."
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- name: Checkout Code
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
|
|
|
|
- name: Build Fleetctl
|
|
run: make fleetctl
|
|
|
|
- name: Run fleetctl preview
|
|
shell: bash
|
|
run: |
|
|
./build/fleetctl preview --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 8 ]
|
|
|
|
- name: Get fleet logs
|
|
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)
|
|
cp ~/.fleet/preview/orbit.log orbit.log
|
|
cp -r ~/.fleet/preview/logs osquery_result_status_logs
|
|
shell: bash
|
|
|
|
- name: Upload logs
|
|
if: always()
|
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v2
|
|
with:
|
|
name: ${{ matrix.os }}-log
|
|
path: |
|
|
fleet-logs.txt
|
|
orbit.log
|
|
osquery_result_status_logs
|