diff --git a/.github/workflows/image-workflow-template.yml b/.github/workflows/image-workflow-template.yml index 0a23e8ac..1a307700 100644 --- a/.github/workflows/image-workflow-template.yml +++ b/.github/workflows/image-workflow-template.yml @@ -8,6 +8,16 @@ on: env: LANG: en_US.UTF-8 jobs: + validateYAML: + name: Validate YAML and JSON files touched by commit + timeout-minutes: 60 + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v4 + - name: Find YAML and JSON files and verify their syntax + run: ./tools/lint.sh openjdkci: name: OpenJDK S2I Build and Test timeout-minutes: 60 diff --git a/templates/image-streams.json b/templates/image-streams.json index 840f11e0..83b3cd27 100644 --- a/templates/image-streams.json +++ b/templates/image-streams.json @@ -22,6 +22,10 @@ "labels": { "xpaas": "1.4.17" } + + + deliberately broken file + }, "spec": { "tags": [ diff --git a/tools/lint.sh b/tools/lint.sh new file mode 100755 index 00000000..6e5bb7a8 --- /dev/null +++ b/tools/lint.sh @@ -0,0 +1,24 @@ +ret=0 + +# XXX this will only work for one commit PRs. Need to diff against the +# merge base. Note also GHA checkout@v4 will only fetch the top-most +# commit by default! +git diff-tree --no-commit-id --name-only HEAD -r |\ +while read f; do + case "${f##*.}" in + yaml) + # XXX we could use yamllint but it's too noisy for now + yq < "$f" >/dev/null || { + echo "$f is not valid YAML" + ret=1 + } + ;; + json) + jq < "$f" >/dev/null || { + echo "$f is not valid JSON"; + ret=1 + } + ;; + esac +done +exit $ret diff --git a/ubi9-openjdk-17.yaml b/ubi9-openjdk-17.yaml index f75306af..f1f66249 100644 --- a/ubi9-openjdk-17.yaml +++ b/ubi9-openjdk-17.yaml @@ -20,6 +20,11 @@ labels: value: "openjdk-17-ubi9-container" - name: "usage" value: &docs "https://jboss-container-images.github.io/openjdk/" + + + + deliberately broken yaml file + - name: "com.redhat.license_terms" value: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" - name: "org.opencontainers.image.documentation"