forked from fleetdm/fleet
-
Notifications
You must be signed in to change notification settings - Fork 1
chore(helm): harden the chart and move the cloud sql proxy to v2 #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7b97ef6
Unite matrix and changes files in CI pipeline
viktor-flamingo 80257ae
Harden the fleet server image
viktor-flamingo a6a35e9
move fleet securityContext into values
viktor-flamingo bc37f87
switch the cloud sql proxy to v2
viktor-flamingo 8ada6cf
drop the dead SYS_PTRACE plumbing from the jobs and give the migratio…
viktor-flamingo 27ea847
fix the tmp mount and the server path filter
viktor-flamingo a8211dd
drop auto-ip, retry the proxy shutdown and skip wait-for-mysql behind…
viktor-flamingo d7ff4e0
refresh the fork docs after the workflow rename and the fsGroup move
viktor-flamingo a063a85
Merge branch 'main' into refactor/harden-fleet-image
ivan-flamingo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| name: Detect Changes | ||
|
|
||
| on: | ||
| workflow_call: | ||
| outputs: | ||
| images_matrix: | ||
| description: "Images matrix configuration for all components" | ||
| value: ${{ jobs.collect.outputs.images_matrix }} | ||
| clients_matrix: | ||
| description: "Clients matrix configuration for all components" | ||
| value: ${{ jobs.collect.outputs.clients_matrix }} | ||
| changes: | ||
| description: "JSON object mapping each component key to true/false" | ||
| value: ${{ jobs.collect.outputs.changes }} | ||
|
|
||
| jobs: | ||
| collect: | ||
| name: Changes and Matrix | ||
| permissions: | ||
| contents: read | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| images_matrix: ${{ steps.define.outputs.images_matrix }} | ||
| clients_matrix: ${{ steps.define.outputs.clients_matrix }} | ||
| changes: ${{ steps.changes.outputs.changes }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 2 | ||
|
|
||
| - name: Define components | ||
| id: define | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| IMAGES='[ | ||
| { | ||
| "id": "server", | ||
| "name": "fleet", | ||
| "paths": ["./server/**", "./cmd/**", "./pkg/**", "./ee/**", "./tools/**", "./Dockerfile", "./.goreleaser.yml"] | ||
| } | ||
| ]' | ||
|
|
||
| CLIENTS='[ | ||
| { | ||
| "id": "client", | ||
| "name": "macos", | ||
| "path": "./orbit", | ||
| "os": "macos-latest", | ||
| "go_os": "darwin", | ||
| "go_arch": ["arm64", "amd64"], | ||
| "artifact_name": "fleet-mac-universal" | ||
| }, | ||
| { | ||
| "id": "client", | ||
| "name": "windows", | ||
| "path": "./orbit", | ||
| "os": "windows-latest", | ||
| "go_os": "windows", | ||
| "go_arch": "amd64", | ||
| "artifact_name": "fleet-windows-amd64" | ||
| } | ||
| ]' | ||
|
|
||
| ADDONS='{ | ||
| "helm": ["./charts/**"] | ||
| }' | ||
|
|
||
| # the go module files rebuild both the server and the client | ||
| SHARED='["./go.mod", "./go.sum"]' | ||
|
|
||
| images_matrix=$(jq -c '[ .[] | { name } ]' <<< "$IMAGES") | ||
| clients_matrix=$(jq -c '[ .[] | { name, os, go_os, go_arch, artifact_name } ]' <<< "$CLIENTS") | ||
|
|
||
| filters=$(jq -nc \ | ||
| --argjson images "$IMAGES" \ | ||
| --argjson clients "$CLIENTS" \ | ||
| --argjson addons "$ADDONS" \ | ||
| --argjson shared "$SHARED" ' | ||
| ( [ $images[] | { key: (.id // .name), value: ((.paths // ["\(.path)/**"]) + $shared) } ] | ||
| + [ $clients[] | { key: (.id // .name), value: ((.paths // ["\(.path)/**"]) + $shared) } ] | ||
| | from_entries ) | ||
| + $addons | ||
| ') | ||
|
|
||
| keys=$(jq -nc --argjson f "$filters" '$f | keys') | ||
|
|
||
| # fail fast if the matrix or filters came out empty | ||
| [ "$(jq 'length' <<< "$images_matrix")" -gt 0 ] || { echo "images_matrix is empty" >&2; exit 1; } | ||
| [ "$(jq 'length' <<< "$clients_matrix")" -gt 0 ] || { echo "clients_matrix is empty" >&2; exit 1; } | ||
| [ "$(jq 'length' <<< "$keys")" -gt 0 ] || { echo "no change filters" >&2; exit 1; } | ||
|
|
||
| { | ||
| echo "images_matrix=$images_matrix" | ||
| echo "clients_matrix=$clients_matrix" | ||
| echo "filters=$filters" | ||
| echo "keys=$keys" | ||
| } >> "$GITHUB_OUTPUT" | ||
|
|
||
| - uses: dorny/paths-filter@v4.0.2 | ||
| id: filter | ||
| with: | ||
| filters: ${{ steps.define.outputs.filters }} | ||
|
|
||
| - name: Build changes map | ||
| id: changes | ||
| env: | ||
| CHANGED: ${{ steps.filter.outputs.changes || '[]' }} | ||
| KEYS: ${{ steps.define.outputs.keys }} | ||
| run: | | ||
| set -euo pipefail | ||
| changes=$(jq -nc --argjson changed "$CHANGED" --argjson keys "$KEYS" ' | ||
| reduce $keys[] as $k ({}; .[$k] = ((($changed | index($k)) != null) | tostring)) | ||
| ') | ||
| echo "changes=$changes" >> "$GITHUB_OUTPUT" | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.