diff --git a/.github/.yamllint.config.yaml b/.github/.yamllint.config.yaml deleted file mode 100644 index 90f18b6..0000000 --- a/.github/.yamllint.config.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -# Default configuration https://yamllint.readthedocs.io/en/stable/configuration.html -yaml-files: - - '*.yaml' - - '*.yml' - - '.yamllint' - -rules: - anchors: enable - braces: enable - brackets: enable - colons: enable - commas: enable - comments: - level: warning - min-spaces-from-content: 1 - comments-indentation: - level: warning - document-end: disable - document-start: - level: warning - empty-lines: enable - empty-values: #disable - forbid-in-block-mappings: true - forbid-in-flow-mappings: true - float-values: disable - hyphens: enable - indentation: #enable - spaces: consistent - indent-sequences: whatever - check-multi-line-strings: false - key-duplicates: enable - key-ordering: disable - line-length: disable - new-line-at-end-of-file: enable - new-lines: enable - octal-values: disable - quoted-strings: disable - # quote-type: double - # required: true - # extra-required: [] - # extra-allowed: [] - # allow-quoted-quotes: false - trailing-spaces: enable - truthy: - level: warning \ No newline at end of file diff --git a/.github/workflows/yamllint.yml b/.github/workflows/yamllint.yml deleted file mode 100644 index 7a430e3..0000000 --- a/.github/workflows/yamllint.yml +++ /dev/null @@ -1,120 +0,0 @@ -# Workflow is deactivated -name: Yamllint - -# Controls when the workflow will run -on: - workflow_dispatch: - # Triggers the workflow on push or pull request events but only for the "main" branch - pull_request: - branches: - - "main-branch-not-activated-yet" - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -env: - BASH_SCRIPT: "yamllint.sh" - BASH_SCRIPT_RESULT: 0 - MESSAGE_HEADER: "Yaml Lint Validation" - MESSAGE: "" - - -jobs: - yamllint: - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - name: Gather Helm Chart Folders - shell: bash - run: | - ${GITHUB_WORKSPACE}/scripts/ci/helm-chart-listing.sh - echo "::group:: Found Helm Chart Folders" - cat "${GITHUB_WORKSPACE}/helm-charts-templated.yaml" - echo "::endgroup::" - env: - BASH_SCRIPT: ${{ env.BASH_SCRIPT }} - - name: Dependency Build - run: bash ${GITHUB_WORKSPACE}/scripts/ci/helm-dep-build.sh - - name: Manifest Linting + Validation - run: | - set +e - ${GITHUB_WORKSPACE}/scripts/ci/helm-chart-linting-manifest-validation.sh &> bash_output.txt - echo "BASH_SCRIPT_RESULT=$?" >> "$GITHUB_ENV" - - echo "::group:: Bash Script Output" - cat bash_output.txt - echo "::endgroup::" - env: - BASH_SCRIPT: ${{ env.BASH_SCRIPT }} - - if: env.BASH_SCRIPT_RESULT != 0 - name: "Set Message" - shell: bash - run: | - # https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings - echo 'MESSAGE<> $GITHUB_ENV - cat "${GITHUB_WORKSPACE}/pr-status-check-human-friendly.txt" >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV - - - if: env.BASH_SCRIPT_RESULT == 0 - name: yamllint - id: "yamllint" - shell: bash - run: | - set +e - echo "/home/runner/.local/bin" >> $GITHUB_PATH - - ${GITHUB_WORKSPACE}/scripts/ci/${{ env.BASH_SCRIPT }} &> bash_output.txt - echo "BASH_SCRIPT_RESULT=$?" >> "$GITHUB_ENV" - - echo "::group:: Bash Script Output" - cat bash_output.txt - echo "::endgroup::" - - # https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings - echo 'MESSAGE<> $GITHUB_ENV - cat "${GITHUB_WORKSPACE}/pr-status-check-human-friendly.txt" >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV - - - - if: env.BASH_SCRIPT_RESULT != 0 - name: "Workflow Commands" - shell: bash - run: | - if [ -f "${GITHUB_WORKSPACE}/github-workflow-commands.txt" ]; then - cat "${GITHUB_WORKSPACE}/github-workflow-commands.txt" - fi - - - if: env.BASH_SCRIPT_RESULT != 0 - name: "Add Sticky Pull Request Comment" - uses: marocchino/sticky-pull-request-comment@v2.9.1 - with: - recreate: true - header: ":star2: :collision: :collision: [${{ env.MESSAGE_HEADER }}] :collision: :collision: :collision:" - message: | - ## :star2: :collision: :collision: [${{ env.MESSAGE_HEADER }}] :collision: :collision: :collision: - :collision: TRY TO FIX AS MANY ERRORS/WARNINGS AS POSSIBLE! :collision: -
- detail - - ```bash - - ${{ env.MESSAGE }} - - ``` -
- - if: env.BASH_SCRIPT_RESULT == 0 - name: "Remove Sticky Pull Request Comment" - uses: marocchino/sticky-pull-request-comment@v2.9.1 - with: - header: ":star2: :collision: :collision: [${{ env.MESSAGE_HEADER }}] :collision: :collision: :collision:" - delete: true - - if: env.BASH_SCRIPT_RESULT != 0 - name: Throw Error - id: "throw-error" - run: | - echo "::group:: human readable validation result" - echo -e "${{ env.MESSAGE }}" - echo "::endgroup::" - exit 1 diff --git a/Makefile b/Makefile index 439cbd3..41150f9 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,6 @@ SHELL = /usr/bin/env bash -o pipefail git-tags-modified-helm-charts: $(PWD)/.github/actions/git-tag-modified-helm-chart/git-tag-modified-helm-chart.sh; -.PHONY: shell-check -shell-check: - $(PWD)/scripts/ci/shellcheck.sh - .PHONY: clean clean: rm -rf helm-template-*.yaml diff --git a/helm/charts/crossplane-gardener-core-cloud/.ci.config.yaml b/helm/charts/crossplane-gardener-core-cloud/.ci.config.yaml index 8b50235..274604b 100644 --- a/helm/charts/crossplane-gardener-core-cloud/.ci.config.yaml +++ b/helm/charts/crossplane-gardener-core-cloud/.ci.config.yaml @@ -3,8 +3,6 @@ jfrog.sh: enabled: true # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-gardener-shoot-clusters/.ci.config.yaml b/helm/charts/crossplane-gardener-shoot-clusters/.ci.config.yaml index 8b50235..274604b 100644 --- a/helm/charts/crossplane-gardener-shoot-clusters/.ci.config.yaml +++ b/helm/charts/crossplane-gardener-shoot-clusters/.ci.config.yaml @@ -3,8 +3,6 @@ jfrog.sh: enabled: true # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-gardener-shoot-kubeconfigs/.ci.config.yaml b/helm/charts/crossplane-gardener-shoot-kubeconfigs/.ci.config.yaml index c8de61f..577712e 100644 --- a/helm/charts/crossplane-gardener-shoot-kubeconfigs/.ci.config.yaml +++ b/helm/charts/crossplane-gardener-shoot-kubeconfigs/.ci.config.yaml @@ -3,8 +3,6 @@ jfrog.sh: enabled: true # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-apiextensions-composition/.ci.config.yaml b/helm/charts/crossplane-provider-apiextensions-composition/.ci.config.yaml index c8de61f..577712e 100644 --- a/helm/charts/crossplane-provider-apiextensions-composition/.ci.config.yaml +++ b/helm/charts/crossplane-provider-apiextensions-composition/.ci.config.yaml @@ -3,8 +3,6 @@ jfrog.sh: enabled: true # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-apiextensions/.ci.config.yaml b/helm/charts/crossplane-provider-apiextensions/.ci.config.yaml index c8de61f..577712e 100644 --- a/helm/charts/crossplane-provider-apiextensions/.ci.config.yaml +++ b/helm/charts/crossplane-provider-apiextensions/.ci.config.yaml @@ -3,8 +3,6 @@ jfrog.sh: enabled: true # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-aws-ec2/.ci.config.yaml b/helm/charts/crossplane-provider-aws-ec2/.ci.config.yaml index 8b50235..274604b 100644 --- a/helm/charts/crossplane-provider-aws-ec2/.ci.config.yaml +++ b/helm/charts/crossplane-provider-aws-ec2/.ci.config.yaml @@ -3,8 +3,6 @@ jfrog.sh: enabled: true # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-aws-eks/.ci.config.yaml b/helm/charts/crossplane-provider-aws-eks/.ci.config.yaml index 3a7fb0f..b7c5623 100644 --- a/helm/charts/crossplane-provider-aws-eks/.ci.config.yaml +++ b/helm/charts/crossplane-provider-aws-eks/.ci.config.yaml @@ -5,8 +5,6 @@ jfrog.sh: # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-aws-iam/.ci.config.yaml b/helm/charts/crossplane-provider-aws-iam/.ci.config.yaml index ea4fde3..1cf2c7b 100644 --- a/helm/charts/crossplane-provider-aws-iam/.ci.config.yaml +++ b/helm/charts/crossplane-provider-aws-iam/.ci.config.yaml @@ -5,8 +5,6 @@ jfrog.sh: # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-aws-rdr/.ci.config.yaml b/helm/charts/crossplane-provider-aws-rdr/.ci.config.yaml index 3a7fb0f..b7c5623 100644 --- a/helm/charts/crossplane-provider-aws-rdr/.ci.config.yaml +++ b/helm/charts/crossplane-provider-aws-rdr/.ci.config.yaml @@ -5,8 +5,6 @@ jfrog.sh: # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-btp-security/.ci.config.yaml b/helm/charts/crossplane-provider-btp-security/.ci.config.yaml index b66bdbe..0d1b249 100644 --- a/helm/charts/crossplane-provider-btp-security/.ci.config.yaml +++ b/helm/charts/crossplane-provider-btp-security/.ci.config.yaml @@ -4,8 +4,6 @@ jfrog.sh: enabled: true # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-configs/.ci.config.yaml b/helm/charts/crossplane-provider-configs/.ci.config.yaml index ea4fde3..1cf2c7b 100644 --- a/helm/charts/crossplane-provider-configs/.ci.config.yaml +++ b/helm/charts/crossplane-provider-configs/.ci.config.yaml @@ -5,8 +5,6 @@ jfrog.sh: # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-gcp/.ci.config.yaml b/helm/charts/crossplane-provider-gcp/.ci.config.yaml index 8b50235..274604b 100644 --- a/helm/charts/crossplane-provider-gcp/.ci.config.yaml +++ b/helm/charts/crossplane-provider-gcp/.ci.config.yaml @@ -3,8 +3,6 @@ jfrog.sh: enabled: true # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-helm/.ci.config.yaml b/helm/charts/crossplane-provider-helm/.ci.config.yaml index ea4fde3..1cf2c7b 100644 --- a/helm/charts/crossplane-provider-helm/.ci.config.yaml +++ b/helm/charts/crossplane-provider-helm/.ci.config.yaml @@ -5,8 +5,6 @@ jfrog.sh: # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-kubernetes/.ci.config.yaml b/helm/charts/crossplane-provider-kubernetes/.ci.config.yaml index ea4fde3..1cf2c7b 100644 --- a/helm/charts/crossplane-provider-kubernetes/.ci.config.yaml +++ b/helm/charts/crossplane-provider-kubernetes/.ci.config.yaml @@ -5,8 +5,6 @@ jfrog.sh: # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-pkgs/.ci.config.yaml b/helm/charts/crossplane-provider-pkgs/.ci.config.yaml index 8b50235..274604b 100644 --- a/helm/charts/crossplane-provider-pkgs/.ci.config.yaml +++ b/helm/charts/crossplane-provider-pkgs/.ci.config.yaml @@ -3,8 +3,6 @@ jfrog.sh: enabled: true # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-sap-btp-account/.ci.config.yaml b/helm/charts/crossplane-provider-sap-btp-account/.ci.config.yaml index 8b50235..274604b 100644 --- a/helm/charts/crossplane-provider-sap-btp-account/.ci.config.yaml +++ b/helm/charts/crossplane-provider-sap-btp-account/.ci.config.yaml @@ -3,8 +3,6 @@ jfrog.sh: enabled: true # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/crossplane-provider-sap-btp-environment/.ci.config.yaml b/helm/charts/crossplane-provider-sap-btp-environment/.ci.config.yaml index 3a7fb0f..b7c5623 100644 --- a/helm/charts/crossplane-provider-sap-btp-environment/.ci.config.yaml +++ b/helm/charts/crossplane-provider-sap-btp-environment/.ci.config.yaml @@ -5,8 +5,6 @@ jfrog.sh: # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/external-secrets-config/.ci.config.yaml b/helm/charts/external-secrets-config/.ci.config.yaml index ea4fde3..1cf2c7b 100644 --- a/helm/charts/external-secrets-config/.ci.config.yaml +++ b/helm/charts/external-secrets-config/.ci.config.yaml @@ -5,8 +5,6 @@ jfrog.sh: # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/flux-config/.ci.config.yaml b/helm/charts/flux-config/.ci.config.yaml index ea4fde3..1cf2c7b 100644 --- a/helm/charts/flux-config/.ci.config.yaml +++ b/helm/charts/flux-config/.ci.config.yaml @@ -5,8 +5,6 @@ jfrog.sh: # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/k8s-validating-admission-policy/.ci.config.yaml b/helm/charts/k8s-validating-admission-policy/.ci.config.yaml index ea4fde3..1cf2c7b 100644 --- a/helm/charts/k8s-validating-admission-policy/.ci.config.yaml +++ b/helm/charts/k8s-validating-admission-policy/.ci.config.yaml @@ -5,8 +5,6 @@ jfrog.sh: # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/sap-btp-services/.ci.config.yaml b/helm/charts/sap-btp-services/.ci.config.yaml index ea4fde3..1cf2c7b 100644 --- a/helm/charts/sap-btp-services/.ci.config.yaml +++ b/helm/charts/sap-btp-services/.ci.config.yaml @@ -5,8 +5,6 @@ jfrog.sh: # pipeline feature flags -yamllint: - enable: true helm-docs: enable: true helm-chart-linting: diff --git a/helm/charts/test-custom-chart/.ci.config.yaml b/helm/charts/test-custom-chart/.ci.config.yaml index a68a295..e7339dd 100644 --- a/helm/charts/test-custom-chart/.ci.config.yaml +++ b/helm/charts/test-custom-chart/.ci.config.yaml @@ -3,8 +3,6 @@ jfrog.sh: enabled: true #false # pipeline feature flags -yamllint: # not implemented yet! - enable: false helm-docs: enable: true # default is true, even if you do NOT declare this feature flag! options: diff --git a/scripts/ci/test-parse-yamllint-output.sh b/scripts/ci/test-parse-yamllint-output.sh deleted file mode 100755 index b510a78..0000000 --- a/scripts/ci/test-parse-yamllint-output.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# helm-template-app-in-app.yaml -# 25:12 error trailing spaces (trailing-spaces) -# 32:16 warning too few spaces before comment (comments) -# 33:19 warning too few spaces before comment (comments) -# 34:22 warning too few spaces before comment (comments) -while read -r item -do - #echo "${item}" - # Set comma as delimiter - IFS=':' - #Read the split words into an array based on comma delimiter - read -ra strarr <<< "${item}" - msg=$(sed -E 's/^\s+//' <<<"${strarr[3]}") - #echo ${strarr[0]} ${strarr[1]} ${strarr[2]} ${strarr[3]} - line=${strarr[1]} - file=${strarr[0]} - if [ "$line" == 1 ]; then - helmChartFile=$(eval head "$file" | grep "# Source:" | tac | awk '{print;exit}' | cut -c11-) - helmChartLine=$line - else - helmChartFile=$(eval head -"${line}" "$file" | grep "# Source:" | tac | awk '{print;exit}' | cut -c11-) - startLine=$(eval head -"${line}" "$file" | grep "# Source:" --line-number | tac | awk '{print;exit}' | cut -d : -f 1) - # shellcheck disable=SC2003 - helmChartLine=$(expr "$line" - "$startLine") - fi - if [[ "$helmChartFile" == *"/charts/"* ]]; then - continue - fi - level=$(awk '{ sub(/.*\[/, ""); sub(/\].*/, ""); print }' <<< "$msg") - echo "$level Helm Chart File $helmChartFile Line ${helmChartLine} ($line - $startLine):${msg}" - #echo "::${level} file=helm/charts/$helmChartFile,line=$helmChartLine,endLine=$helmChartLine::$msg" - #echo "--------------------------------------" -done < "yamllint-parsable.txt" - diff --git a/scripts/ci/yamllint.sh b/scripts/ci/yamllint.sh deleted file mode 100755 index 4efd7f8..0000000 --- a/scripts/ci/yamllint.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash - -################################################################### -#script name : yamllint -#description : Install tac "brew install coreutils" -# -#args : - -################################################################### -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -# shellcheck disable=SC1091 -source "$SCRIPT_DIR"/shared-variables.sh -declare resultPwd newLineString helmChartListTemplatedManifestsFileName exitCode msgHelpStart msgEverythingIsFine - -set +e -echo "$newLineString" -echo "The script you are running has:" -echo "basename: [$(basename "$0")]" -echo "dirname : [$(dirname "$0")]" -echo "pwd : [$(pwd)]" -echo "bash -v : [$(/bin/bash --version)]" -# https://github.com/zegl/yamllint -cmd="yamllint" -################################################################### -# Check if run in Github Action Runner -if [ -n "$GITHUB_WORKSPACE" ]; then - cmd="/home/runner/.local/bin/${cmd}" - - python -m build - - if ! pip install --user "${GITHUB_WORKSPACE}/scripts/ci/yamllint-1.32.0.tar"; then - echo "!!! ERROR installing yamllint !!!" - exit 1 - fi - -fi -################################################################### -echo "$newLineString" -echo "\$ ${cmd} -v" -${cmd} -v -echo "$newLineString" -################################################################### -declare -a filesToRemove=("yamllint-parsable.txt") -REMOVE_FILES_IF_EXISTS "$resultPwd" "${filesToRemove[@]}" - -ASSERT_FILE_EXISTS_WITH_MSG "$resultPwd" "$helmChartListTemplatedManifestsFileName" "Run helm-chart-listing.sh first!!" - -echo -e "$msgHelpStart && $(dirname "$0")/$(basename "$0")" >> "${resultPwd}/pr-status-check-human-friendly.txt" - -while read -r helmManifestFile -do - - cmdFat="$cmd $helmManifestFile -c .github/.yamllint.config.yaml --strict -f standard" - echo "\$ $cmdFat" - eval "$cmdFat" - tempQ=$? - if [ $tempQ != 0 ]; then - - { - echo "$newLineString" - echo "Use command to run this check on your local machine!" - echo -e "$cmdFat\n" - } >> "${resultPwd}/pr-status-check-human-friendly.txt" - - parsableResult=$(eval ${cmd} "${helmManifestFile}" -c .github/.yamllint.config.yaml --strict -f parsable) - while read -r item - do - #Read the split words into an array based on comma delimiter - IFS=':' ; read -ra strarr <<< "$item" - msg=$(sed -E 's/^\s+//' <<<"${strarr[3]}") - line=${strarr[1]} - file=${strarr[0]} - if [ "$line" == 1 ]; then - # eval head "helm-template-cloud-orchestration-control-plane.yaml" | grep "# Source:" | tac | awk '{print;exit}' | cut -c11- - helmChartFile=$(eval head "$file" | grep "# Source:" | tac | awk '{print;exit}' | cut -c11-) - helmChartLine=$line - else - helmChartFile=$(eval head -"${line}" "$file" | grep "# Source:" | tac | awk '{print;exit}' | cut -c11-) - startLine=$(eval head -"${line}" "$file" | grep "# Source:" --line-number | tac | awk '{print;exit}' | cut -d : -f 1) - # shellcheck disable=SC2003 - helmChartLine=$(expr "$line" - "$startLine") - fi - if [[ "$helmChartFile" == *"/charts/"* ]]; then - echo "$msgEverythingIsFine for $helmChartFile" >> "${resultPwd}/pr-status-check-human-friendly.txt" - continue - fi - level=$(awk '{ sub(/.*\[/, ""); sub(/\].*/, ""); print }' <<< "$msg") - echo "file: $helmChartFile line:≈±${helmChartLine} - ${msg}" >> "${resultPwd}/pr-status-check-human-friendly.txt" - echo "file: $file line:${line} - ${msg}" >> "${resultPwd}/pr-status-check-human-friendly.txt" - echo "::${level} file=helm/charts/$helmChartFile,line=$helmChartLine,endLine=$helmChartLine::$msg" >> "${resultPwd}/github-workflow-commands.txt" - exitCode=$tempQ - done <<< "${parsableResult}" - echo "${parsableResult}" >> "${resultPwd}/yamllint-parsable.txt" - fi - - echo "$newLineString" - -done < "${helmChartListTemplatedManifestsFileName}" -exit "$exitCode" -################################################################### \ No newline at end of file