Skip to content

Commit

Permalink
testing new changes - temp
Browse files Browse the repository at this point in the history
Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>
  • Loading branch information
Vyom-Yadav committed Jan 16, 2025
1 parent 83d5f96 commit 032ca70
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 37 deletions.
54 changes: 20 additions & 34 deletions .github/workflows/krel-release-notes-validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,19 @@

name: Yaml Lint Release Notes
on:
push:
branches:
- master
paths:
- releases/**/release-notes/**.yaml
- releases/**/release-notes/**.yml
pull_request:
paths:
- releases/**/release-notes/**.yaml
- releases/**/release-notes/**.yml
# Allow manual triggering
workflow_dispatch: { }

permissions: { }

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
krel_release_notes_validate_action:
name: Validate release notes with krel
Expand All @@ -39,8 +36,7 @@ jobs:
- name: Check out code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# we need to fetch the full history in order to check changes across all commits on the branch
fetch-depth: '0'
fetch-depth: 0
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: '1.23'
Expand Down Expand Up @@ -95,46 +91,36 @@ jobs:
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- releases/ | grep -E '\.ya?ml$' || true)
if [ -n "$CHANGED_FILES" ]; then
echo "validating base sha ${{ github.event.pull_request.base.sha }}"
echo "### YAML Validation Results :mag:" >> $GITHUB_STEP_SUMMARY
echo "Validating files against base SHA: ${{ github.event.pull_request.base.sha }}" >> $GITHUB_STEP_SUMMARY
# Initialize an array for invalid files
INVALID_FILES=""
while IFS= read -r file; do
echo "#### Validating: ${file##*/}" >> $GITHUB_STEP_SUMMARY
set +e
"${KREL_PATH}" release-notes validate --path-to-release-notes "$file"
VALIDATION_OUTPUT=$("${KREL_PATH}" release-notes validate --path-to-release-notes "$file" 2>&1)
exit_code=$?
set -e
if [ $exit_code -ne 0 ]; then
INVALID_FILES="${INVALID_FILES}- ${file##*/}\n"
echo "❌ Validation failed with the following errors:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "$VALIDATION_OUTPUT" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
else
echo "✅ File is valid" >> $GITHUB_STEP_SUMMARY
fi
done <<< "$CHANGED_FILES"
# If there are any invalid files, set the output and fail
if [ -n "$INVALID_FILES" ]; then
echo "invalid_files<<EOF" >> $GITHUB_OUTPUT
echo -e "$INVALID_FILES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo -e "\n### ❌ Validation Failed" >> $GITHUB_STEP_SUMMARY
echo "The following files contain invalid YAML:" >> $GITHUB_STEP_SUMMARY
echo -e "$INVALID_FILES" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo "All YAML files are valid."
fi
else
echo "No YAML files changed under /releases/*"
echo "### No YAML Changes Detected" >> $GITHUB_STEP_SUMMARY
echo "No YAML files were changed under /releases/*" >> $GITHUB_STEP_SUMMARY
fi
- name: Comment on PR if invalid yaml detected
if: failure() && github.event_name == 'pull_request'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const invalidFiles = `${{ steps.validate_releases_yaml.outputs.invalid_files }}`;
if (invalidFiles) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `❌ YAML validation failed for the following files:\n\n${invalidFiles}`
});
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pr: 112104
releasenote:
text: Fixed EDITOR/KUBE_EDITOR with double-quoted paths with spaces when on Windows
cmd.exe.
cmd.exe.
pr_body: ""
3 changes: 2 additions & 1 deletion releases/release-1.31/release-notes/maps/pr-118148-map.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pr: 118148
releasenote:
text: Exposed the kube-scheduler "/livez" and "/readz" endpoints for health checks
that are in compliance with https://kubernetes.io/docs/reference/using-api/health-checks/#api-endpoints-for-health.
that are in compliance with https://kubernetes.io/docs/reference/using-api/health
-checks/#api-endpoints-for-health.
pr_body: ""
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ pr: 124017
releasenote:
text: |
Removed deprecated command flags --volume-host-cidr-denylist
and --volume-host-allow-local-loopback from kube-controller-manager.
and --volume-host-allow-local-loopback from kube-controller-manager.

0 comments on commit 032ca70

Please sign in to comment.