fleet/.github/workflows/fleetctl-preview-latest.yml
Tomas Touceda 71dbb71df4
Update go to 1.19.4 (#8945)
* Update go to 1.19.4

* Comment out failing package test

* Comment out ALL the packaging tests for windows for the moment

* Update go to 1.19.4

* Comment out failing package test

* Comment out ALL the packaging tests for windows for the moment

* Update changelog

* Bump versions

* Update changelog to reflect this being a security release
2022-12-09 11:47:17 -03:00

90 lines
2.8 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
# 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: ['1.19.4']
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f # 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
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
- 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