From 7f868a0a274328fb0852be0ec120c63d965591fd Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Thu, 3 Apr 2025 17:52:36 +0000 Subject: [PATCH 1/6] chore(ci): add shellcheck (#7) Reviewed-on: https://gitea.com/gitea/helm-actions/pulls/7 Reviewed-by: justusbunsi Co-authored-by: Markus Pesch Co-committed-by: Markus Pesch --- .editorconfig | 5 ++++- .gitea/workflows/shellcheck.yml | 14 ++++++++++++++ Makefile | 5 ++++- scripts/token.sh | 11 ++++++++--- 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 .gitea/workflows/shellcheck.yml diff --git a/.editorconfig b/.editorconfig index ebe51d3..e560cbb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,4 +9,7 @@ indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = false -insert_final_newline = false \ No newline at end of file +insert_final_newline = false + +[Makefile] +indent_style = tab \ No newline at end of file diff --git a/.gitea/workflows/shellcheck.yml b/.gitea/workflows/shellcheck.yml new file mode 100644 index 0000000..592c555 --- /dev/null +++ b/.gitea/workflows/shellcheck.yml @@ -0,0 +1,14 @@ +name: Lint Shell files + +on: + pull_request: + branches: ["*"] + types: ["opened", "reopened", "synchronize"] + +jobs: + shellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + - run: apt update --yes && apt install --yes shellcheck + - run: find . -type f -name "*.sh" -exec shellcheck -a {} \; diff --git a/Makefile b/Makefile index 9346d0e..24aba16 100644 --- a/Makefile +++ b/Makefile @@ -16,4 +16,7 @@ unittests-helm: .PHONY: helm update-helm-dependencies: helm dependency update - \ No newline at end of file + +.PHONY: yamllint +yamllint: + yamllint -c .yamllint . \ No newline at end of file diff --git a/scripts/token.sh b/scripts/token.sh index cbb2ebd..ac4fd37 100755 --- a/scripts/token.sh +++ b/scripts/token.sh @@ -8,9 +8,14 @@ check_token() { set +e echo "Checking for existing token..." - token="$(kubectl get secret "$SECRET_NAME" -o jsonpath="{.data['token']}" 2> /dev/null)" - [ $? -ne 0 ] && return 1 - [ -z "$token" ] && return 2 + if ! token=$(kubectl get secret "${SECRET_NAME}" -o jsonpath="{.data['token']}" 2> /dev/null); then + return 1 + fi + + if [ -z "${token}" ]; then + return 2 + fi + return 0 } -- 2.47.2 From 600ccc918483c3390e4b45cfecfb1faf3cbe3117 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Thu, 3 Apr 2025 20:43:59 +0200 Subject: [PATCH 2/6] chore(ci): add losisin/helm-values-schema-json-action --- .gitea/workflows/test-pr.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.gitea/workflows/test-pr.yml b/.gitea/workflows/test-pr.yml index c1d6f7f..49c71c7 100644 --- a/.gitea/workflows/test-pr.yml +++ b/.gitea/workflows/test-pr.yml @@ -47,3 +47,16 @@ jobs: git diff --exit-code --name-only README.md - name: yaml lint uses: https://github.com/ibiqlik/action-yamllint@v3 + + helm-schema-values: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + - name: Generate values schema json + uses: losisin/helm-values-schema-json-action@v1.8.0 + with: + input: values.yaml + - name: Verify values.schema.json + run: git diff --exit-code --name-only values.schema.json \ No newline at end of file -- 2.47.2 From 8c42d7320ab32dfb0c7a25e3396301ad8d57f4e0 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Thu, 3 Apr 2025 21:46:18 +0200 Subject: [PATCH 3/6] chore(ci): add losisin/helm-values-schema-json-action --- .gitea/workflows/test-pr.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/test-pr.yml b/.gitea/workflows/test-pr.yml index 49c71c7..35eafab 100644 --- a/.gitea/workflows/test-pr.yml +++ b/.gitea/workflows/test-pr.yml @@ -51,12 +51,10 @@ jobs: helm-schema-values: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - - name: Generate values schema json - uses: losisin/helm-values-schema-json-action@v1.8.0 - with: - input: values.yaml - - name: Verify values.schema.json - run: git diff --exit-code --name-only values.schema.json \ No newline at end of file + - uses: actions/checkout@v4 + - name: Generate values schema json + uses: losisin/helm-values-schema-json-action@v1.8.0 + with: + input: values.yaml + - name: Verify values.schema.json + run: git diff --exit-code --name-only values.schema.json \ No newline at end of file -- 2.47.2 From c9cdb60dc28612e0b835a81b3304c25ac74ecb46 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Thu, 3 Apr 2025 21:50:33 +0200 Subject: [PATCH 4/6] chore(ci): add losisin/helm-values-schema-json-action --- .gitea/workflows/test-pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/test-pr.yml b/.gitea/workflows/test-pr.yml index 35eafab..298107f 100644 --- a/.gitea/workflows/test-pr.yml +++ b/.gitea/workflows/test-pr.yml @@ -51,9 +51,9 @@ jobs: helm-schema-values: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.2.2 - name: Generate values schema json - uses: losisin/helm-values-schema-json-action@v1.8.0 + uses: losisin/helm-values-schema-json-action@v1.6.2 with: input: values.yaml - name: Verify values.schema.json -- 2.47.2 From c2c15fa1408dbeb9cbed573be70f7ee696926472 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Thu, 3 Apr 2025 21:54:14 +0200 Subject: [PATCH 5/6] asd --- values.schema.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 values.schema.json diff --git a/values.schema.json b/values.schema.json new file mode 100644 index 0000000..e69de29 -- 2.47.2 From c202087df8cdce80766a39b4d135769d359e2e63 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Thu, 3 Apr 2025 21:57:46 +0200 Subject: [PATCH 6/6] asdas --- .gitea/workflows/test-pr.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/test-pr.yml b/.gitea/workflows/test-pr.yml index 298107f..606212d 100644 --- a/.gitea/workflows/test-pr.yml +++ b/.gitea/workflows/test-pr.yml @@ -57,4 +57,7 @@ jobs: with: input: values.yaml - name: Verify values.schema.json - run: git diff --exit-code --name-only values.schema.json \ No newline at end of file + run: | + if ! git diff --exit-code --name-only values.schema.json; then + echo "Please update the values.schema.json and be carefully of breaking changes!" 2&>1 + fi \ No newline at end of file -- 2.47.2