Skip to content

feat(mdm): require BitLocker per Windows host on Fleet Free CU-17tkuw6a8db #657

feat(mdm): require BitLocker per Windows host on Fleet Free CU-17tkuw6a8db

feat(mdm): require BitLocker per Windows host on Fleet Free CU-17tkuw6a8db #657

Workflow file for this run

name: Fleet Test
# =============================================================================
# WORKFLOW CONFIGURATION
# =============================================================================
permissions:
contents: read
actions: write
pull-requests: write
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [main]
merge_group:
concurrency:
group: pr-${{ github.head_ref || github.ref }}
cancel-in-progress: false
env:
REGISTRY: ghcr.io
BINARY_NAME: fleet
# =============================================================================
# JOBS
# =============================================================================
jobs:
changes:
name: Detect Changes
uses: ./.github/workflows/changes.yaml
if: |
github.event_name == 'merge_group' ||
github.event_name == 'pull_request' &&
!github.event.pull_request.draft
scan:
name: "Scan Code"
runs-on: ubuntu-latest
needs: [changes]
permissions:
contents: read
packages: read
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Scan code
continue-on-error: true
uses: ./.github/steps/trivy
with:
scan: code
test_client:
name: "Test Client (${{ matrix.name }})"
needs: [changes]
runs-on: ${{ matrix.os }}
if: fromJSON(needs.changes.outputs.changes || '{}').client == 'true' # draft gate inherited from changes
strategy:
matrix:
include: ${{ fromJson(needs.changes.outputs.clients_matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run Go tests
continue-on-error: true
run: go test -race -coverprofile=coverage.out ./orbit/...
- name: Compile Client for ${{ matrix.go_os }}
shell: bash
run: |
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
rm -rf ./build_target
mkdir -p ./build_target
architectures=($(echo '${{ toJSON(matrix.go_arch) }}' | jq -r '.[]'))
for arch in "${architectures[@]}"; do
echo "Building for ${{ matrix.go_os }}/${arch}"
env GOARCH=${arch} go build -o ./build_target/client-mac-${arch} ./orbit/cmd/orbit
done
ls -la ./build_target
echo "Create ${{ matrix.artifact_name }}"
mkdir -p ./artifacts
arch0=${architectures[0]}
arch1=${architectures[1]}
lipo -create ./build_target/client-mac-${arch0} ./build_target/client-mac-${arch1} -output ./artifacts/${{ env.BINARY_NAME }}
lipo -info ./artifacts/${{ env.BINARY_NAME }}
ls -la ./artifacts
rm -rf ./build_target
elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then
mkdir -p ./artifacts
env GOARCH=${{ matrix.go_arch }} go build -o ./artifacts/${{ env.BINARY_NAME }}.exe ./orbit/cmd/orbit
ls -la ./artifacts
fi
# Merge queue only builds; packages are signed and uploaded per PR.
- name: Sign MacOS package
if: runner.os == 'macOS' && github.event_name == 'pull_request'
uses: ./.github/steps/sign-macos-package
with:
apple_certificate_p12: ${{ secrets.APPLE_CERTIFICATE_P12 }}
apple_certificate_password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
apple_developer_id: ${{ secrets.APPLE_DEVELOPER_ID }}
apple_id_username: ${{ secrets.APPLE_ID_USERNAME }}
apple_id_password: ${{ secrets.APPLE_ID_PASSWORD }}
apple_team_id: ${{ secrets.APPLE_TEAM_ID }}
binary_name: ${{ env.BINARY_NAME }}
- name: Upload client artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}-test
path: artifacts/
if-no-files-found: warn
retention-days: 1
compression-level: 9
test:
name: "Test Server"
needs: [changes]
runs-on: ubuntu-latest
if: fromJSON(needs.changes.outputs.changes || '{}').server == 'true' || fromJSON(needs.changes.outputs.changes || '{}').trivy == 'true' # draft gate inherited from changes
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: package.json
- name: Install JS Dependencies
run: for i in 1 2 3; do make deps-js && break || sleep 15; done
- name: Install ARM64 cross-compiler
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
install-only: true
- name: Test OpenFrame configuration and schema endpoint retirement
run: go test -race ./server/config ./server/service ./cmd/fleet -run 'Test(OpenframeConfig|OpenframeOsquerySchemaRoute)' -count=1
# The tag release.yml builds from. Without it the snapshot stamps fleet v0.0.0-untagged and
# Trivy matches every upstream fleet advisory against it.
- name: Create local tag
run: git tag -f v9.9.9
- name: Build with GoReleaser
env:
REGISTRY: ${{ env.REGISTRY }}
GITHUB_REPOSITORY: ${{ github.repository }}
DOCKER_PUSH: "false"
DOCKER_TAG: test
run: goreleaser release --snapshot --clean --skip=publish
# The amd64 image GoReleaser just built and loaded (fleet-amd64 in .goreleaser.yml), so no
# second build. A fixable HIGH/CRITICAL finding fails the job and All Checks goes red.
- name: Scan image
uses: ./.github/steps/trivy
with:
name: fleet
image: ${{ env.REGISTRY }}/${{ github.repository }}/fleet:test-amd64
test_helm:
name: "Test Helm Chart"
needs: [changes]
runs-on: ubuntu-latest
if: fromJSON(needs.changes.outputs.changes || '{}').helm == 'true' # draft gate inherited from changes
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
# Disabled: covered by "Flamingo Code Review / tests and checks" (helm lint . on a changed chart). Kept here, not deleted: the repository variable FLAMINGO_LEGACY_CHECKS=on runs it again. CU-17tkuw60a9u
- name: Helm Lint
if: vars.FLAMINGO_LEGACY_CHECKS == 'on'
run: helm lint charts/fleet
- name: Helm Template
run: helm template fleet charts/fleet
all-checks:
name: "All Checks"
needs: [changes, test_client, test, test_helm]
runs-on: ubuntu-latest
if: always()
steps:
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1
- run: echo "All checks passed"