|
1 |
| -name: 'Apply latest configuration profiles via Fleet' |
2 |
| -description: 'Applies the latest MDM configuration profiles to a Fleet team' |
3 |
| - |
4 |
| -inputs: |
5 |
| - FLEET_API_TOKEN: |
6 |
| - description: 'Fleet API Token' |
7 |
| - required: true |
8 |
| - FLEET_URL: |
9 |
| - description: 'Fleet URL' |
10 |
| - required: true |
11 |
| - |
12 |
| -runs: |
13 |
| - using: 'composite' |
14 |
| - steps: |
15 |
| - - name: Checkout code |
16 |
| - uses: actions/checkout@v3 |
17 |
| - with: |
18 |
| - repository: ${{ inputs.MDM_CONFIG_REPO }} |
19 |
| - |
20 |
| - - name: Install fleetctl |
21 |
| - run: npm install -g fleetctl |
22 |
| - shell: bash |
23 |
| - |
24 |
| - - name: Configure fleetctl |
25 |
| - run: fleetctl config set --address ${{ inputs.FLEET_URL }} --token ${{ inputs.FLEET_API_TOKEN }} |
26 |
| - shell: bash |
27 |
| - |
28 |
| - - name: Run fleetctl apply |
29 |
| - run: | |
30 |
| - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
31 |
| - # STEP 1: Apply config |
32 |
| - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
33 |
| - # Combine the contents of all the top-level config into a single YAML document |
34 |
| -
|
35 |
| - # - Include the contents of no-team.controls.yml |
36 |
| - # TODO |
37 |
| -
|
38 |
| - # - Include the contents of default.settings.yml |
39 |
| - # TODO |
40 |
| -
|
41 |
| - # - Include anything of `kind: config` in default.queries.yml |
42 |
| - # TODO |
43 |
| -
|
44 |
| - # - Include anything of `kind: config` in default.policies.yml |
45 |
| - # TODO |
46 |
| -
|
47 |
| - # Apply top-level config with `--replace` (replaces all existing top-level config) |
48 |
| - # TODO |
49 |
| -
|
50 |
| - # Loop through folders in /teams and combine the contents of all team config into a single YAML document |
51 |
| -
|
52 |
| - # - Include the contents of <folder-name>.controls.yml |
53 |
| - # TODO |
54 |
| -
|
55 |
| - # - Include the contents of <folder-name>.settings.yml |
56 |
| - # TODO |
57 |
| -
|
58 |
| - # - Include anything of `kind: team` in <folder-name>.queries.yml |
59 |
| - # TODO |
60 |
| -
|
61 |
| - # - Include anything of `kind: team` in <folder-name>.policies.yml |
62 |
| - # TODO |
63 |
| -
|
64 |
| - # Apply team config with `--replace` (replaces all existing config for this team) |
65 |
| - # TODO |
66 |
| -
|
67 |
| - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
68 |
| - # STEP 2: Apply queries |
69 |
| - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
70 |
| - # Compile all queries into a single YAML document |
71 |
| -
|
72 |
| - # - Include anything of `kind: query` in default.queries.yml |
73 |
| - # TODO |
74 |
| - |
75 |
| - # - Loop through folders in /teams and include anything of `kind: query` in <folder-name>.queries.yml for each |
76 |
| - # TODO |
77 |
| - |
78 |
| - # Apply compiled queries YAML with `--replace` (deletes any queries in Fleet that aren't present in this config) |
79 |
| - # TODO |
80 |
| -
|
81 |
| - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
82 |
| - # STEP 3: Apply policies |
83 |
| - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
84 |
| - # Compile all policies into a single YAML document |
85 |
| - # TODO |
86 |
| - |
87 |
| - # - Include anything of `kind: policy` in default.policies.yml |
88 |
| - # TODO |
89 |
| - |
90 |
| - # - Loop through folders in /teams and include anything of `kind: policy` in <folder-name>.policies.yml for each |
91 |
| - # TODO |
92 |
| - |
93 |
| - # Apply compiled policies YAML with `--replace` (deletes any policies in Fleet that aren't present in this config) |
94 |
| - # TODO |
95 |
| -
|
96 |
| - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
97 |
| - # All done! |
98 |
| - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
99 |
| -
|
100 |
| - shell: bash |
| 1 | +name: 'Apply latest configuration to Fleet' |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: # allows manual triggering |
| 8 | + |
| 9 | +defaults: |
| 10 | + run: |
| 11 | + shell: bash |
| 12 | + |
| 13 | +# Add FLEET_URL and FLEET_API_TOKEN to the repository secrets. |
| 14 | +# In addition, specify or add secrets for all the environment variables that are mentioned in the global/team YAML files. |
| 15 | +env: |
| 16 | + FLEET_SSO_METADATA: ${{ secrets.FLEET_SSO_METADATA }} |
| 17 | + FLEET_GLOBAL_ENROLL_SECRET: ${{ secrets.FLEET_GLOBAL_ENROLL_SECRET }} |
| 18 | + FLEET_WORKSTATIONS_ENROLL_SECRET: ${{ secrets.FLEET_WORKSTATIONS_ENROLL_SECRET }} |
| 19 | + FLEET_WORKSTATIONS_CANARY_ENROLL_SECRET: ${{ secrets.FLEET_WORKSTATIONS_CANARY_ENROLL_SECRET }} |
| 20 | + |
| 21 | +jobs: |
| 22 | + build-docker: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Checkout GitOps repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Install fleetctl |
| 29 | + run: npm install -g fleetctl |
| 30 | + |
| 31 | + - name: Configure fleetctl |
| 32 | + run: fleetctl config set --address ${{ secrets.FLEET_URL }} --token ${{ secrets.FLEET_API_TOKEN }} |
| 33 | + |
| 34 | + - name: Run fleetctl gitops commands |
| 35 | + run: ./workflow.sh |
0 commit comments