forked from Ylianst/MeshCentral
-
Notifications
You must be signed in to change notification settings - Fork 1
Harden the meshcentral chart #64
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
d31f9bc
Unite matrix and changes files in CI pipeline
viktor-flamingo 2843f4b
Update alpine to 3.24 and slim the image
viktor-flamingo def24f1
Harden the meshcentral chart
viktor-flamingo 8d073dd
Merge branch 'master' into refactor/harden-docker-image
viktor-flamingo e7d3d2e
rm comment
viktor-flamingo 1f91168
Non default SA for MeshCentral Chart
ivan-flamingo 0d58212
mongosh a writable HOME in wait-mongodb init container
viktor-flamingo 7b5964a
Merge remote-tracking branch 'origin/refactor/harden-docker-image' in…
viktor-flamingo 027b6e3
drop mongodb-tools from the image
viktor-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 |
|---|---|---|
|
|
@@ -12,4 +12,5 @@ docker/ | |
| *.njsproj | ||
| *.md | ||
| examples | ||
| tests | ||
| tests | ||
| charts/ | ||
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,111 @@ | ||
| name: Detect Changes | ||
|
|
||
| on: | ||
| workflow_call: | ||
| outputs: | ||
| images_matrix: | ||
| description: "Images matrix configuration for all components" | ||
| value: ${{ jobs.collect.outputs.images_matrix }} | ||
| changes: | ||
| description: "JSON object mapping each component key to true/false" | ||
| value: ${{ jobs.collect.outputs.changes }} | ||
| timestamp: | ||
| value: ${{ jobs.collect.outputs.timestamp }} | ||
| commit_sha: | ||
| value: ${{ jobs.collect.outputs.commit_sha }} | ||
| test_commit_sha: | ||
| value: ${{ jobs.collect.outputs.test_commit_sha }} | ||
|
|
||
| jobs: | ||
| collect: | ||
| name: Changes and Matrix | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| images_matrix: ${{ steps.define.outputs.images_matrix }} | ||
| changes: ${{ steps.changes.outputs.changes }} | ||
| timestamp: ${{ steps.setup_env.outputs.timestamp }} | ||
| commit_sha: ${{ steps.setup_env.outputs.commit_sha }} | ||
| test_commit_sha: ${{ steps.setup_env.outputs.test_commit_sha }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 2 | ||
|
|
||
| - name: Set up environment | ||
| id: setup_env | ||
| run: | | ||
| set -euo pipefail | ||
| echo "timestamp=$(date +%s)" >> "$GITHUB_OUTPUT" | ||
| echo "commit_sha=${GITHUB_SHA::8}" >> "$GITHUB_OUTPUT" | ||
| echo "test_commit_sha=test-${GITHUB_SHA::8}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Define components | ||
| id: define | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| IMAGES='[ | ||
| { | ||
| "name": "meshcentral", | ||
| "paths": [ | ||
| "./docker/**", | ||
| "./.dockerignore", | ||
| "./package.json", | ||
| "./package-lock.json", | ||
| "./*.js", | ||
| "./plugins/**", | ||
| "./agents/**", | ||
| "./emails/**", | ||
| "./translate/**", | ||
| "./views/**", | ||
| "./public/**" | ||
| ] | ||
| } | ||
| ]' | ||
|
|
||
| ADDONS='{ | ||
| "helm": ["./charts/**"] | ||
| }' | ||
|
|
||
| images_matrix=$(jq -c '[ .[] | { | ||
| name, | ||
| path: (.path // "./docker"), | ||
| context: (.context // ".") | ||
| } ]' <<< "$IMAGES") | ||
|
|
||
| filters=$(jq -nc \ | ||
| --argjson images "$IMAGES" \ | ||
| --argjson addons "$ADDONS" ' | ||
| ( [ $images[] | { key: .name, value: (.paths // ["./\(.name)/**"]) } ] | ||
| | 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' <<< "$keys")" -gt 0 ] || { echo "no change filters" >&2; exit 1; } | ||
|
|
||
| { | ||
| echo "images_matrix=$images_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
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.