From 90b2860fcdb0d0ec0a2f9ea59725299323e7a948 Mon Sep 17 00:00:00 2001 From: Tasos Katsoulas <12612986+tkatsoulas@users.noreply.github.com> Date: Fri, 29 Mar 2024 14:05:56 +0200 Subject: [PATCH] Fix action lints (#17120) * Clang output should be disabled Signed-off-by: Tasos Katsoulas * Commend out Clang Signed-off-by: Tasos Katsoulas * Fix quoting and snooze sc2043 Signed-off-by: Tasos Katsoulas * Fix failure messages garbages/steps Signed-off-by: Tasos Katsoulas * Fix failure messages step, cleanup garbages Signed-off-by: Tasos Katsoulas * Add quoting whever is necessary and group the echo commands Signed-off-by: Tasos Katsoulas * Fix parorama Signed-off-by: Tasos Katsoulas * apply code review Signed-off-by: Tasos Katsoulas * micnor fix Signed-off-by: Tasos Katsoulas * more fixes Signed-off-by: Tasos Katsoulas --------- Signed-off-by: Tasos Katsoulas --- .github/workflows/build.yml | 3 +- .github/workflows/cloud_regression.yml | 15 +++-- .github/workflows/docker.yml | 6 +- .github/workflows/generate-integrations.yml | 4 +- .github/workflows/monitor-releases.yml | 2 +- .github/workflows/repoconfig-packages.yml | 13 ++-- .github/workflows/review.yml | 72 ++++++++++----------- 7 files changed, 58 insertions(+), 57 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5bad1859c89d6..4623e15daf54fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -634,10 +634,9 @@ jobs: SLACK_USERNAME: 'GitHub Actions' SLACK_MESSAGE: |- ${{ github.repository }}: Failed to prepare release artifacts for upload. - CHeckout: ${{ steps.checkout.outcome }} + Checkout: ${{ steps.checkout.outcome }} Prepare environment: ${{ steps.prepare.outcome }} Fetch dist tarball: ${{ steps.fetch-dist.outcome }} - Fetch static builds: ${{ steps.fetch-static.outcome }} Consolidate artifacts: ${{ steps.consolidate.outcome }} Store: ${{ steps.store.outcome }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/cloud_regression.yml b/.github/workflows/cloud_regression.yml index 01fcdca4db94af..67a55ed2a7dd39 100644 --- a/.github/workflows/cloud_regression.yml +++ b/.github/workflows/cloud_regression.yml @@ -22,21 +22,24 @@ jobs: PR_COMMIT_HASH: ${{ github.event.pull_request.head.sha }} id: output-workflow-dispatch-params run: | - if [ ${{ github.event_name }} == 'pull_request_target' ]; then + if [ "${{ github.event_name }}" == 'pull_request_target' ]; then NETDATA_CUSTOM_REPO="$PR_REPO_NAME" NETDATA_CUSTOM_BRANCH="$PR_BRANCH_NAME" NETDATA_CUSTOM_PR_NUMBER="${{ github.event.number }}" NETDATA_CUSTOM_COMMIT_HASH="$PR_COMMIT_HASH" - elif [ ${{ github.event_name }} == 'push' ]; then + elif [ "${{ github.event_name }}" == 'push' ]; then NETDATA_CUSTOM_REPO="netdata/netdata" NETDATA_CUSTOM_BRANCH="master" NETDATA_CUSTOM_PR_NUMBER="" NETDATA_CUSTOM_COMMIT_HASH="${{ github.sha }}" fi - echo "netdata_repo=${NETDATA_CUSTOM_REPO}" >> $GITHUB_OUTPUT - echo "netdata_branch=${NETDATA_CUSTOM_BRANCH}" >> $GITHUB_OUTPUT - echo "netdata_pr_number=${NETDATA_CUSTOM_PR_NUMBER}" >> $GITHUB_OUTPUT - echo "netdata_commit_hash=${NETDATA_CUSTOM_COMMIT_HASH}" >> $GITHUB_OUTPUT + + { + echo "netdata_repo=${NETDATA_CUSTOM_REPO}" + echo "netdata_branch=${NETDATA_CUSTOM_BRANCH}" + echo "netdata_pr_number=${NETDATA_CUSTOM_PR_NUMBER}" + echo "netdata_commit_hash=${NETDATA_CUSTOM_COMMIT_HASH}" + } >> "$GITHUB_OUTPUT" - name: Trigger Full Cloud Regression uses: aurelien-baudet/workflow-dispatch@v2 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8d6cb70ead445f..34f2aafd825c74 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -333,7 +333,7 @@ jobs: - name: Create and Push Manifest id: manifest if: github.repository == 'netdata/netdata' - run: docker buildx imagetools create $(.github/scripts/gen-docker-imagetool-args.py /tmp/digests '' ${{ needs.gen-tags.outputs.tags }}) + run: docker buildx imagetools create "$(.github/scripts/gen-docker-imagetool-args.py /tmp/digests '' "${{ needs.gen-tags.outputs.tags }}")" - name: Failure Notification uses: rtCamp/action-slack-notify@v2 env: @@ -489,7 +489,7 @@ jobs: - name: Create and Push Manifest id: manifest if: github.repository == 'netdata/netdata' - run: docker buildx imagetools create $(.github/scripts/gen-docker-imagetool-args.py /tmp/digests 'quay.io' ${{ needs.gen-tags.outputs.tags }}) + run: docker buildx imagetools create "$(.github/scripts/gen-docker-imagetool-args.py /tmp/digests 'quay.io' "${{ needs.gen-tags.outputs.tags }}")" - name: Failure Notification uses: rtCamp/action-slack-notify@v2 env: @@ -645,7 +645,7 @@ jobs: - name: Create and Push Manifest id: manifest if: github.repository == 'netdata/netdata' - run: docker buildx imagetools create $(.github/scripts/gen-docker-imagetool-args.py /tmp/digests 'ghcr.io' ${{ needs.gen-tags.outputs.tags }}) + run: docker buildx imagetools create "$(.github/scripts/gen-docker-imagetool-args.py /tmp/digests 'ghcr.io' "${{ needs.gen-tags.outputs.tags }}")" - name: Failure Notification uses: rtCamp/action-slack-notify@v2 env: diff --git a/.github/workflows/generate-integrations.yml b/.github/workflows/generate-integrations.yml index f7d4df866d6e2f..8287f9295935c4 100644 --- a/.github/workflows/generate-integrations.yml +++ b/.github/workflows/generate-integrations.yml @@ -79,9 +79,7 @@ jobs: SLACK_MESSAGE: |- ${{ github.repository }}: Failed to create PR rebuilding integrations.js Checkout Agent: ${{ steps.checkout-agent.outcome }} - Get Go Ref: ${{ steps.get-go-ref.outcome }} - Checkout Go: ${{ steps.checkout-go.outcome }} - Prepare Dependencies: ${{ steps.prep-deps.outcome }} + Prep python env and deps: ${{ steps.prep-deps.outcome }} Generate Integrations: ${{ steps.generate.outcome }} Generate Integrations Documentation: ${{ steps.generate-integrations-documentation.outcome }} Generate src/collectors/COLLECTORS.md: ${{ steps.generate-collectors-md.outcome }} diff --git a/.github/workflows/monitor-releases.yml b/.github/workflows/monitor-releases.yml index 69c84b2812fb81..77ec06bcf53a5e 100644 --- a/.github/workflows/monitor-releases.yml +++ b/.github/workflows/monitor-releases.yml @@ -31,7 +31,7 @@ jobs: run: | if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then echo "RELEASE_CHANNEL=${{ github.event.inputs.channel }}" >> "${GITHUB_ENV}" - else: + else echo "RELEASE_CHANNEL=stable" >> "${GITHUB_ENV}" fi - name: Init Python environment diff --git a/.github/workflows/repoconfig-packages.yml b/.github/workflows/repoconfig-packages.yml index f3d65a3e170f8d..8975fa4d49927f 100644 --- a/.github/workflows/repoconfig-packages.yml +++ b/.github/workflows/repoconfig-packages.yml @@ -126,13 +126,14 @@ jobs: id: package-upload if: github.event_name != 'pull_request' && github.repository == 'netdata/netdata' run: | - for arch in ${{ matrix.arches }}; do - for suffix in '' -edge -repoconfig ; do + # shellcheck disable=SC2043 + for arch in "${{ matrix.arches }}"; do + for suffix in '' -edge -repoconfig; do .github/scripts/package-upload.sh \ - ${{ matrix.pkgclouddistro }} \ - ${arch} \ - ${{ matrix.format }} \ - netdata/netdata${suffix} + "${{ matrix.pkgclouddistro }}" \ + "${arch}" \ + "${{ matrix.format }}" \ + netdata/netdata"${suffix}" done done - name: Failure Notification diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index c7b03813512d4b..30b09ec065925a 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest outputs: actionlint: ${{ steps.actionlint.outputs.run }} - clangformat: ${{ steps.clangformat.outputs.run }} + # clangformat: ${{ steps.clangformat.outputs.run }} flake8: ${{ steps.flake8.outputs.run }} golangci-lint: ${{ steps.golangci-lint.outputs.run }} hadolint: ${{ steps.hadolint.outputs.run }} @@ -65,11 +65,11 @@ jobs: run: | if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/golangci-lint') }}" = "true" ]; then echo "run=true" >> "${GITHUB_OUTPUT}" - elif git diff --name-only origin/${{ github.base_ref }} HEAD -- | grep -Eq '.*\.go' ; then - echo "run=true" >> $GITHUB_OUTPUT + elif git diff --name-only origin/"${{ github.base_ref }}" HEAD -- | grep -Eq '.*\.go'; then + echo "run=true" >> "${GITHUB_OUTPUT}" echo 'Go code has changed, need to run golangci-lint.' else - echo "run=false" >> $GITHUB_OUTPUT + echo "run=false" >> "${GITHUB_OUTPUT}" fi - name: Check files for hadolint id: hadolint @@ -122,38 +122,38 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} reporter: github-pr-check - clang-format: - name: clang-format - needs: prep-review - if: needs.prep-review.outputs.clangformat == 'true' - runs-on: ubuntu-latest - steps: - - name: Git clone repository - uses: actions/checkout@v4 - with: - submodules: false - fetch-depth: 0 - - name: Check for label - id: label - run: | - if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/clang-format') }}" = "true" ]; then - echo 'check-all=true' >> "${GITHUB_OUTPUT}" - else - echo 'check-all=false' >> "${GITHUB_OUTPUT}" - fi - - name: Run clang-format - run: | - if [ "${{ steps.label.outputs.check-all }}" == 'true' ]; then - find . -regex '.*\.\(c\|cpp\|cxx\|h\|hpp\|hxx\)$' -exec clang-format -i --style=file '{}' \; - else - git diff --name-only origin/${{ github.base_ref }} HEAD | grep -E '\.cpp$|\.cxx$|\.c$|\.hpp$|\.hxx$|\.h$' | \ - xargs -n 1 -r clang-format -i --style=file - fi - git status --porcelain=v1 > /tmp/porcelain - if [ -s /tmp/porcelain ]; then - cat /tmp/porcelain - exit 1 - fi +# clang-format: +# name: clang-format +# needs: prep-review +# if: needs.prep-review.outputs.clangformat == 'true' +# runs-on: ubuntu-latest +# steps: +# - name: Git clone repository +# uses: actions/checkout@v4 +# with: +# submodules: false +# fetch-depth: 0 +# - name: Check for label +# id: label +# run: | +# if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/clang-format') }}" = "true" ]; then +# echo 'check-all=true' >> "${GITHUB_OUTPUT}" +# else +# echo 'check-all=false' >> "${GITHUB_OUTPUT}" +# fi +# - name: Run clang-format +# run: | +# if [ "${{ steps.label.outputs.check-all }}" == 'true' ]; then +# find . -regex '.*\.\(c\|cpp\|cxx\|h\|hpp\|hxx\)$' -exec clang-format -i --style=file '{}' \; +# else +# git diff --name-only origin/${{ github.base_ref }} HEAD | grep -E '\.cpp$|\.cxx$|\.c$|\.hpp$|\.hxx$|\.h$' | \ +# xargs -n 1 -r clang-format -i --style=file +# fi +# git status --porcelain=v1 > /tmp/porcelain +# if [ -s /tmp/porcelain ]; then +# cat /tmp/porcelain +# exit 1 +# fi flake8: name: flake8