Add profiles workflow for canary team (#10966)

This commit is contained in:
Luke Heath 2023-04-04 15:51:07 -05:00 committed by GitHub
parent 337d61c823
commit bfaa8043bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,68 @@
# This workflow applies the latest MDM profiles to the workstations team.
# It uses a fleet instance also built and executed from source.
#
# It runs automatically when a file is changed in /mdm_profiles.
name: Apply latest MDM profiles (Canary)
on:
push:
branches:
- main
paths:
- 'mdm_profiles/**.mobileconfig'
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
env:
DOGFOOD_API_TOKEN: ${{ secrets.DOGFOOD_API_TOKEN }}
DOGFOOD_URL: ${{ secrets.DOGFOOD_URL }}
CLOUD_MANAGEMENT_ENROLLMENT_TOKEN: ${{ secrets.CLOUD_MANAGEMENT_ENROLLMENT_TOKEN }}
jobs:
apply-profiles:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
with:
repository: fleetdm/fleet
- name: Install fleetctl
run: npm install -g fleetctl
- name: Configure fleetctl
run: fleetctl config set --address $DOGFOOD_URL --token $DOGFOOD_API_TOKEN
- name: Run fleetctl apply
run: |
profiles=""
for file in mdm_profiles/*.mobileconfig; do
envsubst < "$file" > "${file}.new"
mv "${file}.new" "$file"
profiles+="- $file
"
done
echo "apiVersion: v1
kind: team
spec:
team:
name: 💻🐣 Workstations (canary)
mdm:
macos_settings:
custom_settings:
$profiles
" > team-workstations-config.yml
fleetctl apply -f team-workstations-config.yml