-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: github-actions <[email protected]>
- Loading branch information
1 parent
42bca9c
commit 604b290
Showing
13 changed files
with
315 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
167 changes: 167 additions & 0 deletions
167
.github/workflows/zz_generated.diff_helm_render_templates.yaml
This file contains 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,167 @@ | ||
# DO NOT EDIT. Generated with: | ||
# | ||
# devctl | ||
# | ||
# https://github.com/giantswarm/devctl/blob/dc49303eb31fa5ef0996aadfda1da4c56a3ad883/pkg/gen/input/workflows/internal/file/helm_render_diff.yaml.template | ||
# | ||
name: Compare Helm Rendering | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [HEAD_BRANCH, main] | ||
|
||
env: | ||
dyff_ver: "1.7.1" | ||
helm_ver: "3.11.1" | ||
|
||
jobs: | ||
# This job is for checking for the `/no_diffs_printing` comment in the PR. When it is found, | ||
# the `get-rendering-values` job is skipped, what makes `cmp-helm-rendering` skipped as well. | ||
check-cmp-state: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
steps: | ||
- name: Find suspend comment | ||
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0 | ||
continue-on-error: true | ||
id: fc | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body-regex: '^\s*/no_diffs_printing' # on a separate line, not as Markdown `<!-- /no_diffs_printing -->` comment | ||
- name: Find suspend comment in PR body # PR body isn't a comment, so the above step won't find it | ||
id: pr_body | ||
run: | | ||
if jq -r .pull_request.body "${GITHUB_EVENT_PATH}" | grep -qE '^\s*/no_diffs_printing'; then | ||
echo "Found /no_diffs_printing command in PR body" | ||
echo "suspend_diffs_printing_from_pr_body=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "Did not find /no_diffs_printing command in PR body" | ||
echo "suspend_diffs_printing_from_pr_body=false" >> $GITHUB_OUTPUT | ||
fi | ||
outputs: | ||
suspend_comment_id: ${{ steps.fc.outputs.comment-id }} | ||
suspend_diffs_printing_from_pr_body: ${{ steps.pr_body.outputs.suspend_diffs_printing_from_pr_body }} | ||
cmp-helm-rendering: | ||
needs: check-cmp-state | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' && needs.check-cmp-state.outputs.suspend_comment_id == 0 && needs.check-cmp-state.outputs.suspend_diffs_printing_from_pr_body == 'false' | ||
steps: | ||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
- name: install helm | ||
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0 | ||
with: | ||
version: ${{ env.helm_ver }} | ||
- run: which helm | ||
- name: install dyff | ||
uses: giantswarm/install-binary-action@033b1a657eea23d9c42e77312b370e6125e4e38f # v2.0.0 | ||
with: | ||
binary: dyff | ||
download_url: "https://github.com/homeport/dyff/releases/download/v${version}/dyff_${version}_linux_amd64.tar.gz" | ||
smoke_test: "${binary} version" | ||
tarball_binary_path: "${binary}" | ||
version: ${{ env.dyff_ver }} | ||
- run: which dyff | ||
- run: ls -la /opt/hostedtoolcache | ||
- name: render helm with current code | ||
run: | | ||
helm repo add cluster-catalog https://giantswarm.github.io/cluster-catalog/ | ||
# We also add cluster-test-catalog so we can more easily test dev builds of subcharts. | ||
# Charts from cluster-test-catalog should be used only for testing purposes. | ||
helm repo add cluster-test-catalog https://giantswarm.github.io/cluster-test-catalog/ | ||
helm dependency build helm/${{ github.event.repository.name }} | ||
for test_file_path in helm/${{ github.event.repository.name }}/ci/test-*-values.yaml; do | ||
echo | ||
echo "Rendering Helm template for ${test_file_path} on current code" | ||
mkdir -p "/tmp/${test_file_path}" | ||
helm template -n org-giantswarm -f "helm/${{ github.event.repository.name }}/ci/ci-values.yaml" -f "${test_file_path}" "helm/${{ github.event.repository.name }}" > "/tmp/${test_file_path}/render-new.yaml" | ||
done | ||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
with: | ||
ref: "${{ github.event.repository.default_branch }}" | ||
path: 'old' | ||
- name: render helm with main branch code | ||
run: | | ||
helm dependency build old/helm/${{ github.event.repository.name }} | ||
for test_file_path in helm/${{ github.event.repository.name }}/ci/test-*-values.yaml; do | ||
echo | ||
echo "Rendering Helm template for ${test_file_path} on old code" | ||
if [ ! -d "/tmp/${test_file_path}" ]; then | ||
echo "File ${test_file_path} does not yet exist in old code, skipping" | ||
continue | ||
fi | ||
helm template -n org-giantswarm -f "old/helm/${{ github.event.repository.name }}/ci/ci-values.yaml" -f "${test_file_path}" "old/helm/${{ github.event.repository.name }}" > "/tmp/${test_file_path}/render-old.yaml" | ||
done | ||
- name: get the diffs | ||
uses: mathiasvr/command-output@34408ea3d0528273faff3d9e201761ae96106cd0 # v2.0.0 | ||
with: | ||
run: | | ||
marker="=== No differences at all ===" | ||
( | ||
found_differences= | ||
first=1 | ||
for test_file_path in helm/${{ github.event.repository.name }}/ci/test-*-values.yaml; do | ||
if [ "${first}" = 1 ]; then | ||
first= | ||
else | ||
echo | ||
echo | ||
fi | ||
echo "=== Differences when rendered with values file ${test_file_path} ===" | ||
dyff between --set-exit-code --ignore-order-changes --omit-header --use-go-patch-style "/tmp/${test_file_path}/render-old.yaml" "/tmp/${test_file_path}/render-new.yaml" && echo "No difference" || { res=$?; found_differences=1; if [[ $res -eq 255 ]]; then echo "Diff error"; fi; } | ||
done | ||
if [ -z "${found_differences}" ]; then | ||
echo | ||
echo | ||
echo "${marker}" | ||
fi | ||
) > /tmp/diffs | ||
( | ||
if ! grep -qF "${marker}" /tmp/diffs ; then | ||
echo "**There were differences in the rendered Helm template, please check! ⚠️**" | ||
else | ||
echo "There were no differences in the rendered Helm template." | ||
fi | ||
echo | ||
echo "<details>" | ||
echo "<summary>Output</summary>" | ||
echo "<!-- mandatory empty line -->" | ||
echo "" | ||
echo '```' | ||
cat /tmp/diffs | ||
echo '```' | ||
echo "</details>" | ||
echo "<!-- mandatory empty line -->" | ||
) > /tmp/comment-body | ||
- name: Find diff comment | ||
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0 | ||
continue-on-error: true | ||
id: fc | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: 'differences in the rendered Helm template' | ||
- name: Delete old comment | ||
uses: winterjung/comment@fda92dbcb5e7e79cccd55ecb107a8a3d7802a469 # v1.1.0 | ||
continue-on-error: true | ||
if: steps.fc.outputs.comment-id != 0 | ||
with: | ||
type: delete | ||
comment_id: ${{ steps.fc.outputs.comment-id }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create comment | ||
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body-path: /tmp/comment-body |
45 changes: 45 additions & 0 deletions
45
.github/workflows/zz_generated.documentation_validation.yaml
This file contains 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,45 @@ | ||
# DO NOT EDIT. Generated with: | ||
# | ||
# devctl | ||
# | ||
# https://github.com/giantswarm/devctl/blob/dc49303eb31fa5ef0996aadfda1da4c56a3ad883/pkg/gen/input/workflows/internal/file/cluster_app_documentation_validation.yaml.template | ||
# | ||
|
||
# This workflow validates the documentation generated from the JSON schema of the cluster-app | ||
# which is located in `helm/*/values.schema.json`. Specifically, it checks whether the changes | ||
# from `make generate-docs` were committed. | ||
|
||
name: Documentation validation | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
paths: | ||
- 'helm/**/values.yaml' | ||
- 'helm/**/values.schema.json' | ||
- '**/*.md' # if someone manually edited a file that should contain the generated documentation | ||
|
||
push: {} | ||
|
||
jobs: | ||
validate: | ||
name: Validate documentation | ||
runs-on: ubuntu-latest | ||
env: | ||
GO_VERSION: 1.21.3 | ||
steps: | ||
- name: Set up Go ${{ env.GO_VERSION }} | ||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: Checkout code | ||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
- name: "Run 'make generate-docs' and check for differences" | ||
run: | | ||
make generate-docs | ||
if ! git diff --exit-code; then | ||
echo "ERROR: You need to commit the changes made by \"make generate-docs\"." | ||
exit 1 | ||
fi |
This file contains 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.