From 9f420f51f0df1d4a55e39134e021dbdcd0979099 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Thu, 20 Jun 2024 17:55:53 +0200 Subject: [PATCH 001/244] Update stale.yml (#302) Avoid closing issues that have a milestone or with backlog/epic labels --- .github/workflows/stale.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 14d3a0c1..ddae2323 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -22,5 +22,7 @@ jobs: close-pr-message: "This PR was closed because it has been stalled for 7 days with no activity." stale-issue-label: "stale" stale-pr-label: "stale" + exempt-all-issue-milestones: true + exempt-issue-labels: "backlog, backlog candidate, epic" exempt-all-pr-assignees: true operations-per-run: 100 From 457e7b241769538b61a1ad0ef6ef67d54180515e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 00:44:55 -0700 Subject: [PATCH 002/244] Bump docker/build-push-action from 6.0.1 to 6.1.0 (#304) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.0.1 to 6.1.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/94f8f8c2eec4bc3f1d78c1755580779804cb87b2...31159d49c0d4756269a0940a750801a1ea5d7003) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa78f902..fa74fe59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 - name: Build Plus Docker Image - uses: docker/build-push-action@94f8f8c2eec4bc3f1d78c1755580779804cb87b2 # v6.0.1 + uses: docker/build-push-action@31159d49c0d4756269a0940a750801a1ea5d7003 # v6.1.0 with: file: docker/Dockerfile tags: nginx-plus From 0657e85378294dec223ab5c488b44ba815109380 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 07:47:07 +0000 Subject: [PATCH 003/244] Bump reviewdog/action-actionlint from 1.50.0 to 1.51.0 (#303) Bumps [reviewdog/action-actionlint](https://github.com/reviewdog/action-actionlint) from 1.50.0 to 1.51.0. - [Release notes](https://github.com/reviewdog/action-actionlint/releases) - [Commits](https://github.com/reviewdog/action-actionlint/compare/2927e858b45218240af952feb1d702cf6365f39a...afad3b6ab835e5611bda8c8193377e2d5c21413d) --- updated-dependencies: - dependency-name: reviewdog/action-actionlint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 062b0f90..eca8d549 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -39,7 +39,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: reviewdog/action-actionlint@2927e858b45218240af952feb1d702cf6365f39a # v1.50.0 + - uses: reviewdog/action-actionlint@afad3b6ab835e5611bda8c8193377e2d5c21413d # v1.51.0 with: actionlint_flags: -shellcheck "" From 8882a622da3b5f06f206c79c46ec31e3887f31a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 08:12:55 -0700 Subject: [PATCH 004/244] Bump docker/build-push-action from 6.1.0 to 6.2.0 (#305) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.1.0 to 6.2.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/31159d49c0d4756269a0940a750801a1ea5d7003...15560696de535e4014efeff63c48f16952e52dd1) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa74fe59..bec5a7e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 - name: Build Plus Docker Image - uses: docker/build-push-action@31159d49c0d4756269a0940a750801a1ea5d7003 # v6.1.0 + uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1 # v6.2.0 with: file: docker/Dockerfile tags: nginx-plus From d53bdb2815c0742bd00370d842345c5e0cd3536d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:15:02 +0000 Subject: [PATCH 005/244] Bump github/codeql-action from 3.25.10 to 3.25.11 (#306) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.10 to 3.25.11. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/23acc5c183826b7a8a97bce3cecc52db901f8251...b611370bb5703a7efb587f9d136a52ea24c5c38c) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecard.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 29cae928..529f182d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,7 +42,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10 + uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -60,7 +60,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10 + uses: github/codeql-action/autobuild@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 # â„šī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -73,6 +73,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10 + uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 9beee6c7..2d02c2f6 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10 + uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 with: sarif_file: results.sarif From 430d5821621bb71392d761725162b89c045729fb Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Mon, 1 Jul 2024 12:21:58 -0700 Subject: [PATCH 006/244] Use yamllint action from reviewdog (#307) --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependabot-auto-merge.yml | 2 +- .github/workflows/dependency-review.yml | 8 +++---- .github/workflows/fossa.yml | 2 +- .github/workflows/lint.yml | 25 ++++++++++----------- .github/workflows/scorecard.yml | 2 +- 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bec5a7e0..e375e9e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: go-version: [stable] steps: - name: Checkout Repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Golang Environment uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 @@ -53,7 +53,7 @@ jobs: if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Switch Repository (Nightly) if: (github.event_name == 'schedule') diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 529f182d..bf24e089 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 21ca570b..0d814572 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Dependabot metadata id: dependabot-metadata - uses: dependabot/fetch-metadata@v2.1.0 + uses: dependabot/fetch-metadata@5e5f99653a5b510e8555840e80cbf1514ad4af38 # v2.1.0 - name: Enable auto-merge for Dependabot PRs run: gh pr merge --auto --squash "$PR_URL" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index bcaafe65..2c962f4c 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -1,4 +1,4 @@ -name: "Dependency Review" +name: Dependency Review on: pull_request: branches: @@ -18,10 +18,10 @@ jobs: contents: read # for actions/checkout pull-requests: write # for actions/dependency-review-action to post comments steps: - - name: "Checkout Repository" - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: "Dependency Review" + - name: Dependency Review uses: actions/dependency-review-action@72eb03d02c7872a771aacd928f3123ac62ad6d3a # v4.3.3 with: config-file: "nginxinc/k8s-common/dependency-review-config.yml@main" diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index 3b1e67a1..9628beea 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -21,7 +21,7 @@ jobs: if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Scan uses: fossas/fossa-action@47ef11b1e1e3812e88dae436ccbd2d0cbd1adab0 # v1.3.3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index eca8d549..74939095 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,14 +22,14 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout Repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Golang Environment uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 with: go-version: stable - - name: Lint Code + - name: Lint Go uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1 actionlint: @@ -37,9 +37,10 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout Repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-actionlint@afad3b6ab835e5611bda8c8193377e2d5c21413d # v1.51.0 + - name: Lint Actions + uses: reviewdog/action-actionlint@afad3b6ab835e5611bda8c8193377e2d5c21413d # v1.51.0 with: actionlint_flags: -shellcheck "" @@ -48,9 +49,10 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout Repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: DavidAnson/markdownlint-cli2-action@b4c9feab76d8025d1e83c653fa3990936df0e6c8 # v16.0.0 + - name: Lint Markdown + uses: DavidAnson/markdownlint-cli2-action@b4c9feab76d8025d1e83c653fa3990936df0e6c8 # v16.0.0 with: config: .markdownlint-cli2.yaml globs: "**/*.md" @@ -58,12 +60,9 @@ jobs: yaml-lint: name: YAML lint - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - - - name: Install yamllint - run: pip install yamllint + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Lint YAML files - run: yamllint . + - name: Lint YAML + uses: reviewdog/action-yamllint@508148c0d959b166798f9792d1b29dddcac37348 # v1.16.0 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 2d02c2f6..b2823156 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -26,7 +26,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: persist-credentials: false From fcc1b560103eb9c1476d8163b649ff5368c6451f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 7 Jul 2024 22:44:09 -0700 Subject: [PATCH 007/244] Bump docker/build-push-action from 6.2.0 to 6.3.0 (#316) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.2.0 to 6.3.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/15560696de535e4014efeff63c48f16952e52dd1...1a162644f9a7e87d8f4b053101d1d9a712edc18c) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e375e9e7..1178129a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 - name: Build Plus Docker Image - uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1 # v6.2.0 + uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0 with: file: docker/Dockerfile tags: nginx-plus From 240fd6e676aacc8be79c6c09527ef5e5aebfce62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 05:46:17 +0000 Subject: [PATCH 008/244] Bump reviewdog/action-actionlint from 1.51.0 to 1.53.0 (#313) Bumps [reviewdog/action-actionlint](https://github.com/reviewdog/action-actionlint) from 1.51.0 to 1.53.0. - [Release notes](https://github.com/reviewdog/action-actionlint/releases) - [Commits](https://github.com/reviewdog/action-actionlint/compare/afad3b6ab835e5611bda8c8193377e2d5c21413d...d99f1ceaf59e7db022a790dc308ccccb68dda71a) --- updated-dependencies: - dependency-name: reviewdog/action-actionlint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 74939095..14d8a075 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -40,7 +40,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Lint Actions - uses: reviewdog/action-actionlint@afad3b6ab835e5611bda8c8193377e2d5c21413d # v1.51.0 + uses: reviewdog/action-actionlint@d99f1ceaf59e7db022a790dc308ccccb68dda71a # v1.53.0 with: actionlint_flags: -shellcheck "" From e583d1d55f15dc1150a1782ee445c01a237a0ccb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 05:48:13 +0000 Subject: [PATCH 009/244] Bump docker/setup-buildx-action from 3.3.0 to 3.4.0 (#315) Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3.3.0 to 3.4.0. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/d70bba72b1f3fd22344832f00baa16ece964efeb...4fd812986e6c8c2a69e18311145f9371337f27d4) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1178129a..1094415f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: sed -i 's|\${NGINX_PLUS_VERSION}/||g' docker/Dockerfile - name: Set up Docker Buildx - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0 - name: Build Plus Docker Image uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0 From 8c2ed8d9c7e86b8355f388373860c4e65f1212b1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 05:50:18 +0000 Subject: [PATCH 010/244] Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0 (#314) Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.1.0 to 2.2.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/5e5f99653a5b510e8555840e80cbf1514ad4af38...dbb049abf0d677abbd7f7eee0375145b417fdd34) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 0d814572..b56c3995 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Dependabot metadata id: dependabot-metadata - uses: dependabot/fetch-metadata@5e5f99653a5b510e8555840e80cbf1514ad4af38 # v2.1.0 + uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 # v2.2.0 - name: Enable auto-merge for Dependabot PRs run: gh pr merge --auto --squash "$PR_URL" From 47c9585c85316a43e6022d36caad55da6de9b781 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 05:52:38 +0000 Subject: [PATCH 011/244] Bump actions/upload-artifact from 4.3.3 to 4.3.4 (#312) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.3 to 4.3.4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/65462800fd760344b1a7b4382951275a0abb4808...0b2256b8c012f0828dc542b3febcab082c67f72b) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index b2823156..826800f0 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -49,7 +49,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: name: SARIF file path: results.sarif From a93f2e03d001009c8f84e799d06c9efafcc417d1 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 10 Jul 2024 14:01:24 -0700 Subject: [PATCH 012/244] Update CodeQL workflow (#308) --- .github/workflows/codeql-analysis.yml | 52 ++++++++++++--------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bf24e089..8ba2e740 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,4 +1,4 @@ -name: "CodeQL" +name: CodeQL on: push: @@ -23,28 +23,42 @@ jobs: name: Analyze runs-on: ubuntu-22.04 permissions: - actions: read - contents: read - security-events: write + actions: read # for github/codeql-action/init to get workflow details + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/autobuild to send a status report + packages: read # required to fetch internal or private CodeQL packs strategy: fail-fast: false matrix: - language: ["go"] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ] - # Use only 'java' to analyze code written in Java, Kotlin or both - # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + include: + - language: go + build-mode: autobuild + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages steps: - name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Setup Golang Environment + uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 + with: + go-version: stable + if: matrix.language == 'go' + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 with: languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. @@ -52,26 +66,6 @@ jobs: # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality - - name: Setup Golang Environment - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 - with: - go-version: stable - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 with: From d4b83da1e0f0173039152f37ad04d2fd1d15b0a2 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 10 Jul 2024 14:03:06 -0700 Subject: [PATCH 013/244] Add yamllint to pre-commit config (#309) --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4d22c42f..d654b38e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,5 +33,10 @@ repos: hooks: - id: markdownlint-cli2 + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.35.1 + hooks: + - id: yamllint + ci: skip: [golangci-lint-full] From 052c7d82f4ce2da95684fa63445b5777bc5047f3 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 10 Jul 2024 14:04:51 -0700 Subject: [PATCH 014/244] Add linters that check for bugs (#310) --- .golangci.yml | 6 ++++++ client/nginx.go | 12 ++++++------ client/nginx_test.go | 18 ++++++++++-------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index bc1fa939..26a1c209 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -34,14 +34,19 @@ linters: - asasalint - asciicheck - bidichk + - contextcheck - dupword + - durationcheck - errcheck + - errchkjson - errname - errorlint - exportloopref - fatcontext - forcetypeassert - gocheckcompilerdirectives + - gochecksumtype + - gocritic - godot - gofmt - gofumpt @@ -54,6 +59,7 @@ linters: - intrange - makezero - misspell + - musttag - nilerr - noctx - nolintlint diff --git a/client/nginx.go b/client/nginx.go index 0d8cce0e..1c375c16 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -83,9 +83,9 @@ type StreamUpstreamServer struct { } type apiErrorResponse struct { - RequestID string `json:"request_id"` - Href string - Error apiError + RequestID string `json:"request_id"` + Href string `json:"href"` + Error apiError `json:"error"` } func (resp *apiErrorResponse) toString() string { @@ -94,9 +94,9 @@ func (resp *apiErrorResponse) toString() string { } type apiError struct { - Text string - Code string - Status int + Text string `json:"text"` + Code string `json:"code"` + Status int `json:"status"` } type internalError struct { diff --git a/client/nginx_test.go b/client/nginx_test.go index e2e8ab3b..1f533972 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -602,19 +602,20 @@ func TestClientWithHTTPClient(t *testing.T) { func TestGetStats_NoStreamEndpoint(t *testing.T) { t.Parallel() ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.RequestURI == "/" { + switch { + case r.RequestURI == "/": _, err := w.Write([]byte(`[4, 5, 6, 7, 8, 9]`)) if err != nil { t.Fatalf("unexpected error: %v", err) } - } else if r.RequestURI == "/7/" { + case r.RequestURI == "/7/": _, err := w.Write([]byte(`["nginx","processes","connections","slabs","http","resolvers","ssl"]`)) if err != nil { t.Fatalf("unexpected error: %v", err) } - } else if strings.HasPrefix(r.RequestURI, "/7/stream") { + case strings.HasPrefix(r.RequestURI, "/7/stream"): t.Fatal("Stream endpoint should not be called since it does not exist.") - } else { + default: _, err := w.Write([]byte(`{}`)) if err != nil { t.Fatalf("unexpected error: %v", err) @@ -654,17 +655,18 @@ func TestGetStats_NoStreamEndpoint(t *testing.T) { func TestGetStats_SSL(t *testing.T) { t.Parallel() ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.RequestURI == "/" { + switch { + case r.RequestURI == "/": _, err := w.Write([]byte(`[4, 5, 6, 7, 8, 9]`)) if err != nil { t.Fatalf("unexpected error: %v", err) } - } else if r.RequestURI == "/8/" { + case r.RequestURI == "/8/": _, err := w.Write([]byte(`["nginx","processes","connections","slabs","http","resolvers","ssl","workers"]`)) if err != nil { t.Fatalf("unexpected error: %v", err) } - } else if strings.HasPrefix(r.RequestURI, "/8/ssl") { + case strings.HasPrefix(r.RequestURI, "/8/ssl"): _, err := w.Write([]byte(`{ "handshakes" : 79572, "handshakes_failed" : 21025, @@ -684,7 +686,7 @@ func TestGetStats_SSL(t *testing.T) { if err != nil { t.Fatalf("unexpected error: %v", err) } - } else { + default: _, err := w.Write([]byte(`{}`)) if err != nil { t.Fatalf("unexpected error: %v", err) From 56570a65cb5eb0c458d6865883418e7e00ff7443 Mon Sep 17 00:00:00 2001 From: Donal Hurley Date: Thu, 11 Jul 2024 18:47:17 +0100 Subject: [PATCH 015/244] Update keepalive field for http upstreams (#311) * fix: update keepalive field for http upstreams --------- Co-authored-by: Donal Hurley Co-authored-by: Venktesh Shivam Patel --- client/nginx.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/nginx.go b/client/nginx.go index 1c375c16..87503eca 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -358,11 +358,11 @@ type Upstreams map[string]Upstream // Upstream represents upstream related stats. type Upstream struct { - Zone string - Peers []Peer - Queue Queue - Keepalives int - Zombies int + Zone string + Peers []Peer + Queue Queue + Keepalive int + Zombies int } // StreamUpstreams is a map of stream upstream stats by upstream name. From ae19cee555d7e748a02dec0d931f42097fc3c49b Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Fri, 12 Jul 2024 12:35:47 -0700 Subject: [PATCH 016/244] Automatically close milestones (#318) --- .github/workflows/ci.yml | 3 ++- .goreleaser.yaml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1094415f..3f5224d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - go-version: [stable] + go-version: ["1.21", stable] steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -99,6 +99,7 @@ jobs: uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 with: go-version: stable + if: ${{ github.ref_type == 'tag' }} - name: Run GoReleaser uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 79aefaa1..5753ffc4 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -10,3 +10,6 @@ announce: enabled: true channel: "#announcements" message_template: "NGINX Plus Go Client {{ .Tag }} is out! Check it out: {{ .ReleaseURL }}" + +milestones: + - close: true From 344448eb3a4901b1546cabd98c30cda70d98c356 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2024 19:37:46 +0000 Subject: [PATCH 017/244] Bump actions/setup-go from 5.0.1 to 5.0.2 (#319) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.0.1 to 5.0.2. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/cdcb36043654635271a94b9a6d1392de5bb323a7...0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/lint.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f5224d6..538dda55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Golang Environment - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: go-version: ${{ matrix.go-version }} @@ -96,7 +96,7 @@ jobs: if: ${{ github.event_name == 'push' }} - name: Setup Golang Environment - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: go-version: stable if: ${{ github.ref_type == 'tag' }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8ba2e740..2037677f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -48,7 +48,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Golang Environment - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: go-version: stable if: matrix.language == 'go' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 14d8a075..4eb94d65 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,7 +25,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Golang Environment - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: go-version: stable From c870b12ac80fe62ae76c0b88ab07e61f1ff69e8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2024 19:40:03 +0000 Subject: [PATCH 018/244] Bump github/codeql-action from 3.25.11 to 3.25.12 (#320) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.11 to 3.25.12. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/b611370bb5703a7efb587f9d136a52ea24c5c38c...4fa2a7953630fd2f3fb380f21be14ede0169dd4f) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2037677f..e667251d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -55,7 +55,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 + uses: github/codeql-action/init@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -67,6 +67,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 + uses: github/codeql-action/analyze@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 826800f0..fa664ee2 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 + uses: github/codeql-action/upload-sarif@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 with: sarif_file: results.sarif From c9300cef5de9a4227f4e3df18d078b8b2627dc80 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2024 19:42:13 +0000 Subject: [PATCH 019/244] Bump reviewdog/action-yamllint from 1.16.0 to 1.17.0 (#322) Bumps [reviewdog/action-yamllint](https://github.com/reviewdog/action-yamllint) from 1.16.0 to 1.17.0. - [Release notes](https://github.com/reviewdog/action-yamllint/releases) - [Commits](https://github.com/reviewdog/action-yamllint/compare/508148c0d959b166798f9792d1b29dddcac37348...c23c5d4cd45b5cc16fa3e6e34073068b228cabeb) --- updated-dependencies: - dependency-name: reviewdog/action-yamllint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4eb94d65..fc41f244 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -65,4 +65,4 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Lint YAML - uses: reviewdog/action-yamllint@508148c0d959b166798f9792d1b29dddcac37348 # v1.16.0 + uses: reviewdog/action-yamllint@c23c5d4cd45b5cc16fa3e6e34073068b228cabeb # v1.17.0 From e86943a5cea36efeacb036b2f51d95639ccd4a51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 14 Jul 2024 20:10:46 -0700 Subject: [PATCH 020/244] Bump reviewdog/action-yamllint from 1.17.0 to 1.18.0 (#324) Bumps [reviewdog/action-yamllint](https://github.com/reviewdog/action-yamllint) from 1.17.0 to 1.18.0. - [Release notes](https://github.com/reviewdog/action-yamllint/releases) - [Commits](https://github.com/reviewdog/action-yamllint/compare/c23c5d4cd45b5cc16fa3e6e34073068b228cabeb...4e4ba96d03a0e12a0e71c29e5fef1db309d09201) --- updated-dependencies: - dependency-name: reviewdog/action-yamllint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fc41f244..229ced57 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -65,4 +65,4 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Lint YAML - uses: reviewdog/action-yamllint@c23c5d4cd45b5cc16fa3e6e34073068b228cabeb # v1.17.0 + uses: reviewdog/action-yamllint@4e4ba96d03a0e12a0e71c29e5fef1db309d09201 # v1.18.0 From 23b5b2fb25305a8fb7cf72733bec4e0ba5d6e5f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 03:12:52 +0000 Subject: [PATCH 021/244] Bump reviewdog/action-actionlint from 1.53.0 to 1.54.0 (#323) Bumps [reviewdog/action-actionlint](https://github.com/reviewdog/action-actionlint) from 1.53.0 to 1.54.0. - [Release notes](https://github.com/reviewdog/action-actionlint/releases) - [Commits](https://github.com/reviewdog/action-actionlint/compare/d99f1ceaf59e7db022a790dc308ccccb68dda71a...4f8f9963ca57a41e5fd5b538dd79dbfbd3e0b38a) --- updated-dependencies: - dependency-name: reviewdog/action-actionlint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 229ced57..2e054ad0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -40,7 +40,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Lint Actions - uses: reviewdog/action-actionlint@d99f1ceaf59e7db022a790dc308ccccb68dda71a # v1.53.0 + uses: reviewdog/action-actionlint@4f8f9963ca57a41e5fd5b538dd79dbfbd3e0b38a # v1.54.0 with: actionlint_flags: -shellcheck "" From c9762136679ab0394022096b55a3ece7a77d95f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 09:59:01 -0700 Subject: [PATCH 022/244] Bump docker/build-push-action from 6.3.0 to 6.4.0 (#325) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.3.0 to 6.4.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/1a162644f9a7e87d8f4b053101d1d9a712edc18c...a254f8ca60a858f3136a2f1f23a60969f2c402dd) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 538dda55..d4782284 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0 - name: Build Plus Docker Image - uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0 + uses: docker/build-push-action@a254f8ca60a858f3136a2f1f23a60969f2c402dd # v6.4.0 with: file: docker/Dockerfile tags: nginx-plus From d8e6ae91211a2e792ee3d861dfe9d431da76c180 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:12:49 +0000 Subject: [PATCH 023/244] Bump actions/dependency-review-action from 4.3.3 to 4.3.4 (#321) Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.3.3 to 4.3.4. - [Release notes](https://github.com/actions/dependency-review-action/releases) - [Commits](https://github.com/actions/dependency-review-action/compare/72eb03d02c7872a771aacd928f3123ac62ad6d3a...5a2ce3f5b92ee19cbb1541a4984c76d921601d7c) --- updated-dependencies: - dependency-name: actions/dependency-review-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/dependency-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 2c962f4c..fac275be 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -22,6 +22,6 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Dependency Review - uses: actions/dependency-review-action@72eb03d02c7872a771aacd928f3123ac62ad6d3a # v4.3.3 + uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4 with: config-file: "nginxinc/k8s-common/dependency-review-config.yml@main" From d00d5c8923c8f4e4763c66c055ed2cc2a3f27fb3 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 17 Jul 2024 08:31:08 -0700 Subject: [PATCH 024/244] Add doctoc to automatically generate TOCs (#326) --- .pre-commit-config.yaml | 6 ++++++ CONTRIBUTING.md | 30 ++++++++++++++++-------------- README.md | 17 ++++++++++++++++- release-process.md | 10 ++++++++++ 4 files changed, 48 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d654b38e..8084bdf5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,5 +38,11 @@ repos: hooks: - id: yamllint + - repo: https://github.com/thlorenz/doctoc + rev: v2.2.0 + hooks: + - id: doctoc + args: [--update-only, --title, "## Table of Contents"] + ci: skip: [golangci-lint-full] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d21b1b5..d11a7a6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,20 +3,22 @@ The following is a set of guidelines for contributing to the NGINX Plus Go Client. We really appreciate that you are considering contributing! -## Table Of Contents - -[Ask a Question](#ask-a-question) - -[Getting Started](#getting-started) - -[Contributing](#contributing) - -[Style Guides](#style-guides) - -- [Git Style Guide](#git-style-guide) -- [Go Style Guide](#go-style-guide) - -[Code of Conduct](CODE_OF_CONDUCT.md) + + +## Table of Contents + +- [Ask a Question](#ask-a-question) +- [Getting Started](#getting-started) +- [Contributing](#contributing) + - [Report a Bug](#report-a-bug) + - [Suggest an Enhancement](#suggest-an-enhancement) + - [Open a Pull Request](#open-a-pull-request) + - [Issue lifecycle](#issue-lifecycle) +- [Style Guides](#style-guides) + - [Git Style Guide](#git-style-guide) + - [Go Style Guide](#go-style-guide) + + ## Ask a Question diff --git a/README.md b/README.md index 652cea16..7aae2906 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - [![OpenSSFScorecard](https://api.securityscorecards.dev/projects/github.com/nginxinc/nginx-plus-go-client/badge)](https://api.securityscorecards.dev/projects/github.com/nginxinc/nginx-plus-go-client) [![Continuous Integration](https://github.com/nginxinc/nginx-plus-go-client/workflows/Continuous%20Integration/badge.svg)](https://github.com/nginxinc/nginx-plus-go-client/actions) @@ -15,6 +14,22 @@ This project includes a client library for working with NGINX Plus API. + + +## Table of Contents + +- [About the Client](#about-the-client) +- [Compatibility](#compatibility) +- [Using the Client](#using-the-client) +- [Testing](#testing) + - [Unit tests](#unit-tests) + - [Integration tests](#integration-tests) +- [Contacts](#contacts) +- [Contributing](#contributing) +- [Support](#support) + + + ## About the Client `client/nginx.go` includes functions and data structures for working with NGINX Plus API as well as some helper diff --git a/release-process.md b/release-process.md index 2ecfbdd6..e3bc9b53 100644 --- a/release-process.md +++ b/release-process.md @@ -2,6 +2,16 @@ This document outlines the steps involved in the release process for the NGINX Plus Go Client project. + + +## Table of Contents + +- [Versioning](#versioning) +- [Release Planning and Development](#release-planning-and-development) +- [Releasing a New Version](#releasing-a-new-version) + + + ## Versioning The project follows [Semantic Versioning](https://semver.org/) for versioning. From 9dd27a1562521144b61d43c367a4f5c77843fc38 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 09:42:53 -0700 Subject: [PATCH 025/244] Bump docker/setup-buildx-action from 3.4.0 to 3.5.0 (#330) Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3.4.0 to 3.5.0. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/4fd812986e6c8c2a69e18311145f9371337f27d4...aa33708b10e362ff993539393ff100fa93ed6a27) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4782284..dc087bcc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: sed -i 's|\${NGINX_PLUS_VERSION}/||g' docker/Dockerfile - name: Set up Docker Buildx - uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0 + uses: docker/setup-buildx-action@aa33708b10e362ff993539393ff100fa93ed6a27 # v3.5.0 - name: Build Plus Docker Image uses: docker/build-push-action@a254f8ca60a858f3136a2f1f23a60969f2c402dd # v6.4.0 From 910d8bb39c0884be9d277cac6013ffa54e91f2c2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:36:47 -0700 Subject: [PATCH 026/244] Bump github/codeql-action from 3.25.12 to 3.25.13 (#327) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.12 to 3.25.13. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/4fa2a7953630fd2f3fb380f21be14ede0169dd4f...2d790406f505036ef40ecba973cc774a50395aac) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e667251d..5324d498 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -55,7 +55,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 + uses: github/codeql-action/init@2d790406f505036ef40ecba973cc774a50395aac # v3.25.13 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -67,6 +67,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 + uses: github/codeql-action/analyze@2d790406f505036ef40ecba973cc774a50395aac # v3.25.13 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index fa664ee2..cb6df770 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 + uses: github/codeql-action/upload-sarif@2d790406f505036ef40ecba973cc774a50395aac # v3.25.13 with: sarif_file: results.sarif From f5fe3573b946b1e4302c801331e5e268457fc863 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 16:02:16 -0700 Subject: [PATCH 027/244] Bump docker/build-push-action from 6.4.0 to 6.5.0 (#329) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.4.0 to 6.5.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/a254f8ca60a858f3136a2f1f23a60969f2c402dd...5176d81f87c23d6fc96624dfdbcd9f3830bbe445) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc087bcc..97e848f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: uses: docker/setup-buildx-action@aa33708b10e362ff993539393ff100fa93ed6a27 # v3.5.0 - name: Build Plus Docker Image - uses: docker/build-push-action@a254f8ca60a858f3136a2f1f23a60969f2c402dd # v6.4.0 + uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0 with: file: docker/Dockerfile tags: nginx-plus From b02c7a8be58199268e5cc1c7e6228bd00f58d10b Mon Sep 17 00:00:00 2001 From: oliveromahony Date: Fri, 26 Jul 2024 09:43:33 +0100 Subject: [PATCH 028/244] added context timeout configuration for API requests (#331) * added context timeout configuration for API requests --- client/nginx.go | 28 +++++++++++++++++++++------- client/nginx_test.go | 22 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/client/nginx.go b/client/nginx.go index 87503eca..d5fff60f 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -35,6 +35,7 @@ var ( defaultBackup = false defaultDown = false defaultWeight = 1 + defaultTimeout = 10 * time.Second ) // ErrUnsupportedVer means that client's API version is not supported by NGINX plus API. @@ -46,6 +47,7 @@ type NginxClient struct { apiEndpoint string apiVersion int checkAPI bool + ctxTimeout time.Duration } type Option func(*NginxClient) @@ -546,6 +548,13 @@ func WithCheckAPI() Option { } } +// WithTimeout sets the timeout per request for the client. +func WithTimeout(duration time.Duration) Option { + return func(o *NginxClient) { + o.ctxTimeout = duration + } +} + // NewNginxClient creates a new NginxClient. func NewNginxClient(apiEndpoint string, opts ...Option) (*NginxClient, error) { c := &NginxClient{ @@ -553,6 +562,7 @@ func NewNginxClient(apiEndpoint string, opts ...Option) (*NginxClient, error) { apiEndpoint: apiEndpoint, apiVersion: APIVersion, checkAPI: false, + ctxTimeout: defaultTimeout, } for _, opt := range opts { @@ -567,8 +577,12 @@ func NewNginxClient(apiEndpoint string, opts ...Option) (*NginxClient, error) { return nil, fmt.Errorf("API version %v is not supported by the client", c.apiVersion) } + if c.ctxTimeout <= 0 { + return nil, fmt.Errorf("timeout has to be greater than 0 %v", c.ctxTimeout) + } + if c.checkAPI { - versions, err := getAPIVersions(c.httpClient, apiEndpoint) + versions, err := c.getAPIVersions(c.httpClient, apiEndpoint) if err != nil { return nil, fmt.Errorf("error accessing the API: %w", err) } @@ -596,8 +610,8 @@ func versionSupported(n int) bool { return false } -func getAPIVersions(httpClient *http.Client, endpoint string) (*versions, error) { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) +func (client *NginxClient) getAPIVersions(httpClient *http.Client, endpoint string) (*versions, error) { + ctx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) defer cancel() req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil) @@ -852,7 +866,7 @@ func (client *NginxClient) getIDOfHTTPServer(upstream string, name string) (int, } func (client *NginxClient) get(path string, data interface{}) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) defer cancel() url := fmt.Sprintf("%v/%v/%v", client.apiEndpoint, client.apiVersion, path) @@ -886,7 +900,7 @@ func (client *NginxClient) get(path string, data interface{}) error { } func (client *NginxClient) post(path string, input interface{}) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) defer cancel() url := fmt.Sprintf("%v/%v/%v", client.apiEndpoint, client.apiVersion, path) @@ -918,7 +932,7 @@ func (client *NginxClient) post(path string, input interface{}) error { } func (client *NginxClient) delete(path string, expectedStatusCode int) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) defer cancel() path = fmt.Sprintf("%v/%v/%v/", client.apiEndpoint, client.apiVersion, path) @@ -943,7 +957,7 @@ func (client *NginxClient) delete(path string, expectedStatusCode int) error { } func (client *NginxClient) patch(path string, input interface{}, expectedStatusCode int) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) defer cancel() path = fmt.Sprintf("%v/%v/%v/", client.apiEndpoint, client.apiVersion, path) diff --git a/client/nginx_test.go b/client/nginx_test.go index 1f533972..2cb8a7e8 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -6,6 +6,7 @@ import ( "reflect" "strings" "testing" + "time" ) func TestDetermineUpdates(t *testing.T) { @@ -578,6 +579,27 @@ func TestClientWithAPIVersion(t *testing.T) { } } +func TestClientWithTimeout(t *testing.T) { + t.Parallel() + // Test creating a new client with a supported API version on the client + client, err := NewNginxClient("http://api-url", WithTimeout(1*time.Second)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if client == nil { + t.Fatalf("client is nil") + } + + // Test creating a new client with an invalid duration + client, err = NewNginxClient("http://api-url", WithTimeout(-1*time.Second)) + if err == nil { + t.Fatalf("expected error, but got nil") + } + if client != nil { + t.Fatalf("expected client to be nil, but got %v", client) + } +} + func TestClientWithHTTPClient(t *testing.T) { t.Parallel() // Test creating a new client passing a custom HTTP client From 2cce06f063b6a3d425cf84772c3cc8c40b540ebf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jul 2024 16:57:27 +0000 Subject: [PATCH 029/244] Bump ossf/scorecard-action from 2.3.3 to 2.4.0 (#332) Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.3.3 to 2.4.0. - [Release notes](https://github.com/ossf/scorecard-action/releases) - [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md) - [Commits](https://github.com/ossf/scorecard-action/compare/dc50aa9510b46c811795eb24b2f1ba02a914e534...62b2cac7ed8198b15735ed49ab1e5cf35480ba46) --- updated-dependencies: - dependency-name: ossf/scorecard-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index cb6df770..383b51c1 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -31,7 +31,7 @@ jobs: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3 + uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 with: results_file: results.sarif results_format: sarif From c482c9be72d1b9187930d6ffafded6e751f44e89 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jul 2024 10:27:54 -0700 Subject: [PATCH 030/244] Bump github/codeql-action from 3.25.13 to 3.25.15 (#333) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.13 to 3.25.15. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/2d790406f505036ef40ecba973cc774a50395aac...afb54ba388a7dca6ecae48f608c4ff05ff4cc77a) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5324d498..ff73ec64 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -55,7 +55,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@2d790406f505036ef40ecba973cc774a50395aac # v3.25.13 + uses: github/codeql-action/init@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -67,6 +67,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@2d790406f505036ef40ecba973cc774a50395aac # v3.25.13 + uses: github/codeql-action/analyze@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 383b51c1..32dd669c 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@2d790406f505036ef40ecba973cc774a50395aac # v3.25.13 + uses: github/codeql-action/upload-sarif@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15 with: sarif_file: results.sarif From 560f6394d057b5bfef89e68f9037694dc7870e5e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 Aug 2024 22:34:09 -0700 Subject: [PATCH 031/244] Bump docker/setup-buildx-action from 3.5.0 to 3.6.1 (#336) Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3.5.0 to 3.6.1. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/aa33708b10e362ff993539393ff100fa93ed6a27...988b5a0280414f521da01fcc63a27aeeb4b104db) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97e848f7..78ac31c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: sed -i 's|\${NGINX_PLUS_VERSION}/||g' docker/Dockerfile - name: Set up Docker Buildx - uses: docker/setup-buildx-action@aa33708b10e362ff993539393ff100fa93ed6a27 # v3.5.0 + uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 - name: Build Plus Docker Image uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0 From 839371893ec8e23f1929e88150fe2eb104c78496 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 05:36:17 +0000 Subject: [PATCH 032/244] Bump golangci/golangci-lint-action from 6.0.1 to 6.1.0 (#335) Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.0.1 to 6.1.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/a4f60bb28d35aeee14e6880718e0c85ff1882e64...aaa42aa0628b4ae2578232a66b541047968fac86) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2e054ad0..79b9e3f0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -30,7 +30,7 @@ jobs: go-version: stable - name: Lint Go - uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1 + uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 actionlint: name: Actionlint From 698c8a6f74e584dd51d8fa5a32b945075a324eab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 Aug 2024 22:47:33 -0700 Subject: [PATCH 033/244] Bump actions/upload-artifact from 4.3.4 to 4.3.5 (#334) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.4 to 4.3.5. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/0b2256b8c012f0828dc542b3febcab082c67f72b...89ef406dd8d7e03cfd12d9e0a4a378f454709029) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 32dd669c..722e477e 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -49,7 +49,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 + uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5 with: name: SARIF file path: results.sarif From 1e17ec474c3a7e7299a0cef0887fd8e66ca6d836 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Fri, 9 Aug 2024 11:00:16 -0700 Subject: [PATCH 034/244] Add GetMaxAPIVersion to get max supported API (#337) --- client/nginx.go | 17 ++++++++++++ client/nginx_test.go | 64 ++++++++++++++++++++++++++++++++++++++++++++ docker/Dockerfile | 2 +- 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/client/nginx.go b/client/nginx.go index d5fff60f..5f366afb 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -610,6 +610,23 @@ func versionSupported(n int) bool { return false } +// GetMaxAPIVersion returns the maximum API version supported by the server and the client. +func (client *NginxClient) GetMaxAPIVersion() (int, error) { + serverVersions, err := client.getAPIVersions(client.httpClient, client.apiEndpoint) + if err != nil { + return 0, fmt.Errorf("failed to get max API version: %w", err) + } + + maxServerVersion := slices.Max(*serverVersions) + maxClientVersion := slices.Max(supportedAPIVersions) + + if maxServerVersion > maxClientVersion { + return maxClientVersion, nil + } + + return maxServerVersion, nil +} + func (client *NginxClient) getAPIVersions(httpClient *http.Client, endpoint string) (*versions, error) { ctx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) defer cancel() diff --git a/client/nginx_test.go b/client/nginx_test.go index 2cb8a7e8..312cf73c 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -752,3 +752,67 @@ func TestGetStats_SSL(t *testing.T) { t.Fatalf("SSL stats: expected %v, actual %v", testStats, stats.SSL) } } + +func TestGetMaxAPIVersionServer(t *testing.T) { + t.Parallel() + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch { + case r.RequestURI == "/": + _, err := w.Write([]byte(`[4, 5, 6, 7]`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + default: + _, err := w.Write([]byte(`{}`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + } + })) + defer ts.Close() + + c, err := NewNginxClient(ts.URL) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + maxVer, err := c.GetMaxAPIVersion() + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if maxVer != 7 { + t.Fatalf("expected 7, got %v", maxVer) + } +} + +func TestGetMaxAPIVersionClient(t *testing.T) { + t.Parallel() + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch { + case r.RequestURI == "/": + _, err := w.Write([]byte(`[4, 5, 6, 7, 8, 9, 25]`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + default: + _, err := w.Write([]byte(`{}`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + } + })) + defer ts.Close() + + c, err := NewNginxClient(ts.URL) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + maxVer, err := c.GetMaxAPIVersion() + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if maxVer != c.apiVersion { + t.Fatalf("expected %v, got %v", c.apiVersion, maxVer) + } +} diff --git a/docker/Dockerfile b/docker/Dockerfile index f4ddb379..91bf8c09 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.7 +# syntax=docker/dockerfile:1.8 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " From a43fed813ccf8dd666695cb6300a4195ce51703d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Aug 2024 11:21:13 -0700 Subject: [PATCH 035/244] Bump docker/build-push-action from 6.5.0 to 6.6.1 (#338) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.5.0 to 6.6.1. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/5176d81f87c23d6fc96624dfdbcd9f3830bbe445...16ebe778df0e7752d2cfcbd924afdbbd89c1a755) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78ac31c4..d571e10f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 - name: Build Plus Docker Image - uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0 + uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6.6.1 with: file: docker/Dockerfile tags: nginx-plus From 6f46f30fe885f4c60e3a687e7b7ac33525473651 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Aug 2024 18:23:36 +0000 Subject: [PATCH 036/244] Bump github/codeql-action from 3.25.15 to 3.26.0 (#339) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.15 to 3.26.0. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/afb54ba388a7dca6ecae48f608c4ff05ff4cc77a...eb055d739abdc2e8de2e5f4ba1a8b246daa779aa) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ff73ec64..57ce6fe9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -55,7 +55,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15 + uses: github/codeql-action/init@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -67,6 +67,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15 + uses: github/codeql-action/analyze@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 722e477e..250fb3de 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15 + uses: github/codeql-action/upload-sarif@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0 with: sarif_file: results.sarif From 903b76a42dd56d6cc0f96c0f15669d46d8dbda68 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Aug 2024 19:42:49 +0000 Subject: [PATCH 037/244] Bump actions/upload-artifact from 4.3.5 to 4.3.6 (#340) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.5 to 4.3.6. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/89ef406dd8d7e03cfd12d9e0a4a378f454709029...834a144ee995460fba8ed112a2fc961b36a5ec5a) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 250fb3de..d77659a4 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -49,7 +49,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 with: name: SARIF file path: results.sarif From 0194dbffd939b94f41f468a60e9a2c1c7c563b12 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Aug 2024 19:45:07 +0000 Subject: [PATCH 038/244] Bump fossas/fossa-action from 1.3.3 to 1.4.0 (#341) Bumps [fossas/fossa-action](https://github.com/fossas/fossa-action) from 1.3.3 to 1.4.0. - [Release notes](https://github.com/fossas/fossa-action/releases) - [Commits](https://github.com/fossas/fossa-action/compare/47ef11b1e1e3812e88dae436ccbd2d0cbd1adab0...09bcf127dc0ccb4b5a023f6f906728878e8610ba) --- updated-dependencies: - dependency-name: fossas/fossa-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/fossa.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index 9628beea..aecd3ad2 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -24,6 +24,6 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Scan - uses: fossas/fossa-action@47ef11b1e1e3812e88dae436ccbd2d0cbd1adab0 # v1.3.3 + uses: fossas/fossa-action@09bcf127dc0ccb4b5a023f6f906728878e8610ba # v1.4.0 with: api-key: ${{ secrets.FOSSA_TOKEN }} From aca294cdf098f709c490fd169002152f8ab0b197 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Thu, 15 Aug 2024 08:49:06 -0700 Subject: [PATCH 039/244] Update dependabot (#345) --- .github/dependabot.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 524f7914..93046bbf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,6 +6,7 @@ updates: interval: weekly - package-ecosystem: docker - directory: /docker + directories: + - "**/*" schedule: interval: weekly From 45012f40abd36239237cf942869420871d29fcb8 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Thu, 15 Aug 2024 09:04:40 -0700 Subject: [PATCH 040/244] Add go 1.22 to unit tests (#344) --- .github/workflows/ci.yml | 2 +- compose.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d571e10f..c9b5fc99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - go-version: ["1.21", stable] + go-version: ["1.21", "1.22", stable] steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 diff --git a/compose.yaml b/compose.yaml index d432656e..153ffc90 100644 --- a/compose.yaml +++ b/compose.yaml @@ -29,7 +29,7 @@ services: service: nginx test: - image: golang:1.21 + image: golang:1.23 volumes: - type: bind source: ./ From 6754c75fe002a7ce8058aa553121484e62f5b789 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:20:10 -0700 Subject: [PATCH 041/244] Bump github/codeql-action from 3.26.0 to 3.26.2 (#348) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.0 to 3.26.2. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/eb055d739abdc2e8de2e5f4ba1a8b246daa779aa...429e1977040da7a23b6822b13c129cd1ba93dbb2) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 57ce6fe9..005d4241 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -55,7 +55,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0 + uses: github/codeql-action/init@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -67,6 +67,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0 + uses: github/codeql-action/analyze@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index d77659a4..efdf783a 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0 + uses: github/codeql-action/upload-sarif@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2 with: sarif_file: results.sarif From 8b32309165dce82e5d780a96988881e1b2b2e367 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 16:22:43 +0000 Subject: [PATCH 042/244] Bump docker/build-push-action from 6.6.1 to 6.7.0 (#347) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.6.1 to 6.7.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/16ebe778df0e7752d2cfcbd924afdbbd89c1a755...5cd11c3a4ced054e52742c5fd54dca954e0edd85) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9b5fc99..43404fa5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 - name: Build Plus Docker Image - uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6.6.1 + uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0 with: file: docker/Dockerfile tags: nginx-plus From 2d16357a5212c8a235e282861a2e3a0ca576e185 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 16:25:05 +0000 Subject: [PATCH 043/244] Bump lucacome/draft-release from 1.1.0 to 1.1.1 (#346) Bumps [lucacome/draft-release](https://github.com/lucacome/draft-release) from 1.1.0 to 1.1.1. - [Release notes](https://github.com/lucacome/draft-release/releases) - [Commits](https://github.com/lucacome/draft-release/compare/8a63d32c79a171ae6048e614a8988f0ac3ed56d4...5d29432a46bff6c122cd4b07a1fb94e1bb158d34) --- updated-dependencies: - dependency-name: lucacome/draft-release dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43404fa5..6ee1329e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,7 +86,7 @@ jobs: run: docker compose up test-no-stream --exit-code-from test-no-stream - name: Create/Update Draft - uses: lucacome/draft-release@8a63d32c79a171ae6048e614a8988f0ac3ed56d4 # v1.1.0 + uses: lucacome/draft-release@5d29432a46bff6c122cd4b07a1fb94e1bb158d34 # v1.1.1 id: release-notes with: minor-label: "enhancement" From 1f669d1dbc2ab2b80d73293bdc7524c6cba166d7 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Thu, 15 Aug 2024 09:30:29 -0700 Subject: [PATCH 044/244] Use wrapped static errors (#343) --- .golangci.yml | 1 + client/nginx.go | 39 +++++++++++++++++++++++---------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 26a1c209..8aa1bca2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -32,6 +32,7 @@ linters-settings: linters: enable: - asasalint + - err113 - asciicheck - bidichk - contextcheck diff --git a/client/nginx.go b/client/nginx.go index 5f366afb..75e87c9e 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -38,8 +38,13 @@ var ( defaultTimeout = 10 * time.Second ) -// ErrUnsupportedVer means that client's API version is not supported by NGINX plus API. -var ErrUnsupportedVer = errors.New("API version of the client is not supported by running NGINX Plus") +var ( + ErrParameterRequired = errors.New("parameter is required") + ErrServerNotFound = errors.New("server not found") + ErrServerExists = errors.New("server already exists") + ErrNotSupported = errors.New("not supported") + ErrInvalidTimeout = errors.New("invalid timeout") +) // NginxClient lets you access NGINX Plus API. type NginxClient struct { @@ -570,15 +575,15 @@ func NewNginxClient(apiEndpoint string, opts ...Option) (*NginxClient, error) { } if c.httpClient == nil { - return nil, errors.New("http client is not set") + return nil, fmt.Errorf("http client: %w", ErrParameterRequired) } if !versionSupported(c.apiVersion) { - return nil, fmt.Errorf("API version %v is not supported by the client", c.apiVersion) + return nil, fmt.Errorf("API version %v: %w by the client", c.apiVersion, ErrNotSupported) } if c.ctxTimeout <= 0 { - return nil, fmt.Errorf("timeout has to be greater than 0 %v", c.ctxTimeout) + return nil, fmt.Errorf("timeout %q needs to be greater than 0: %w", c.ctxTimeout, ErrInvalidTimeout) } if c.checkAPI { @@ -594,7 +599,7 @@ func NewNginxClient(apiEndpoint string, opts ...Option) (*NginxClient, error) { } } if !found { - return nil, fmt.Errorf("API version %v is not supported by the server", c.apiVersion) + return nil, fmt.Errorf("API version %v: %w by the server", c.apiVersion, ErrNotSupported) } } @@ -642,7 +647,9 @@ func (client *NginxClient) getAPIVersions(httpClient *http.Client, endpoint stri defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("%v is not accessible: expected %v response, got %v", endpoint, http.StatusOK, resp.StatusCode) + return nil, createResponseMismatchError(resp.Body).Wrap(fmt.Sprintf( + "failed to get endpoint %q, expected %v response, got %v", + endpoint, http.StatusOK, resp.StatusCode)) } body, err := io.ReadAll(resp.Body) @@ -714,7 +721,7 @@ func (client *NginxClient) AddHTTPServer(upstream string, server UpstreamServer) return fmt.Errorf("failed to add %v server to %v upstream: %w", server.Server, upstream, err) } if id != -1 { - return fmt.Errorf("failed to add %v server to %v upstream: server already exists", server.Server, upstream) + return fmt.Errorf("failed to add %v server to %v upstream: %w", server.Server, upstream, ErrServerExists) } path := fmt.Sprintf("http/upstreams/%v/servers/", upstream) @@ -733,7 +740,7 @@ func (client *NginxClient) DeleteHTTPServer(upstream string, server string) erro return fmt.Errorf("failed to remove %v server from %v upstream: %w", server, upstream, err) } if id == -1 { - return fmt.Errorf("failed to remove %v server from %v upstream: server doesn't exist", server, upstream) + return fmt.Errorf("failed to remove %v server from %v upstream: %w", server, upstream, ErrServerNotFound) } path := fmt.Sprintf("http/upstreams/%v/servers/%v", upstream, id) @@ -1028,7 +1035,7 @@ func (client *NginxClient) AddStreamServer(upstream string, server StreamUpstrea return fmt.Errorf("failed to add %v stream server to %v upstream: %w", server.Server, upstream, err) } if id != -1 { - return fmt.Errorf("failed to add %v stream server to %v upstream: server already exists", server.Server, upstream) + return fmt.Errorf("failed to add %v stream server to %v upstream: %w", server.Server, upstream, ErrServerExists) } path := fmt.Sprintf("stream/upstreams/%v/servers/", upstream) @@ -1046,7 +1053,7 @@ func (client *NginxClient) DeleteStreamServer(upstream string, server string) er return fmt.Errorf("failed to remove %v stream server from %v upstream: %w", server, upstream, err) } if id == -1 { - return fmt.Errorf("failed to remove %v stream server from %v upstream: server doesn't exist", server, upstream) + return fmt.Errorf("failed to remove %v stream server from %v upstream: %w", server, upstream, ErrServerNotFound) } path := fmt.Sprintf("stream/upstreams/%v/servers/%v", upstream, id) @@ -1541,7 +1548,7 @@ func (client *NginxClient) getKeyValPairs(zone string, stream bool) (KeyValPairs base = "stream" } if zone == "" { - return nil, errors.New("zone required") + return nil, fmt.Errorf("zone: %w", ErrParameterRequired) } path := fmt.Sprintf("%v/keyvals/%v", base, zone) @@ -1594,7 +1601,7 @@ func (client *NginxClient) addKeyValPair(zone string, key string, val string, st base = "stream" } if zone == "" { - return errors.New("zone required") + return fmt.Errorf("zone: %w", ErrParameterRequired) } path := fmt.Sprintf("%v/keyvals/%v", base, zone) @@ -1622,7 +1629,7 @@ func (client *NginxClient) modifyKeyValPair(zone string, key string, val string, base = "stream" } if zone == "" { - return errors.New("zone required") + return fmt.Errorf("zone: %w", ErrParameterRequired) } path := fmt.Sprintf("%v/keyvals/%v", base, zone) @@ -1652,7 +1659,7 @@ func (client *NginxClient) deleteKeyValuePair(zone string, key string, stream bo base = "stream" } if zone == "" { - return errors.New("zone required") + return fmt.Errorf("zone: %w", ErrParameterRequired) } // map[string]string can't have a nil value so we use a different type here. @@ -1683,7 +1690,7 @@ func (client *NginxClient) deleteKeyValPairs(zone string, stream bool) error { base = "stream" } if zone == "" { - return errors.New("zone required") + return fmt.Errorf("zone: %w", ErrParameterRequired) } path := fmt.Sprintf("%v/keyvals/%v", base, zone) From 9d25b1164f6bf15fe782822dadf604ede4bf93d6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:52:36 -0700 Subject: [PATCH 045/244] Configure Renovate (#350) * Add renovate.json * Update renovate.json --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Luca Comellini --- renovate.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 renovate.json diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..01924e33 --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "github>nginxinc/k8s-common" + ] +} From 439ceef859dbfd2ec6e5de694da5c71ec1d95ec7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 01:53:32 +0000 Subject: [PATCH 046/244] Update pre-commit hook golangci/golangci-lint to v1.60.1 | datasource | package | from | to | | ----------- | ---------------------- | ------- | ------- | | github-tags | golangci/golangci-lint | v1.59.1 | v1.60.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8084bdf5..28dd1bad 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: fix-byte-order-marker - repo: https://github.com/golangci/golangci-lint - rev: v1.59.1 + rev: v1.60.1 hooks: - id: golangci-lint-full From 3f307c9c64b0f0b14e92fb260a9cee6f6ff78c36 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 19:28:41 -0700 Subject: [PATCH 047/244] Update github/codeql-action action to v3.26.3 (#351) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.26.2 | v3.26.3 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 005d4241..b17ae0c0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -55,7 +55,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2 + uses: github/codeql-action/init@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -67,6 +67,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2 + uses: github/codeql-action/analyze@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index efdf783a..4a3c9e9a 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2 + uses: github/codeql-action/upload-sarif@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3 with: sarif_file: results.sarif From 1bb4a6f8bcb205bb8aff35d024aa88824fd95894 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 19:54:36 -0700 Subject: [PATCH 048/244] Update docker/dockerfile Docker tag to v1.9 (#352) | datasource | package | from | to | | ---------- | ----------------- | ---- | --- | | docker | docker/dockerfile | 1.8 | 1.9 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 91bf8c09..d68f4312 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.8 +# syntax=docker/dockerfile:1.9 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " From 268dff67c447ce3265ae8199395bead20a616cb6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 23:24:08 +0000 Subject: [PATCH 049/244] Update github/codeql-action action to v3.26.4 | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.26.3 | v3.26.4 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b17ae0c0..ed7d8642 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -55,7 +55,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3 + uses: github/codeql-action/init@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # v3.26.4 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -67,6 +67,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3 + uses: github/codeql-action/analyze@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # v3.26.4 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 4a3c9e9a..5add4c68 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3 + uses: github/codeql-action/upload-sarif@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # v3.26.4 with: sarif_file: results.sarif From 553fdf4351182da4fea4a51a718df46835836d1c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 22:10:45 +0000 Subject: [PATCH 050/244] Update github/codeql-action action to v3.26.5 | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.26.4 | v3.26.5 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ed7d8642..59cd8abc 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -55,7 +55,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # v3.26.4 + uses: github/codeql-action/init@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -67,6 +67,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # v3.26.4 + uses: github/codeql-action/analyze@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 5add4c68..583b4516 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@f0f3afee809481da311ca3a6ff1ff51d81dbeb24 # v3.26.4 + uses: github/codeql-action/upload-sarif@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5 with: sarif_file: results.sarif From 62f8d0e64a1a0cddbec9031294bf5e0e1e987767 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 23:05:07 +0000 Subject: [PATCH 051/244] Update pre-commit hook golangci/golangci-lint to v1.60.3 | datasource | package | from | to | | ----------- | ---------------------- | ------- | ------- | | github-tags | golangci/golangci-lint | v1.60.1 | v1.60.3 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 28dd1bad..f0eb6329 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: fix-byte-order-marker - repo: https://github.com/golangci/golangci-lint - rev: v1.60.1 + rev: v1.60.3 hooks: - id: golangci-lint-full From deab83e8ec0e28eb0417814c4ec68443c72c32d7 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Tue, 27 Aug 2024 09:36:30 -0700 Subject: [PATCH 052/244] Remove dependabot and use labeler from common (#357) Removes the configuration files for dependabot and uses the `labeler.yml` config in https://github.com/nginxinc/k8s-common --- .github/dependabot.yml | 12 --------- .github/labeler.yml | 27 --------------------- .github/workflows/ci.yml | 2 +- .github/workflows/dependabot-auto-merge.yml | 24 ------------------ .github/workflows/labeler.yml | 8 ++++++ .github/workflows/lint.yml | 2 ++ .golangci.yml | 4 +-- .pre-commit-config.yaml | 6 +++++ Makefile | 5 +++- renovate.json | 9 ++++--- 10 files changed, 28 insertions(+), 71 deletions(-) delete mode 100644 .github/dependabot.yml delete mode 100644 .github/labeler.yml delete mode 100644 .github/workflows/dependabot-auto-merge.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 93046bbf..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: 2 -updates: - - package-ecosystem: github-actions - directory: / - schedule: - interval: weekly - - - package-ecosystem: docker - directories: - - "**/*" - schedule: - interval: weekly diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index b4337344..00000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,27 +0,0 @@ -change: - - head-branch: ["^change/"] - -enhancement: - - head-branch: ["^feature/", "^feat/", "^enhancement/", "^enh/"] - -bug: - - head-branch: ["^fix/", "^bug/"] - -chore: - - head-branch: ["^chore/"] - -tests: - - head-branch: ["^tests/", "^test/"] - - changed-files: - - any-glob-to-any-file: "tests/**/*" - -documentation: - - head-branch: ["^docs/", "^doc/"] - - changed-files: - - any-glob-to-any-file: "**/*.md" - -dependencies: - - head-branch: - ["^deps/", "^dep/", "^dependabot/", "pre-commit-ci-update-config"] - - changed-files: - - any-glob-to-any-file: ["go.mod", "go.sum"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ee1329e..90469a8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,7 +104,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 with: - version: latest + version: v2.2.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml deleted file mode 100644 index b56c3995..00000000 --- a/.github/workflows/dependabot-auto-merge.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Dependabot auto-merge - -on: pull_request_target - -permissions: - contents: read - -jobs: - dependabot: - runs-on: ubuntu-22.04 - permissions: - pull-requests: write - contents: write - if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} - steps: - - name: Dependabot metadata - id: dependabot-metadata - uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 # v2.2.0 - - - name: Enable auto-merge for Dependabot PRs - run: gh pr merge --auto --squash "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{ secrets.NGINX_PAT }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index d62990da..e56a9a15 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -12,7 +12,15 @@ jobs: pull-requests: write # for actions/labeler to add labels runs-on: ubuntu-22.04 steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + sparse-checkout: | + labeler.yml + sparse-checkout-cone-mode: false + repository: nginxinc/k8s-common + - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" sync-labels: true + configuration-path: labeler.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 79b9e3f0..6e52ecae 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -31,6 +31,8 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 + with: + version: v1.60.1 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.golangci.yml b/.golangci.yml index 8aa1bca2..3ec52004 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -32,17 +32,17 @@ linters-settings: linters: enable: - asasalint - - err113 - asciicheck - bidichk - contextcheck + - copyloopvar - dupword - durationcheck + - err113 - errcheck - errchkjson - errname - errorlint - - exportloopref - fatcontext - forcetypeassert - gocheckcompilerdirectives diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f0eb6329..03036433 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,12 +11,17 @@ repos: - id: check-added-large-files - id: check-merge-conflict - id: check-shebang-scripts-are-executable + - id: check-executables-have-shebangs - id: check-case-conflict - id: check-vcs-permalinks + - id: check-json + - id: pretty-format-json + args: [--autofix, --no-ensure-ascii] - id: mixed-line-ending args: [--fix=lf] - id: no-commit-to-branch - id: fix-byte-order-marker + - id: detect-private-key - repo: https://github.com/golangci/golangci-lint rev: v1.60.3 @@ -46,3 +51,4 @@ repos: ci: skip: [golangci-lint-full] + autoupdate_schedule: quarterly # We use renovate for more frequent updates and there's no way to disable autoupdate diff --git a/Makefile b/Makefile index 1c61ea77..d514c33d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ +# renovate: datasource=github-tags depName=golangci/golangci-lint +GOLANGCI_LINT_VERSION = v1.60.1 + test: unit-test test-integration test-integration-no-stream-block clean lint: - docker run --pull always --rm -v $(shell pwd):/nginx-plus-go-client -w /nginx-plus-go-client -v $(shell go env GOCACHE):/cache/go -e GOCACHE=/cache/go -e GOLANGCI_LINT_CACHE=/cache/go -v $(shell go env GOPATH)/pkg:/go/pkg golangci/golangci-lint:latest golangci-lint --color always run + docker run --pull always --rm -v $(shell pwd):/nginx-plus-go-client -w /nginx-plus-go-client -v $(shell go env GOCACHE):/cache/go -e GOCACHE=/cache/go -e GOLANGCI_LINT_CACHE=/cache/go -v $(shell go env GOPATH)/pkg:/go/pkg golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) golangci-lint --color always run unit-test: go test -v -shuffle=on -race client/*.go diff --git a/renovate.json b/renovate.json index 01924e33..8bf65f91 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,7 @@ { - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "github>nginxinc/k8s-common" - ] + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "github>nginxinc/k8s-common", + "schedule:earlyMondays" + ] } From 23b485e7a5c4c6b6b53ac4b45b4b598f6c9c98a8 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Tue, 27 Aug 2024 09:39:10 -0700 Subject: [PATCH 053/244] Update Go to 1.22 (#356) --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 4fc51a45..5b6000bc 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/nginxinc/nginx-plus-go-client -go 1.21.2 +go 1.22.6 From 1f9091bdc5435bb5e6127c8096238ccbca4b7b6e Mon Sep 17 00:00:00 2001 From: oliveromahony Date: Mon, 2 Sep 2024 10:48:07 +0100 Subject: [PATCH 054/244] Call NGINX Plus API in a series of parallel requests (#360) * add parallel calls to call GetStats. Added context to the underlying calls in some places. Additional PR required needed for the remaining work as the intention was to keep this PR as small as possible --- client/nginx.go | 582 +++++++++++++++++++++++++++++++++---------- client/nginx_test.go | 121 ++++++--- go.mod | 2 + go.sum | 2 + 4 files changed, 547 insertions(+), 160 deletions(-) diff --git a/client/nginx.go b/client/nginx.go index 75e87c9e..7a76d41c 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -11,7 +11,10 @@ import ( "reflect" "slices" "strings" + "sync" "time" + + "golang.org/x/sync/errgroup" ) const ( @@ -123,6 +126,40 @@ func (internalError *internalError) Wrap(err string) *internalError { return internalError } +// this is an internal representation of the Stats object including endpoint and streamEndpoint lists. +type extendedStats struct { + endpoints []string + streamEndpoints []string + Stats +} + +func defaultStats() *extendedStats { + return &extendedStats{ + endpoints: []string{}, + streamEndpoints: []string{}, + Stats: Stats{ + Upstreams: map[string]Upstream{}, + ServerZones: map[string]ServerZone{}, + StreamServerZones: map[string]StreamServerZone{}, + StreamUpstreams: map[string]StreamUpstream{}, + Slabs: map[string]Slab{}, + Caches: map[string]HTTPCache{}, + HTTPLimitConnections: map[string]LimitConnection{}, + StreamLimitConnections: map[string]LimitConnection{}, + HTTPLimitRequests: map[string]HTTPLimitRequest{}, + Resolvers: map[string]Resolver{}, + LocationZones: map[string]LocationZone{}, + StreamZoneSync: nil, + Workers: []*Workers{}, + NginxInfo: NginxInfo{}, + SSL: SSL{}, + Connections: Connections{}, + HTTPRequests: HTTPRequests{}, + Processes: Processes{}, + }, + } +} + // Stats represents NGINX Plus stats fetched from the NGINX Plus API. // https://nginx.org/en/docs/http/ngx_http_api_module.html type Stats struct { @@ -890,9 +927,13 @@ func (client *NginxClient) getIDOfHTTPServer(upstream string, name string) (int, } func (client *NginxClient) get(path string, data interface{}) error { - ctx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) + timeoutCtx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) defer cancel() + return client.getWithContext(timeoutCtx, path, data) +} + +func (client *NginxClient) getWithContext(ctx context.Context, path string, data interface{}) error { url := fmt.Sprintf("%v/%v/%v", client.apiEndpoint, client.apiVersion, path) req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) @@ -924,9 +965,13 @@ func (client *NginxClient) get(path string, data interface{}) error { } func (client *NginxClient) post(path string, input interface{}) error { - ctx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) + timeoutCtx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) defer cancel() + return client.postWithContext(timeoutCtx, path, input) +} + +func (client *NginxClient) postWithContext(ctx context.Context, path string, input interface{}) error { url := fmt.Sprintf("%v/%v/%v", client.apiEndpoint, client.apiVersion, path) jsonInput, err := json.Marshal(input) @@ -956,9 +1001,13 @@ func (client *NginxClient) post(path string, input interface{}) error { } func (client *NginxClient) delete(path string, expectedStatusCode int) error { - ctx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) + timeoutCtx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) defer cancel() + return client.deleteWithContext(timeoutCtx, path, expectedStatusCode) +} + +func (client *NginxClient) deleteWithContext(ctx context.Context, path string, expectedStatusCode int) error { path = fmt.Sprintf("%v/%v/%v/", client.apiEndpoint, client.apiVersion, path) req, err := http.NewRequestWithContext(ctx, http.MethodDelete, path, nil) @@ -981,9 +1030,13 @@ func (client *NginxClient) delete(path string, expectedStatusCode int) error { } func (client *NginxClient) patch(path string, input interface{}, expectedStatusCode int) error { - ctx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) + timeoutCtx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) defer cancel() + return client.patchWithContext(timeoutCtx, path, input, expectedStatusCode) +} + +func (client *NginxClient) patchWithContext(ctx context.Context, path string, input interface{}, expectedStatusCode int) error { path = fmt.Sprintf("%v/%v/%v/", client.apiEndpoint, client.apiVersion, path) jsonInput, err := json.Marshal(input) @@ -1199,149 +1252,321 @@ func determineStreamUpdates(updatedServers []StreamUpstreamServer, nginxServers return } -// GetStats gets process, slab, connection, request, ssl, zone, stream zone, upstream and stream upstream related stats from the NGINX Plus API. -func (client *NginxClient) GetStats() (*Stats, error) { - endpoints, err := client.GetAvailableEndpoints() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } +// GetStatsWithContext gets process, slab, connection, request, ssl, zone, stream zone, upstream and stream upstream related stats from the NGINX Plus API. +func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, error) { + initialGroup, initialCtx := errgroup.WithContext(ctx) + var mu sync.Mutex + stats := defaultStats() + // Collecting initial stats + initialGroup.Go(func() error { + endpoints, err := client.GetAvailableEndpointsWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get available Endpoints: %w", err) + } - info, err := client.GetNginxInfo() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + mu.Lock() + stats.endpoints = endpoints + mu.Unlock() + return nil + }) - caches, err := client.GetCaches() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + initialGroup.Go(func() error { + nginxInfo, err := client.GetNginxInfoWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get NGINX info: %w", err) + } - processes, err := client.GetProcesses() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + mu.Lock() + stats.NginxInfo = *nginxInfo + mu.Unlock() - slabs, err := client.GetSlabs() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + return nil + }) - cons, err := client.GetConnections() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + initialGroup.Go(func() error { + caches, err := client.GetCachesWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get Caches: %w", err) + } - requests, err := client.GetHTTPRequests() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + mu.Lock() + stats.Caches = *caches + mu.Unlock() - ssl, err := client.GetSSL() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + return nil + }) - zones, err := client.GetServerZones() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + initialGroup.Go(func() error { + processes, err := client.GetProcessesWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get Process information: %w", err) + } - upstreams, err := client.GetUpstreams() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + mu.Lock() + stats.Processes = *processes + mu.Unlock() - locationZones, err := client.GetLocationZones() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + return nil + }) - resolvers, err := client.GetResolvers() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + initialGroup.Go(func() error { + slabs, err := client.GetSlabsWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get Slabs: %w", err) + } - limitReqs, err := client.GetHTTPLimitReqs() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + mu.Lock() + stats.Slabs = *slabs + mu.Unlock() - limitConnsHTTP, err := client.GetHTTPConnectionsLimit() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + return nil + }) - workers, err := client.GetWorkers() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + initialGroup.Go(func() error { + httpRequests, err := client.GetHTTPRequestsWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get HTTP Requests: %w", err) + } + + mu.Lock() + stats.HTTPRequests = *httpRequests + mu.Unlock() - streamZones := &StreamServerZones{} - streamUpstreams := &StreamUpstreams{} - limitConnsStream := &StreamLimitConnections{} - var streamZoneSync *StreamZoneSync + return nil + }) - if slices.Contains(endpoints, "stream") { - streamEndpoints, err := client.GetAvailableStreamEndpoints() + initialGroup.Go(func() error { + ssl, err := client.GetSSLWithContext(initialCtx) if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) + return fmt.Errorf("failed to get SSL: %w", err) } - if slices.Contains(streamEndpoints, "server_zones") { - streamZones, err = client.GetStreamServerZones() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + mu.Lock() + stats.SSL = *ssl + mu.Unlock() + + return nil + }) + + initialGroup.Go(func() error { + serverZones, err := client.GetServerZonesWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get Server Zones: %w", err) } - if slices.Contains(streamEndpoints, "upstreams") { - streamUpstreams, err = client.GetStreamUpstreams() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + mu.Lock() + stats.ServerZones = *serverZones + mu.Unlock() + + return nil + }) + + initialGroup.Go(func() error { + upstreams, err := client.GetUpstreamsWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get Upstreams: %w", err) } - if slices.Contains(streamEndpoints, "limit_conns") { - limitConnsStream, err = client.GetStreamConnectionsLimit() - if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) - } + mu.Lock() + stats.Upstreams = *upstreams + mu.Unlock() + + return nil + }) + + initialGroup.Go(func() error { + locationZones, err := client.GetLocationZonesWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get Location Zones: %w", err) + } + + mu.Lock() + stats.LocationZones = *locationZones + mu.Unlock() + + return nil + }) + + initialGroup.Go(func() error { + resolvers, err := client.GetResolversWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get Resolvers: %w", err) + } + + mu.Lock() + stats.Resolvers = *resolvers + mu.Unlock() + + return nil + }) + + initialGroup.Go(func() error { + httpLimitRequests, err := client.GetHTTPLimitReqsWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get HTTPLimitRequests: %w", err) + } + + mu.Lock() + stats.HTTPLimitRequests = *httpLimitRequests + mu.Unlock() + + return nil + }) + + initialGroup.Go(func() error { + httpLimitConnections, err := client.GetHTTPConnectionsLimitWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get HTTPLimitConnections: %w", err) } - if slices.Contains(streamEndpoints, "zone_sync") { - streamZoneSync, err = client.GetStreamZoneSync() + mu.Lock() + stats.HTTPLimitConnections = *httpLimitConnections + mu.Unlock() + + return nil + }) + + initialGroup.Go(func() error { + workers, err := client.GetWorkersWithContext(initialCtx) + if err != nil { + return fmt.Errorf("failed to get Workers: %w", err) + } + + mu.Lock() + stats.Workers = workers + mu.Unlock() + + return nil + }) + + if err := initialGroup.Wait(); err != nil { + return nil, fmt.Errorf("error returned from contacting Plus API: %w", err) + } + + // Process stream endpoints if they exist + if slices.Contains(stats.endpoints, "stream") { + availableStreamGroup, asgCtx := errgroup.WithContext(ctx) + + availableStreamGroup.Go(func() error { + streamEndpoints, err := client.GetAvailableStreamEndpointsWithContext(asgCtx) if err != nil { - return nil, fmt.Errorf("failed to get stats: %w", err) + return fmt.Errorf("failed to get available Stream Endpoints: %w", err) } + + mu.Lock() + stats.streamEndpoints = streamEndpoints + mu.Unlock() + + return nil + }) + + if err := availableStreamGroup.Wait(); err != nil { + return nil, fmt.Errorf("no useful metrics found in stream stats: %w", err) + } + + streamGroup, sgCtx := errgroup.WithContext(ctx) + + if slices.Contains(stats.streamEndpoints, "server_zones") { + streamGroup.Go(func() error { + streamServerZones, err := client.GetStreamServerZonesWithContext(sgCtx) + if err != nil { + return fmt.Errorf("failed to get streamServerZones: %w", err) + } + + mu.Lock() + stats.StreamServerZones = *streamServerZones + mu.Unlock() + + return nil + }) + } + + if slices.Contains(stats.streamEndpoints, "upstreams") { + streamGroup.Go(func() error { + streamUpstreams, err := client.GetStreamUpstreamsWithContext(sgCtx) + if err != nil { + return fmt.Errorf("failed to get StreamUpstreams: %w", err) + } + + mu.Lock() + stats.StreamUpstreams = *streamUpstreams + mu.Unlock() + + return nil + }) + } + + if slices.Contains(stats.streamEndpoints, "limit_conns") { + streamGroup.Go(func() error { + streamConnectionsLimit, err := client.GetStreamConnectionsLimitWithContext(sgCtx) + if err != nil { + return fmt.Errorf("failed to get StreamLimitConnections: %w", err) + } + + mu.Lock() + stats.StreamLimitConnections = *streamConnectionsLimit + mu.Unlock() + + return nil + }) + + streamGroup.Go(func() error { + streamZoneSync, err := client.GetStreamZoneSyncWithContext(sgCtx) + if err != nil { + return fmt.Errorf("failed to get StreamZoneSync: %w", err) + } + + mu.Lock() + stats.StreamZoneSync = streamZoneSync + mu.Unlock() + + return nil + }) + } + + if err := streamGroup.Wait(); err != nil { + return nil, fmt.Errorf("no useful metrics found in stream stats: %w", err) } } - return &Stats{ - NginxInfo: *info, - Caches: *caches, - Processes: *processes, - Slabs: *slabs, - Connections: *cons, - HTTPRequests: *requests, - SSL: *ssl, - ServerZones: *zones, - StreamServerZones: *streamZones, - Upstreams: *upstreams, - StreamUpstreams: *streamUpstreams, - StreamZoneSync: streamZoneSync, - LocationZones: *locationZones, - Resolvers: *resolvers, - HTTPLimitRequests: *limitReqs, - HTTPLimitConnections: *limitConnsHTTP, - StreamLimitConnections: *limitConnsStream, - Workers: workers, - }, nil + // Report connection metrics separately so it does not influence the results + connectionsGroup, cgCtx := errgroup.WithContext(ctx) + + connectionsGroup.Go(func() error { + // replace this call with a context specific call + connections, err := client.GetConnectionsWithContext(cgCtx) + if err != nil { + return fmt.Errorf("failed to get connections: %w", err) + } + + mu.Lock() + stats.Connections = *connections + mu.Unlock() + + return nil + }) + + if err := connectionsGroup.Wait(); err != nil { + return nil, fmt.Errorf("connections metrics not found: %w", err) + } + + return &stats.Stats, nil +} + +// GetStats gets process, slab, connection, request, ssl, zone, stream zone, upstream and stream upstream related stats from the NGINX Plus API. +func (client *NginxClient) GetStats() (*Stats, error) { + return client.GetStatsWithContext(context.Background()) } // GetAvailableEndpoints returns available endpoints in the API. func (client *NginxClient) GetAvailableEndpoints() ([]string, error) { + return client.GetAvailableEndpointsWithContext(context.Background()) +} + +// GetAvailableEndpointsWithContext returns available endpoints in the API. +func (client *NginxClient) GetAvailableEndpointsWithContext(ctx context.Context) ([]string, error) { var endpoints []string - err := client.get("", &endpoints) + err := client.getWithContext(ctx, "", &endpoints) if err != nil { return nil, fmt.Errorf("failed to get endpoints: %w", err) } @@ -1350,8 +1575,13 @@ func (client *NginxClient) GetAvailableEndpoints() ([]string, error) { // GetAvailableStreamEndpoints returns available stream endpoints in the API. func (client *NginxClient) GetAvailableStreamEndpoints() ([]string, error) { + return client.GetAvailableStreamEndpointsWithContext(context.Background()) +} + +// GetAvailableStreamEndpointsWithContext returns available stream endpoints in the API with a context. +func (client *NginxClient) GetAvailableStreamEndpointsWithContext(ctx context.Context) ([]string, error) { var endpoints []string - err := client.get("stream", &endpoints) + err := client.getWithContext(ctx, "stream", &endpoints) if err != nil { return nil, fmt.Errorf("failed to get endpoints: %w", err) } @@ -1360,8 +1590,13 @@ func (client *NginxClient) GetAvailableStreamEndpoints() ([]string, error) { // GetNginxInfo returns Nginx stats. func (client *NginxClient) GetNginxInfo() (*NginxInfo, error) { + return client.GetNginxInfoWithContext(context.Background()) +} + +// GetNginxInfoWithContext returns Nginx stats with a context. +func (client *NginxClient) GetNginxInfoWithContext(ctx context.Context) (*NginxInfo, error) { var info NginxInfo - err := client.get("nginx", &info) + err := client.getWithContext(ctx, "nginx", &info) if err != nil { return nil, fmt.Errorf("failed to get info: %w", err) } @@ -1370,8 +1605,13 @@ func (client *NginxClient) GetNginxInfo() (*NginxInfo, error) { // GetCaches returns Cache stats. func (client *NginxClient) GetCaches() (*Caches, error) { + return client.GetCachesWithContext(context.Background()) +} + +// GetCachesWithContext returns Cache stats with a context. +func (client *NginxClient) GetCachesWithContext(ctx context.Context) (*Caches, error) { var caches Caches - err := client.get("http/caches", &caches) + err := client.getWithContext(ctx, "http/caches", &caches) if err != nil { return nil, fmt.Errorf("failed to get caches: %w", err) } @@ -1380,8 +1620,13 @@ func (client *NginxClient) GetCaches() (*Caches, error) { // GetSlabs returns Slabs stats. func (client *NginxClient) GetSlabs() (*Slabs, error) { + return client.GetSlabsWithContext(context.Background()) +} + +// GetSlabsWithContext returns Slabs stats with a context. +func (client *NginxClient) GetSlabsWithContext(ctx context.Context) (*Slabs, error) { var slabs Slabs - err := client.get("slabs", &slabs) + err := client.getWithContext(ctx, "slabs", &slabs) if err != nil { return nil, fmt.Errorf("failed to get slabs: %w", err) } @@ -1390,8 +1635,13 @@ func (client *NginxClient) GetSlabs() (*Slabs, error) { // GetConnections returns Connections stats. func (client *NginxClient) GetConnections() (*Connections, error) { + return client.GetConnectionsWithContext(context.Background()) +} + +// GetConnectionsWithContext returns Connections stats with a context. +func (client *NginxClient) GetConnectionsWithContext(ctx context.Context) (*Connections, error) { var cons Connections - err := client.get("connections", &cons) + err := client.getWithContext(ctx, "connections", &cons) if err != nil { return nil, fmt.Errorf("failed to get connections: %w", err) } @@ -1400,8 +1650,13 @@ func (client *NginxClient) GetConnections() (*Connections, error) { // GetHTTPRequests returns http/requests stats. func (client *NginxClient) GetHTTPRequests() (*HTTPRequests, error) { + return client.GetHTTPRequestsWithContext(context.Background()) +} + +// GetHTTPRequestsWithContext returns http/requests stats with a context. +func (client *NginxClient) GetHTTPRequestsWithContext(ctx context.Context) (*HTTPRequests, error) { var requests HTTPRequests - err := client.get("http/requests", &requests) + err := client.getWithContext(ctx, "http/requests", &requests) if err != nil { return nil, fmt.Errorf("failed to get http requests: %w", err) } @@ -1410,8 +1665,13 @@ func (client *NginxClient) GetHTTPRequests() (*HTTPRequests, error) { // GetSSL returns SSL stats. func (client *NginxClient) GetSSL() (*SSL, error) { + return client.GetSSLWithContext(context.Background()) +} + +// GetSSLWithContext returns SSL stats with a context. +func (client *NginxClient) GetSSLWithContext(ctx context.Context) (*SSL, error) { var ssl SSL - err := client.get("ssl", &ssl) + err := client.getWithContext(ctx, "ssl", &ssl) if err != nil { return nil, fmt.Errorf("failed to get ssl: %w", err) } @@ -1420,8 +1680,13 @@ func (client *NginxClient) GetSSL() (*SSL, error) { // GetServerZones returns http/server_zones stats. func (client *NginxClient) GetServerZones() (*ServerZones, error) { + return client.GetServerZonesWithContext(context.Background()) +} + +// GetServerZonesWithContext returns http/server_zones stats with a context. +func (client *NginxClient) GetServerZonesWithContext(ctx context.Context) (*ServerZones, error) { var zones ServerZones - err := client.get("http/server_zones", &zones) + err := client.getWithContext(ctx, "http/server_zones", &zones) if err != nil { return nil, fmt.Errorf("failed to get server zones: %w", err) } @@ -1430,8 +1695,13 @@ func (client *NginxClient) GetServerZones() (*ServerZones, error) { // GetStreamServerZones returns stream/server_zones stats. func (client *NginxClient) GetStreamServerZones() (*StreamServerZones, error) { + return client.GetStreamServerZonesWithContext(context.Background()) +} + +// GetStreamServerZonesWithContext returns stream/server_zones stats with a context. +func (client *NginxClient) GetStreamServerZonesWithContext(ctx context.Context) (*StreamServerZones, error) { var zones StreamServerZones - err := client.get("stream/server_zones", &zones) + err := client.getWithContext(ctx, "stream/server_zones", &zones) if err != nil { var ie *internalError if errors.As(err, &ie) { @@ -1446,8 +1716,13 @@ func (client *NginxClient) GetStreamServerZones() (*StreamServerZones, error) { // GetUpstreams returns http/upstreams stats. func (client *NginxClient) GetUpstreams() (*Upstreams, error) { + return client.GetUpstreamsWithContext(context.Background()) +} + +// GetUpstreamsWithContext returns http/upstreams stats with a context. +func (client *NginxClient) GetUpstreamsWithContext(ctx context.Context) (*Upstreams, error) { var upstreams Upstreams - err := client.get("http/upstreams", &upstreams) + err := client.getWithContext(ctx, "http/upstreams", &upstreams) if err != nil { return nil, fmt.Errorf("failed to get upstreams: %w", err) } @@ -1456,8 +1731,13 @@ func (client *NginxClient) GetUpstreams() (*Upstreams, error) { // GetStreamUpstreams returns stream/upstreams stats. func (client *NginxClient) GetStreamUpstreams() (*StreamUpstreams, error) { + return client.GetStreamUpstreamsWithContext(context.Background()) +} + +// GetStreamUpstreamsWithContext returns stream/upstreams stats with a context. +func (client *NginxClient) GetStreamUpstreamsWithContext(ctx context.Context) (*StreamUpstreams, error) { var upstreams StreamUpstreams - err := client.get("stream/upstreams", &upstreams) + err := client.getWithContext(ctx, "stream/upstreams", &upstreams) if err != nil { var ie *internalError if errors.As(err, &ie) { @@ -1472,8 +1752,13 @@ func (client *NginxClient) GetStreamUpstreams() (*StreamUpstreams, error) { // GetStreamZoneSync returns stream/zone_sync stats. func (client *NginxClient) GetStreamZoneSync() (*StreamZoneSync, error) { + return client.GetStreamZoneSyncWithContext(context.Background()) +} + +// GetStreamZoneSyncWithContext returns stream/zone_sync stats with a context. +func (client *NginxClient) GetStreamZoneSyncWithContext(ctx context.Context) (*StreamZoneSync, error) { var streamZoneSync StreamZoneSync - err := client.get("stream/zone_sync", &streamZoneSync) + err := client.getWithContext(ctx, "stream/zone_sync", &streamZoneSync) if err != nil { var ie *internalError if errors.As(err, &ie) { @@ -1489,11 +1774,16 @@ func (client *NginxClient) GetStreamZoneSync() (*StreamZoneSync, error) { // GetLocationZones returns http/location_zones stats. func (client *NginxClient) GetLocationZones() (*LocationZones, error) { + return client.GetLocationZonesWithContext(context.Background()) +} + +// GetLocationZonesWithContext returns http/location_zones stats with a context. +func (client *NginxClient) GetLocationZonesWithContext(ctx context.Context) (*LocationZones, error) { var locationZones LocationZones if client.apiVersion < 5 { return &locationZones, nil } - err := client.get("http/location_zones", &locationZones) + err := client.getWithContext(ctx, "http/location_zones", &locationZones) if err != nil { return nil, fmt.Errorf("failed to get location zones: %w", err) } @@ -1503,11 +1793,16 @@ func (client *NginxClient) GetLocationZones() (*LocationZones, error) { // GetResolvers returns Resolvers stats. func (client *NginxClient) GetResolvers() (*Resolvers, error) { + return client.GetResolversWithContext(context.Background()) +} + +// GetResolversWithContext returns Resolvers stats with a context. +func (client *NginxClient) GetResolversWithContext(ctx context.Context) (*Resolvers, error) { var resolvers Resolvers if client.apiVersion < 5 { return &resolvers, nil } - err := client.get("resolvers", &resolvers) + err := client.getWithContext(ctx, "resolvers", &resolvers) if err != nil { return nil, fmt.Errorf("failed to get resolvers: %w", err) } @@ -1517,8 +1812,13 @@ func (client *NginxClient) GetResolvers() (*Resolvers, error) { // GetProcesses returns Processes stats. func (client *NginxClient) GetProcesses() (*Processes, error) { + return client.GetProcessesWithContext(context.Background()) +} + +// GetProcessesWithContext returns Processes stats with a context. +func (client *NginxClient) GetProcessesWithContext(ctx context.Context) (*Processes, error) { var processes Processes - err := client.get("processes", &processes) + err := client.getWithContext(ctx, "processes", &processes) if err != nil { return nil, fmt.Errorf("failed to get processes: %w", err) } @@ -1748,11 +2048,16 @@ func addPortToServer(server string) string { // GetHTTPLimitReqs returns http/limit_reqs stats. func (client *NginxClient) GetHTTPLimitReqs() (*HTTPLimitRequests, error) { + return client.GetHTTPLimitReqsWithContext(context.Background()) +} + +// GetHTTPLimitReqsWithContext returns http/limit_reqs stats with a context. +func (client *NginxClient) GetHTTPLimitReqsWithContext(ctx context.Context) (*HTTPLimitRequests, error) { var limitReqs HTTPLimitRequests if client.apiVersion < 6 { return &limitReqs, nil } - err := client.get("http/limit_reqs", &limitReqs) + err := client.getWithContext(ctx, "http/limit_reqs", &limitReqs) if err != nil { return nil, fmt.Errorf("failed to get http limit requests: %w", err) } @@ -1761,11 +2066,16 @@ func (client *NginxClient) GetHTTPLimitReqs() (*HTTPLimitRequests, error) { // GetHTTPConnectionsLimit returns http/limit_conns stats. func (client *NginxClient) GetHTTPConnectionsLimit() (*HTTPLimitConnections, error) { + return client.GetHTTPConnectionsLimitWithContext(context.Background()) +} + +// GetHTTPConnectionsLimitWithContext returns http/limit_conns stats with a context. +func (client *NginxClient) GetHTTPConnectionsLimitWithContext(ctx context.Context) (*HTTPLimitConnections, error) { var limitConns HTTPLimitConnections if client.apiVersion < 6 { return &limitConns, nil } - err := client.get("http/limit_conns", &limitConns) + err := client.getWithContext(ctx, "http/limit_conns", &limitConns) if err != nil { return nil, fmt.Errorf("failed to get http connections limit: %w", err) } @@ -1774,11 +2084,16 @@ func (client *NginxClient) GetHTTPConnectionsLimit() (*HTTPLimitConnections, err // GetStreamConnectionsLimit returns stream/limit_conns stats. func (client *NginxClient) GetStreamConnectionsLimit() (*StreamLimitConnections, error) { + return client.GetStreamConnectionsLimitWithContext(context.Background()) +} + +// GetStreamConnectionsLimitWithContext returns stream/limit_conns stats with a context. +func (client *NginxClient) GetStreamConnectionsLimitWithContext(ctx context.Context) (*StreamLimitConnections, error) { var limitConns StreamLimitConnections if client.apiVersion < 6 { return &limitConns, nil } - err := client.get("stream/limit_conns", &limitConns) + err := client.getWithContext(ctx, "stream/limit_conns", &limitConns) if err != nil { var ie *internalError if errors.As(err, &ie) { @@ -1793,11 +2108,16 @@ func (client *NginxClient) GetStreamConnectionsLimit() (*StreamLimitConnections, // GetWorkers returns workers stats. func (client *NginxClient) GetWorkers() ([]*Workers, error) { + return client.GetWorkersWithContext(context.Background()) +} + +// GetWorkersWithContext returns workers stats with a context. +func (client *NginxClient) GetWorkersWithContext(ctx context.Context) ([]*Workers, error) { var workers []*Workers if client.apiVersion < 9 { return workers, nil } - err := client.get("workers", &workers) + err := client.getWithContext(ctx, "workers", &workers) if err != nil { return nil, fmt.Errorf("failed to get workers: %w", err) } diff --git a/client/nginx_test.go b/client/nginx_test.go index 312cf73c..0ad650c9 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -1,10 +1,12 @@ package client import ( + "context" "net/http" "net/http/httptest" "reflect" "strings" + "sync" "testing" "time" ) @@ -622,23 +624,44 @@ func TestClientWithHTTPClient(t *testing.T) { } func TestGetStats_NoStreamEndpoint(t *testing.T) { + tests := []struct { + ctx context.Context + name string + }{ + { + ctx: nil, + name: "no context test", + }, + { + ctx: context.Background(), + name: "with context test", + }, + } + var err error + var client *NginxClient + var writeLock sync.Mutex + t.Parallel() ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + writeLock.Lock() + defer writeLock.Unlock() + switch { case r.RequestURI == "/": - _, err := w.Write([]byte(`[4, 5, 6, 7, 8, 9]`)) + + _, err = w.Write([]byte(`[4, 5, 6, 7, 8, 9]`)) if err != nil { t.Fatalf("unexpected error: %v", err) } case r.RequestURI == "/7/": - _, err := w.Write([]byte(`["nginx","processes","connections","slabs","http","resolvers","ssl"]`)) + _, err = w.Write([]byte(`["nginx","processes","connections","slabs","http","resolvers","ssl"]`)) if err != nil { t.Fatalf("unexpected error: %v", err) } case strings.HasPrefix(r.RequestURI, "/7/stream"): t.Fatal("Stream endpoint should not be called since it does not exist.") default: - _, err := w.Write([]byte(`{}`)) + _, err = w.Write([]byte(`{}`)) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -647,7 +670,7 @@ func TestGetStats_NoStreamEndpoint(t *testing.T) { defer ts.Close() // Test creating a new client with a supported API version on the server - client, err := NewNginxClient(ts.URL, WithAPIVersion(7), WithCheckAPI()) + client, err = NewNginxClient(ts.URL, WithAPIVersion(7), WithCheckAPI()) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -655,9 +678,19 @@ func TestGetStats_NoStreamEndpoint(t *testing.T) { t.Fatalf("client is nil") } - stats, err := client.GetStats() - if err != nil { - t.Fatalf("unexpected error: %v", err) + var stats *Stats + for _, test := range tests { + if test.ctx == nil { + stats, err = client.GetStats() + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + } else { + stats, err = client.GetStatsWithContext(test.ctx) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + } } if !reflect.DeepEqual(stats.StreamServerZones, StreamServerZones{}) { @@ -675,6 +708,20 @@ func TestGetStats_NoStreamEndpoint(t *testing.T) { } func TestGetStats_SSL(t *testing.T) { + tests := []struct { + ctx context.Context + name string + }{ + { + ctx: nil, + name: "no context test", + }, + { + ctx: context.Background(), + name: "with context test", + }, + } + t.Parallel() ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch { @@ -708,6 +755,11 @@ func TestGetStats_SSL(t *testing.T) { if err != nil { t.Fatalf("unexpected error: %v", err) } + case strings.HasPrefix(r.RequestURI, "/8/stream"): + _, err := w.Write([]byte(`[""]`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } default: _, err := w.Write([]byte(`{}`)) if err != nil { @@ -726,30 +778,41 @@ func TestGetStats_SSL(t *testing.T) { t.Fatalf("client is nil") } - stats, err := client.GetStats() - if err != nil { - t.Fatalf("unexpected error: %v", err) - } + var stats *Stats - testStats := SSL{ - Handshakes: 79572, - HandshakesFailed: 21025, - SessionReuses: 15762, - NoCommonProtocol: 4, - NoCommonCipher: 2, - HandshakeTimeout: 0, - PeerRejectedCert: 0, - VerifyFailures: VerifyFailures{ - NoCert: 0, - ExpiredCert: 2, - RevokedCert: 1, - HostnameMismatch: 2, - Other: 1, - }, - } + for _, test := range tests { + if test.ctx == nil { + stats, err = client.GetStats() + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + } else { + stats, err = client.GetStatsWithContext(test.ctx) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + } + + testStats := SSL{ + Handshakes: 79572, + HandshakesFailed: 21025, + SessionReuses: 15762, + NoCommonProtocol: 4, + NoCommonCipher: 2, + HandshakeTimeout: 0, + PeerRejectedCert: 0, + VerifyFailures: VerifyFailures{ + NoCert: 0, + ExpiredCert: 2, + RevokedCert: 1, + HostnameMismatch: 2, + Other: 1, + }, + } - if !reflect.DeepEqual(stats.SSL, testStats) { - t.Fatalf("SSL stats: expected %v, actual %v", testStats, stats.SSL) + if !reflect.DeepEqual(stats.SSL, testStats) { + t.Fatalf("SSL stats: expected %v, actual %v", testStats, stats.SSL) + } } } diff --git a/go.mod b/go.mod index 5b6000bc..918fd882 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module github.com/nginxinc/nginx-plus-go-client go 1.22.6 + +require golang.org/x/sync v0.8.0 diff --git a/go.sum b/go.sum index e69de29b..e584c1bd 100644 --- a/go.sum +++ b/go.sum @@ -0,0 +1,2 @@ +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= From c473f917d8175d821cff634a6f54411868f738d9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 09:49:18 +0000 Subject: [PATCH 055/244] Update github/codeql-action action to v3.26.6 | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.26.5 | v3.26.6 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 59cd8abc..24d38eac 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -55,7 +55,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5 + uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -67,6 +67,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5 + uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 583b4516..3231a371 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5 + uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 with: sarif_file: results.sarif From 8e578b560b10a37ed20944724d6468c95ce9ccaa Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 10:15:16 +0000 Subject: [PATCH 056/244] Update dependency golangci/golangci-lint to v1.60.3 | datasource | package | from | to | | ----------- | ---------------------- | ------- | ------- | | github-tags | golangci/golangci-lint | v1.60.1 | v1.60.3 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6e52ecae..c94dd706 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,7 +32,7 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 with: - version: v1.60.1 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v1.60.3 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/Makefile b/Makefile index d514c33d..843edaf0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v1.60.1 +GOLANGCI_LINT_VERSION = v1.60.3 test: unit-test test-integration test-integration-no-stream-block clean From 81456f2f15a1f3068af0543c23c7373bc2c3e9bb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:29:50 +0000 Subject: [PATCH 057/244] Update actions/upload-artifact action to v4.4.0 | datasource | package | from | to | | ----------- | ----------------------- | ------ | ------ | | github-tags | actions/upload-artifact | v4.3.6 | v4.4.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 3231a371..2764c4e5 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -49,7 +49,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: SARIF file path: results.sarif From 8084b439ec48f3d494d890d1f1a34a5874080681 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 08:27:08 +0000 Subject: [PATCH 058/244] Update pre-commit hook DavidAnson/markdownlint-cli2 to v0.14.0 | datasource | package | from | to | | ----------- | ---------------------------- | ------- | ------- | | github-tags | DavidAnson/markdownlint-cli2 | v0.13.0 | v0.14.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 03036433..b6716f31 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: gitleaks - repo: https://github.com/DavidAnson/markdownlint-cli2 - rev: v0.13.0 + rev: v0.14.0 hooks: - id: markdownlint-cli2 From db5ae1e65698b24e729eb66fa50aced6d1a763e3 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Mon, 16 Sep 2024 14:56:04 -0700 Subject: [PATCH 059/244] Add merge_group (#377) --- .github/workflows/ci.yml | 3 +++ .github/workflows/codeql-analysis.yml | 3 +++ .github/workflows/dependency-review.yml | 3 +++ .github/workflows/lint.yml | 3 +++ 4 files changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90469a8b..c11c1040 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,9 @@ on: - main schedule: - cron: "0 5 * * *" # runs every day at 5am UTC + merge_group: + types: + - checks_requested defaults: run: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 24d38eac..d11d317e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -10,6 +10,9 @@ on: - main schedule: - cron: "33 16 * * 3" # run every Wednesday at 16:33 UTC + merge_group: + types: + - checks_requested concurrency: group: ${{ github.ref_name }}-codeql diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index fac275be..85a6a6f1 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -3,6 +3,9 @@ on: pull_request: branches: - main + merge_group: + types: + - checks_requested concurrency: group: ${{ github.ref_name }}-deps-review diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c94dd706..df27294e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,6 +4,9 @@ on: pull_request: branches: - main + merge_group: + types: + - checks_requested defaults: run: From f8f96642e44ad5e72cefcff8d0b4da69d131d6b2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 22:18:14 +0000 Subject: [PATCH 060/244] Update DavidAnson/markdownlint-cli2-action action to v17 (#376) | datasource | package | from | to | | ----------- | ----------------------------------- | ------- | ------- | | github-tags | DavidAnson/markdownlint-cli2-action | v16.0.0 | v17.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index df27294e..c4d80dc5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -57,7 +57,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Lint Markdown - uses: DavidAnson/markdownlint-cli2-action@b4c9feab76d8025d1e83c653fa3990936df0e6c8 # v16.0.0 + uses: DavidAnson/markdownlint-cli2-action@db43aef879112c3119a410d69f66701e0d530809 # v17.0.0 with: config: .markdownlint-cli2.yaml globs: "**/*.md" From 39ec20fc5835c8545d1c8b31eacc7054e873796a Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Mon, 16 Sep 2024 15:18:57 -0700 Subject: [PATCH 061/244] Skip dependency review run on merge queue (#378) --- .github/workflows/dependency-review.yml | 4 ++++ .github/workflows/lint.yml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 85a6a6f1..9745fd3e 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -21,6 +21,10 @@ jobs: contents: read # for actions/checkout pull-requests: write # for actions/dependency-review-action to post comments steps: + - name: Skip on Merge Group + run: exit 0 # Artifically flag as successful, as this is a required check for branch protection. + if: github.event_name == 'merge_group' + - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c4d80dc5..3fa954f7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,7 +21,7 @@ permissions: jobs: lint: - name: Lint + name: Go Lint runs-on: ubuntu-22.04 steps: - name: Checkout Repository From d586adc9d7d852e6b5620cc90f319ef2dd75d709 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:27:54 -0700 Subject: [PATCH 062/244] Update github/codeql-action action to v3.26.7 (#369) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.26.6 | v3.26.7 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d11d317e..ddad6873 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/init@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/analyze@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 2764c4e5..6b915274 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 with: sarif_file: results.sarif From 3cff2bf71abeea4c4b19a49f57a12288570a07e8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:28:16 -0700 Subject: [PATCH 063/244] Update dependency golangci/golangci-lint to v1.61.0 (#370) | datasource | package | from | to | | ----------- | ---------------------- | ------- | ------- | | github-tags | golangci/golangci-lint | v1.60.3 | v1.61.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .pre-commit-config.yaml | 2 +- Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3fa954f7..f4050914 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 with: - version: v1.60.3 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v1.61.0 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b6716f31..e5e2371b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v1.60.3 + rev: v1.61.0 hooks: - id: golangci-lint-full diff --git a/Makefile b/Makefile index 843edaf0..a458bd57 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v1.60.3 +GOLANGCI_LINT_VERSION = v1.61.0 test: unit-test test-integration test-integration-no-stream-block clean From f84ecc1226d590aa93f0e3a8f58e6782e1d6e339 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:28:28 -0700 Subject: [PATCH 064/244] Update dependency goreleaser/goreleaser to v2.3.1 (#371) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.2.0 | v2.3.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c11c1040..d82791a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,7 +107,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 with: - version: v2.2.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.3.1 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c6f289476011c6cbf75856ea394c3dc00f7d07c0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:28:38 -0700 Subject: [PATCH 065/244] Update docker/dockerfile Docker tag to v1.10 (#372) | datasource | package | from | to | | ---------- | ----------------- | ---- | ---- | | docker | docker/dockerfile | 1.9 | 1.10 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index d68f4312..1f1e2ad1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.9 +# syntax=docker/dockerfile:1.10 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " From 36e0a27c461493a9560ccb0260c3c66e586bc5a7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:28:54 -0700 Subject: [PATCH 066/244] Update reviewdog/action-yamllint action to v1.19.0 (#375) | datasource | package | from | to | | ----------- | ------------------------- | ------- | ------- | | github-tags | reviewdog/action-yamllint | v1.18.0 | v1.19.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f4050914..f4528d67 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -70,4 +70,4 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Lint YAML - uses: reviewdog/action-yamllint@4e4ba96d03a0e12a0e71c29e5fef1db309d09201 # v1.18.0 + uses: reviewdog/action-yamllint@e09f07780388032a624e9eb44a23fd1bbb4052cc # v1.19.0 From 0614a06c09e03651345dac27fd49ff058b9ab668 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 22:28:59 +0000 Subject: [PATCH 067/244] Update reviewdog/action-actionlint action to v1.55.0 (#374) | datasource | package | from | to | | ----------- | --------------------------- | ------- | ------- | | github-tags | reviewdog/action-actionlint | v1.54.0 | v1.55.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f4528d67..11540699 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Lint Actions - uses: reviewdog/action-actionlint@4f8f9963ca57a41e5fd5b538dd79dbfbd3e0b38a # v1.54.0 + uses: reviewdog/action-actionlint@05c9d7bef25a46caf572df3497afa7082fc111df # v1.55.0 with: actionlint_flags: -shellcheck "" From 17bba408a7316c1f55aee26ac13ec6adf4f49cc0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 22:29:14 +0000 Subject: [PATCH 068/244] Update pre-commit hook gitleaks/gitleaks to v8.19.2 (#373) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.18.4 | v8.19.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e5e2371b..a16d59a0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.18.4 + rev: v8.19.2 hooks: - id: gitleaks From db5a17a659f80262cc66c774f59b03f3f11a0d46 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Mon, 16 Sep 2024 18:09:05 -0700 Subject: [PATCH 069/244] Skip workflow runs the right way (#379) --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependency-review.yml | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ddad6873..2bbda759 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -30,7 +30,7 @@ jobs: contents: read # for actions/checkout to fetch code security-events: write # for github/codeql-action/autobuild to send a status report packages: read # required to fetch internal or private CodeQL packs - + if: ${{ github.event_name != 'merge_group' }} strategy: fail-fast: false matrix: diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 9745fd3e..c36a9f2b 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -16,15 +16,13 @@ permissions: jobs: dependency-review: + name: Dependency Review runs-on: ubuntu-22.04 permissions: contents: read # for actions/checkout pull-requests: write # for actions/dependency-review-action to post comments + if: ${{ github.event_name != 'merge_group' }} steps: - - name: Skip on Merge Group - run: exit 0 # Artifically flag as successful, as this is a required check for branch protection. - if: github.event_name == 'merge_group' - - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 From f685b9e9106651a90fef9ddbea936b912f0a1b74 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Tue, 17 Sep 2024 07:52:55 -0700 Subject: [PATCH 070/244] Update OpenSSF badge (#366) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7aae2906..7101e710 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![OpenSSFScorecard](https://api.securityscorecards.dev/projects/github.com/nginxinc/nginx-plus-go-client/badge)](https://api.securityscorecards.dev/projects/github.com/nginxinc/nginx-plus-go-client) +[![OpenSSFScorecard](https://api.securityscorecards.dev/projects/github.com/nginxinc/nginx-plus-go-client/badge)](https://scorecard.dev/viewer/?uri=github.com/nginxinc/nginx-plus-go-client) [![Continuous Integration](https://github.com/nginxinc/nginx-plus-go-client/workflows/Continuous%20Integration/badge.svg)](https://github.com/nginxinc/nginx-plus-go-client/actions) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Go Report Card](https://goreportcard.com/badge/github.com/nginxinc/nginx-plus-go-client)](https://goreportcard.com/report/github.com/nginxinc/nginx-plus-go-client) From 86b8cbb317ec94add3c1542111c5b460b7a9e28a Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 18 Sep 2024 02:06:09 -0700 Subject: [PATCH 071/244] Use CLA GitHub Action (#364) --- .github/workflows/f5-cla.yml | 51 ++++++++++++++++++++++++++++++++++++ .yamllint.yaml | 4 --- CONTRIBUTING.md | 10 +++++++ 3 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/f5-cla.yml diff --git a/.github/workflows/f5-cla.yml b/.github/workflows/f5-cla.yml new file mode 100644 index 00000000..de0dbc8a --- /dev/null +++ b/.github/workflows/f5-cla.yml @@ -0,0 +1,51 @@ +name: F5 CLA + +on: + issue_comment: + types: + - created + pull_request_target: + types: + - opened + - synchronize + - reopened + +concurrency: + group: ${{ github.ref_name }}-cla + +permissions: + contents: read + +jobs: + f5-cla: + name: F5 CLA + runs-on: ubuntu-22.04 + permissions: + actions: write + contents: read + pull-requests: write + statuses: write + steps: + - name: Run F5 Contributor License Agreement (CLA) assistant + if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have hereby read the F5 CLA and agree to its terms') || github.event_name == 'pull_request_target' + uses: contributor-assistant/github-action@f41946747f85d28e9a738f4f38dbcc74b69c7e0e # v2.5.1 + with: + # Any pull request targeting the following branch will trigger a CLA check. + branch: "main" + # Path to the CLA document. + path-to-document: "https://github.com/f5/.github/blob/main/CLA/cla-markdown.md" + # Custom CLA messages. + custom-notsigned-prcomment: "🎉 Thank you for your contribution! It appears you have not yet signed the F5 Contributor License Agreement (CLA), which is required for your changes to be incorporated into an F5 Open Source Software (OSS) project. Please kindly read the [F5 CLA](https://github.com/f5/.github/blob/main/CLA/cla-markdown.md) and reply on a new comment with the following text to agree:" + custom-pr-sign-comment: "I have hereby read the F5 CLA and agree to its terms" + custom-allsigned-prcomment: "✅ All required contributors have signed the F5 CLA for this PR. Thank you!" + # Remote repository storing CLA signatures. + remote-organization-name: "f5" + remote-repository-name: "f5-cla-data" + path-to-signatures: "signatures/beta/signatures.json" + # Comma separated list of usernames for maintainers or any other individuals who should not be prompted for a CLA. + allowlist: bot* + # Do not lock PRs after a merge. + lock-pullrequest-aftermerge: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PERSONAL_ACCESS_TOKEN: ${{ secrets.F5_CLA_TOKEN }} diff --git a/.yamllint.yaml b/.yamllint.yaml index 7d0320c4..dd2afab7 100644 --- a/.yamllint.yaml +++ b/.yamllint.yaml @@ -1,8 +1,4 @@ --- -yaml-files: - - "*.yaml" - - "*.yml" - ignore-from-file: .gitignore extends: default diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d11a7a6e..ce4f0c67 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,7 @@ considering contributing! - [Suggest an Enhancement](#suggest-an-enhancement) - [Open a Pull Request](#open-a-pull-request) - [Issue lifecycle](#issue-lifecycle) + - [F5 Contributor License Agreement (CLA)](#f5-contributor-license-agreement-cla) - [Style Guides](#style-guides) - [Git Style Guide](#git-style-guide) - [Go Style Guide](#go-style-guide) @@ -60,6 +61,15 @@ issue template. type of issue it is (bug, feature request, etc) and to determine the milestone. Please see the [Issue Lifecycle](ISSUE_LIFECYCLE.md) document for more information. +### F5 Contributor License Agreement (CLA) + +F5 requires all external contributors to agree to the terms of the F5 CLA (available [here](https://github.com/f5/.github/blob/main/CLA/cla-markdown.md)) +before any of their changes can be incorporated into an F5 Open Source repository. + +If you have not yet agreed to the F5 CLA terms and submit a PR to this repository, a bot will prompt you to view and +agree to the F5 CLA. You will have to agree to the F5 CLA terms through a comment in the PR before any of your changes +can be merged. Your agreement signature will be safely stored by F5 and no longer be required in future PRs. + ## Style Guides ### Git Style Guide From 893788fa7bd446313a3314981103778474c3eb93 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:13:08 -0600 Subject: [PATCH 072/244] Update dependency goreleaser/goreleaser to v2.3.2 (#381) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.3.1 | v2.3.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d82791a1..8b917f7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,7 +107,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 with: - version: v2.3.1 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.3.2 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 334b72a2440eeb53a98ffd1a3d034c7d3a1f5552 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 18 Sep 2024 09:20:09 -0700 Subject: [PATCH 073/244] Add permissions for GoReleaser (#367) --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b917f7f..ece140f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,7 @@ jobs: runs-on: ubuntu-22.04 permissions: contents: write + issues: write if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository From 6112e7dc85aed413be575632717f6364d9a0a881 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 12:22:08 -0700 Subject: [PATCH 074/244] Update github/codeql-action action to v3.26.8 (#384) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.26.7 | v3.26.8 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2bbda759..7c2c7ae3 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 + uses: github/codeql-action/init@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 + uses: github/codeql-action/analyze@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 6b915274..b51fe1c1 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: sarif_file: results.sarif From 9cbb1f55911aba6c6199eb0fad14c55d523a4741 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:29:18 +0000 Subject: [PATCH 075/244] Update contributor-assistant/github-action action to v2.6.0 (#385) | datasource | package | from | to | | ----------- | ----------------------------------- | ------ | ------ | | github-tags | contributor-assistant/github-action | v2.5.1 | v2.6.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/f5-cla.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/f5-cla.yml b/.github/workflows/f5-cla.yml index de0dbc8a..a1c34f89 100644 --- a/.github/workflows/f5-cla.yml +++ b/.github/workflows/f5-cla.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Run F5 Contributor License Agreement (CLA) assistant if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have hereby read the F5 CLA and agree to its terms') || github.event_name == 'pull_request_target' - uses: contributor-assistant/github-action@f41946747f85d28e9a738f4f38dbcc74b69c7e0e # v2.5.1 + uses: contributor-assistant/github-action@b1522fa982419e79591a92e1267de463a281cdb7 # v2.6.0 with: # Any pull request targeting the following branch will trigger a CLA check. branch: "main" From 09790f510bed961d808be60e3f7663d8bbd492c5 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Tue, 24 Sep 2024 01:02:56 -0700 Subject: [PATCH 076/244] Support cancellation of NGINX Plus API calls (#383) --- .golangci.yml | 1 + client/nginx.go | 476 ++++++++++++--------------------- client/nginx_test.go | 134 +++------- tests/client_no_stream_test.go | 5 +- tests/client_test.go | 163 +++++------ 5 files changed, 286 insertions(+), 493 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 3ec52004..6c887ac9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -34,6 +34,7 @@ linters: - asasalint - asciicheck - bidichk + - containedctx - contextcheck - copyloopvar - dupword diff --git a/client/nginx.go b/client/nginx.go index 7a76d41c..3d868c0e 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -38,7 +38,6 @@ var ( defaultBackup = false defaultDown = false defaultWeight = 1 - defaultTimeout = 10 * time.Second ) var ( @@ -55,7 +54,6 @@ type NginxClient struct { apiEndpoint string apiVersion int checkAPI bool - ctxTimeout time.Duration } type Option func(*NginxClient) @@ -590,13 +588,6 @@ func WithCheckAPI() Option { } } -// WithTimeout sets the timeout per request for the client. -func WithTimeout(duration time.Duration) Option { - return func(o *NginxClient) { - o.ctxTimeout = duration - } -} - // NewNginxClient creates a new NginxClient. func NewNginxClient(apiEndpoint string, opts ...Option) (*NginxClient, error) { c := &NginxClient{ @@ -604,7 +595,6 @@ func NewNginxClient(apiEndpoint string, opts ...Option) (*NginxClient, error) { apiEndpoint: apiEndpoint, apiVersion: APIVersion, checkAPI: false, - ctxTimeout: defaultTimeout, } for _, opt := range opts { @@ -619,12 +609,10 @@ func NewNginxClient(apiEndpoint string, opts ...Option) (*NginxClient, error) { return nil, fmt.Errorf("API version %v: %w by the client", c.apiVersion, ErrNotSupported) } - if c.ctxTimeout <= 0 { - return nil, fmt.Errorf("timeout %q needs to be greater than 0: %w", c.ctxTimeout, ErrInvalidTimeout) - } - if c.checkAPI { - versions, err := c.getAPIVersions(c.httpClient, apiEndpoint) + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + versions, err := c.getAPIVersions(ctx, c.httpClient, apiEndpoint) if err != nil { return nil, fmt.Errorf("error accessing the API: %w", err) } @@ -653,8 +641,8 @@ func versionSupported(n int) bool { } // GetMaxAPIVersion returns the maximum API version supported by the server and the client. -func (client *NginxClient) GetMaxAPIVersion() (int, error) { - serverVersions, err := client.getAPIVersions(client.httpClient, client.apiEndpoint) +func (client *NginxClient) GetMaxAPIVersion(ctx context.Context) (int, error) { + serverVersions, err := client.getAPIVersions(ctx, client.httpClient, client.apiEndpoint) if err != nil { return 0, fmt.Errorf("failed to get max API version: %w", err) } @@ -669,10 +657,7 @@ func (client *NginxClient) GetMaxAPIVersion() (int, error) { return maxServerVersion, nil } -func (client *NginxClient) getAPIVersions(httpClient *http.Client, endpoint string) (*versions, error) { - ctx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) - defer cancel() - +func (client *NginxClient) getAPIVersions(ctx context.Context, httpClient *http.Client, endpoint string) (*versions, error) { req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil) if err != nil { return nil, fmt.Errorf("failed to create a get request: %w", err) @@ -733,17 +718,17 @@ func readAPIErrorResponse(respBody io.ReadCloser) (*apiErrorResponse, error) { } // CheckIfUpstreamExists checks if the upstream exists in NGINX. If the upstream doesn't exist, it returns the error. -func (client *NginxClient) CheckIfUpstreamExists(upstream string) error { - _, err := client.GetHTTPServers(upstream) +func (client *NginxClient) CheckIfUpstreamExists(ctx context.Context, upstream string) error { + _, err := client.GetHTTPServers(ctx, upstream) return err } // GetHTTPServers returns the servers of the upstream from NGINX. -func (client *NginxClient) GetHTTPServers(upstream string) ([]UpstreamServer, error) { +func (client *NginxClient) GetHTTPServers(ctx context.Context, upstream string) ([]UpstreamServer, error) { path := fmt.Sprintf("http/upstreams/%v/servers", upstream) var servers []UpstreamServer - err := client.get(path, &servers) + err := client.get(ctx, path, &servers) if err != nil { return nil, fmt.Errorf("failed to get the HTTP servers of upstream %v: %w", upstream, err) } @@ -752,8 +737,8 @@ func (client *NginxClient) GetHTTPServers(upstream string) ([]UpstreamServer, er } // AddHTTPServer adds the server to the upstream. -func (client *NginxClient) AddHTTPServer(upstream string, server UpstreamServer) error { - id, err := client.getIDOfHTTPServer(upstream, server.Server) +func (client *NginxClient) AddHTTPServer(ctx context.Context, upstream string, server UpstreamServer) error { + id, err := client.getIDOfHTTPServer(ctx, upstream, server.Server) if err != nil { return fmt.Errorf("failed to add %v server to %v upstream: %w", server.Server, upstream, err) } @@ -762,7 +747,7 @@ func (client *NginxClient) AddHTTPServer(upstream string, server UpstreamServer) } path := fmt.Sprintf("http/upstreams/%v/servers/", upstream) - err = client.post(path, &server) + err = client.post(ctx, path, &server) if err != nil { return fmt.Errorf("failed to add %v server to %v upstream: %w", server.Server, upstream, err) } @@ -771,8 +756,8 @@ func (client *NginxClient) AddHTTPServer(upstream string, server UpstreamServer) } // DeleteHTTPServer the server from the upstream. -func (client *NginxClient) DeleteHTTPServer(upstream string, server string) error { - id, err := client.getIDOfHTTPServer(upstream, server) +func (client *NginxClient) DeleteHTTPServer(ctx context.Context, upstream string, server string) error { + id, err := client.getIDOfHTTPServer(ctx, upstream, server) if err != nil { return fmt.Errorf("failed to remove %v server from %v upstream: %w", server, upstream, err) } @@ -781,7 +766,7 @@ func (client *NginxClient) DeleteHTTPServer(upstream string, server string) erro } path := fmt.Sprintf("http/upstreams/%v/servers/%v", upstream, id) - err = client.delete(path, http.StatusOK) + err = client.delete(ctx, path, http.StatusOK) if err != nil { return fmt.Errorf("failed to remove %v server from %v upstream: %w", server, upstream, err) } @@ -793,8 +778,8 @@ func (client *NginxClient) DeleteHTTPServer(upstream string, server string) erro // Servers that are in the slice, but don't exist in NGINX will be added to NGINX. // Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX. // Servers that are in the slice and exist in NGINX, but have different parameters, will be updated. -func (client *NginxClient) UpdateHTTPServers(upstream string, servers []UpstreamServer) (added []UpstreamServer, deleted []UpstreamServer, updated []UpstreamServer, err error) { - serversInNginx, err := client.GetHTTPServers(upstream) +func (client *NginxClient) UpdateHTTPServers(ctx context.Context, upstream string, servers []UpstreamServer) (added []UpstreamServer, deleted []UpstreamServer, updated []UpstreamServer, err error) { + serversInNginx, err := client.GetHTTPServers(ctx, upstream) if err != nil { return nil, nil, nil, fmt.Errorf("failed to update servers of %v upstream: %w", upstream, err) } @@ -809,21 +794,21 @@ func (client *NginxClient) UpdateHTTPServers(upstream string, servers []Upstream toAdd, toDelete, toUpdate := determineUpdates(formattedServers, serversInNginx) for _, server := range toAdd { - err := client.AddHTTPServer(upstream, server) + err := client.AddHTTPServer(ctx, upstream, server) if err != nil { return nil, nil, nil, fmt.Errorf("failed to update servers of %v upstream: %w", upstream, err) } } for _, server := range toDelete { - err := client.DeleteHTTPServer(upstream, server.Server) + err := client.DeleteHTTPServer(ctx, upstream, server.Server) if err != nil { return nil, nil, nil, fmt.Errorf("failed to update servers of %v upstream: %w", upstream, err) } } for _, server := range toUpdate { - err := client.UpdateHTTPServer(upstream, server) + err := client.UpdateHTTPServer(ctx, upstream, server) if err != nil { return nil, nil, nil, fmt.Errorf("failed to update servers of %v upstream: %w", upstream, err) } @@ -911,8 +896,8 @@ func determineUpdates(updatedServers []UpstreamServer, nginxServers []UpstreamSe return } -func (client *NginxClient) getIDOfHTTPServer(upstream string, name string) (int, error) { - servers, err := client.GetHTTPServers(upstream) +func (client *NginxClient) getIDOfHTTPServer(ctx context.Context, upstream string, name string) (int, error) { + servers, err := client.GetHTTPServers(ctx, upstream) if err != nil { return -1, fmt.Errorf("error getting id of server %v of upstream %v: %w", name, upstream, err) } @@ -926,14 +911,7 @@ func (client *NginxClient) getIDOfHTTPServer(upstream string, name string) (int, return -1, nil } -func (client *NginxClient) get(path string, data interface{}) error { - timeoutCtx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) - defer cancel() - - return client.getWithContext(timeoutCtx, path, data) -} - -func (client *NginxClient) getWithContext(ctx context.Context, path string, data interface{}) error { +func (client *NginxClient) get(ctx context.Context, path string, data interface{}) error { url := fmt.Sprintf("%v/%v/%v", client.apiEndpoint, client.apiVersion, path) req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) @@ -964,14 +942,7 @@ func (client *NginxClient) getWithContext(ctx context.Context, path string, data return nil } -func (client *NginxClient) post(path string, input interface{}) error { - timeoutCtx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) - defer cancel() - - return client.postWithContext(timeoutCtx, path, input) -} - -func (client *NginxClient) postWithContext(ctx context.Context, path string, input interface{}) error { +func (client *NginxClient) post(ctx context.Context, path string, input interface{}) error { url := fmt.Sprintf("%v/%v/%v", client.apiEndpoint, client.apiVersion, path) jsonInput, err := json.Marshal(input) @@ -1000,14 +971,7 @@ func (client *NginxClient) postWithContext(ctx context.Context, path string, inp return nil } -func (client *NginxClient) delete(path string, expectedStatusCode int) error { - timeoutCtx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) - defer cancel() - - return client.deleteWithContext(timeoutCtx, path, expectedStatusCode) -} - -func (client *NginxClient) deleteWithContext(ctx context.Context, path string, expectedStatusCode int) error { +func (client *NginxClient) delete(ctx context.Context, path string, expectedStatusCode int) error { path = fmt.Sprintf("%v/%v/%v/", client.apiEndpoint, client.apiVersion, path) req, err := http.NewRequestWithContext(ctx, http.MethodDelete, path, nil) @@ -1029,14 +993,7 @@ func (client *NginxClient) deleteWithContext(ctx context.Context, path string, e return nil } -func (client *NginxClient) patch(path string, input interface{}, expectedStatusCode int) error { - timeoutCtx, cancel := context.WithTimeout(context.Background(), client.ctxTimeout) - defer cancel() - - return client.patchWithContext(timeoutCtx, path, input, expectedStatusCode) -} - -func (client *NginxClient) patchWithContext(ctx context.Context, path string, input interface{}, expectedStatusCode int) error { +func (client *NginxClient) patch(ctx context.Context, path string, input interface{}, expectedStatusCode int) error { path = fmt.Sprintf("%v/%v/%v/", client.apiEndpoint, client.apiVersion, path) jsonInput, err := json.Marshal(input) @@ -1064,17 +1021,17 @@ func (client *NginxClient) patchWithContext(ctx context.Context, path string, in } // CheckIfStreamUpstreamExists checks if the stream upstream exists in NGINX. If the upstream doesn't exist, it returns the error. -func (client *NginxClient) CheckIfStreamUpstreamExists(upstream string) error { - _, err := client.GetStreamServers(upstream) +func (client *NginxClient) CheckIfStreamUpstreamExists(ctx context.Context, upstream string) error { + _, err := client.GetStreamServers(ctx, upstream) return err } // GetStreamServers returns the stream servers of the upstream from NGINX. -func (client *NginxClient) GetStreamServers(upstream string) ([]StreamUpstreamServer, error) { +func (client *NginxClient) GetStreamServers(ctx context.Context, upstream string) ([]StreamUpstreamServer, error) { path := fmt.Sprintf("stream/upstreams/%v/servers", upstream) var servers []StreamUpstreamServer - err := client.get(path, &servers) + err := client.get(ctx, path, &servers) if err != nil { return nil, fmt.Errorf("failed to get stream servers of upstream server %v: %w", upstream, err) } @@ -1082,8 +1039,8 @@ func (client *NginxClient) GetStreamServers(upstream string) ([]StreamUpstreamSe } // AddStreamServer adds the stream server to the upstream. -func (client *NginxClient) AddStreamServer(upstream string, server StreamUpstreamServer) error { - id, err := client.getIDOfStreamServer(upstream, server.Server) +func (client *NginxClient) AddStreamServer(ctx context.Context, upstream string, server StreamUpstreamServer) error { + id, err := client.getIDOfStreamServer(ctx, upstream, server.Server) if err != nil { return fmt.Errorf("failed to add %v stream server to %v upstream: %w", server.Server, upstream, err) } @@ -1092,7 +1049,7 @@ func (client *NginxClient) AddStreamServer(upstream string, server StreamUpstrea } path := fmt.Sprintf("stream/upstreams/%v/servers/", upstream) - err = client.post(path, &server) + err = client.post(ctx, path, &server) if err != nil { return fmt.Errorf("failed to add %v stream server to %v upstream: %w", server.Server, upstream, err) } @@ -1100,8 +1057,8 @@ func (client *NginxClient) AddStreamServer(upstream string, server StreamUpstrea } // DeleteStreamServer the server from the upstream. -func (client *NginxClient) DeleteStreamServer(upstream string, server string) error { - id, err := client.getIDOfStreamServer(upstream, server) +func (client *NginxClient) DeleteStreamServer(ctx context.Context, upstream string, server string) error { + id, err := client.getIDOfStreamServer(ctx, upstream, server) if err != nil { return fmt.Errorf("failed to remove %v stream server from %v upstream: %w", server, upstream, err) } @@ -1110,7 +1067,7 @@ func (client *NginxClient) DeleteStreamServer(upstream string, server string) er } path := fmt.Sprintf("stream/upstreams/%v/servers/%v", upstream, id) - err = client.delete(path, http.StatusOK) + err = client.delete(ctx, path, http.StatusOK) if err != nil { return fmt.Errorf("failed to remove %v stream server from %v upstream: %w", server, upstream, err) } @@ -1121,8 +1078,8 @@ func (client *NginxClient) DeleteStreamServer(upstream string, server string) er // Servers that are in the slice, but don't exist in NGINX will be added to NGINX. // Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX. // Servers that are in the slice and exist in NGINX, but have different parameters, will be updated. -func (client *NginxClient) UpdateStreamServers(upstream string, servers []StreamUpstreamServer) (added []StreamUpstreamServer, deleted []StreamUpstreamServer, updated []StreamUpstreamServer, err error) { - serversInNginx, err := client.GetStreamServers(upstream) +func (client *NginxClient) UpdateStreamServers(ctx context.Context, upstream string, servers []StreamUpstreamServer) (added []StreamUpstreamServer, deleted []StreamUpstreamServer, updated []StreamUpstreamServer, err error) { + serversInNginx, err := client.GetStreamServers(ctx, upstream) if err != nil { return nil, nil, nil, fmt.Errorf("failed to update stream servers of %v upstream: %w", upstream, err) } @@ -1136,21 +1093,21 @@ func (client *NginxClient) UpdateStreamServers(upstream string, servers []Stream toAdd, toDelete, toUpdate := determineStreamUpdates(formattedServers, serversInNginx) for _, server := range toAdd { - err := client.AddStreamServer(upstream, server) + err := client.AddStreamServer(ctx, upstream, server) if err != nil { return nil, nil, nil, fmt.Errorf("failed to update stream servers of %v upstream: %w", upstream, err) } } for _, server := range toDelete { - err := client.DeleteStreamServer(upstream, server.Server) + err := client.DeleteStreamServer(ctx, upstream, server.Server) if err != nil { return nil, nil, nil, fmt.Errorf("failed to update stream servers of %v upstream: %w", upstream, err) } } for _, server := range toUpdate { - err := client.UpdateStreamServer(upstream, server) + err := client.UpdateStreamServer(ctx, upstream, server) if err != nil { return nil, nil, nil, fmt.Errorf("failed to update stream servers of %v upstream: %w", upstream, err) } @@ -1159,8 +1116,8 @@ func (client *NginxClient) UpdateStreamServers(upstream string, servers []Stream return toAdd, toDelete, toUpdate, nil } -func (client *NginxClient) getIDOfStreamServer(upstream string, name string) (int, error) { - servers, err := client.GetStreamServers(upstream) +func (client *NginxClient) getIDOfStreamServer(ctx context.Context, upstream string, name string) (int, error) { + servers, err := client.GetStreamServers(ctx, upstream) if err != nil { return -1, fmt.Errorf("error getting id of stream server %v of upstream %v: %w", name, upstream, err) } @@ -1252,14 +1209,14 @@ func determineStreamUpdates(updatedServers []StreamUpstreamServer, nginxServers return } -// GetStatsWithContext gets process, slab, connection, request, ssl, zone, stream zone, upstream and stream upstream related stats from the NGINX Plus API. -func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, error) { +// GetStats gets process, slab, connection, request, ssl, zone, stream zone, upstream and stream upstream related stats from the NGINX Plus API. +func (client *NginxClient) GetStats(ctx context.Context) (*Stats, error) { initialGroup, initialCtx := errgroup.WithContext(ctx) var mu sync.Mutex stats := defaultStats() // Collecting initial stats initialGroup.Go(func() error { - endpoints, err := client.GetAvailableEndpointsWithContext(initialCtx) + endpoints, err := client.GetAvailableEndpoints(initialCtx) if err != nil { return fmt.Errorf("failed to get available Endpoints: %w", err) } @@ -1271,7 +1228,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - nginxInfo, err := client.GetNginxInfoWithContext(initialCtx) + nginxInfo, err := client.GetNginxInfo(initialCtx) if err != nil { return fmt.Errorf("failed to get NGINX info: %w", err) } @@ -1284,7 +1241,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - caches, err := client.GetCachesWithContext(initialCtx) + caches, err := client.GetCaches(initialCtx) if err != nil { return fmt.Errorf("failed to get Caches: %w", err) } @@ -1297,7 +1254,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - processes, err := client.GetProcessesWithContext(initialCtx) + processes, err := client.GetProcesses(initialCtx) if err != nil { return fmt.Errorf("failed to get Process information: %w", err) } @@ -1310,7 +1267,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - slabs, err := client.GetSlabsWithContext(initialCtx) + slabs, err := client.GetSlabs(initialCtx) if err != nil { return fmt.Errorf("failed to get Slabs: %w", err) } @@ -1323,7 +1280,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - httpRequests, err := client.GetHTTPRequestsWithContext(initialCtx) + httpRequests, err := client.GetHTTPRequests(initialCtx) if err != nil { return fmt.Errorf("failed to get HTTP Requests: %w", err) } @@ -1336,7 +1293,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - ssl, err := client.GetSSLWithContext(initialCtx) + ssl, err := client.GetSSL(initialCtx) if err != nil { return fmt.Errorf("failed to get SSL: %w", err) } @@ -1349,7 +1306,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - serverZones, err := client.GetServerZonesWithContext(initialCtx) + serverZones, err := client.GetServerZones(initialCtx) if err != nil { return fmt.Errorf("failed to get Server Zones: %w", err) } @@ -1362,7 +1319,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - upstreams, err := client.GetUpstreamsWithContext(initialCtx) + upstreams, err := client.GetUpstreams(initialCtx) if err != nil { return fmt.Errorf("failed to get Upstreams: %w", err) } @@ -1375,7 +1332,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - locationZones, err := client.GetLocationZonesWithContext(initialCtx) + locationZones, err := client.GetLocationZones(initialCtx) if err != nil { return fmt.Errorf("failed to get Location Zones: %w", err) } @@ -1388,7 +1345,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - resolvers, err := client.GetResolversWithContext(initialCtx) + resolvers, err := client.GetResolvers(initialCtx) if err != nil { return fmt.Errorf("failed to get Resolvers: %w", err) } @@ -1401,7 +1358,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - httpLimitRequests, err := client.GetHTTPLimitReqsWithContext(initialCtx) + httpLimitRequests, err := client.GetHTTPLimitReqs(initialCtx) if err != nil { return fmt.Errorf("failed to get HTTPLimitRequests: %w", err) } @@ -1414,7 +1371,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - httpLimitConnections, err := client.GetHTTPConnectionsLimitWithContext(initialCtx) + httpLimitConnections, err := client.GetHTTPConnectionsLimit(initialCtx) if err != nil { return fmt.Errorf("failed to get HTTPLimitConnections: %w", err) } @@ -1427,7 +1384,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) initialGroup.Go(func() error { - workers, err := client.GetWorkersWithContext(initialCtx) + workers, err := client.GetWorkers(initialCtx) if err != nil { return fmt.Errorf("failed to get Workers: %w", err) } @@ -1448,7 +1405,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err availableStreamGroup, asgCtx := errgroup.WithContext(ctx) availableStreamGroup.Go(func() error { - streamEndpoints, err := client.GetAvailableStreamEndpointsWithContext(asgCtx) + streamEndpoints, err := client.GetAvailableStreamEndpoints(asgCtx) if err != nil { return fmt.Errorf("failed to get available Stream Endpoints: %w", err) } @@ -1468,7 +1425,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err if slices.Contains(stats.streamEndpoints, "server_zones") { streamGroup.Go(func() error { - streamServerZones, err := client.GetStreamServerZonesWithContext(sgCtx) + streamServerZones, err := client.GetStreamServerZones(sgCtx) if err != nil { return fmt.Errorf("failed to get streamServerZones: %w", err) } @@ -1483,7 +1440,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err if slices.Contains(stats.streamEndpoints, "upstreams") { streamGroup.Go(func() error { - streamUpstreams, err := client.GetStreamUpstreamsWithContext(sgCtx) + streamUpstreams, err := client.GetStreamUpstreams(sgCtx) if err != nil { return fmt.Errorf("failed to get StreamUpstreams: %w", err) } @@ -1498,7 +1455,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err if slices.Contains(stats.streamEndpoints, "limit_conns") { streamGroup.Go(func() error { - streamConnectionsLimit, err := client.GetStreamConnectionsLimitWithContext(sgCtx) + streamConnectionsLimit, err := client.GetStreamConnectionsLimit(sgCtx) if err != nil { return fmt.Errorf("failed to get StreamLimitConnections: %w", err) } @@ -1511,7 +1468,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err }) streamGroup.Go(func() error { - streamZoneSync, err := client.GetStreamZoneSyncWithContext(sgCtx) + streamZoneSync, err := client.GetStreamZoneSync(sgCtx) if err != nil { return fmt.Errorf("failed to get StreamZoneSync: %w", err) } @@ -1534,7 +1491,7 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err connectionsGroup.Go(func() error { // replace this call with a context specific call - connections, err := client.GetConnectionsWithContext(cgCtx) + connections, err := client.GetConnections(cgCtx) if err != nil { return fmt.Errorf("failed to get connections: %w", err) } @@ -1553,155 +1510,100 @@ func (client *NginxClient) GetStatsWithContext(ctx context.Context) (*Stats, err return &stats.Stats, nil } -// GetStats gets process, slab, connection, request, ssl, zone, stream zone, upstream and stream upstream related stats from the NGINX Plus API. -func (client *NginxClient) GetStats() (*Stats, error) { - return client.GetStatsWithContext(context.Background()) -} - // GetAvailableEndpoints returns available endpoints in the API. -func (client *NginxClient) GetAvailableEndpoints() ([]string, error) { - return client.GetAvailableEndpointsWithContext(context.Background()) -} - -// GetAvailableEndpointsWithContext returns available endpoints in the API. -func (client *NginxClient) GetAvailableEndpointsWithContext(ctx context.Context) ([]string, error) { +func (client *NginxClient) GetAvailableEndpoints(ctx context.Context) ([]string, error) { var endpoints []string - err := client.getWithContext(ctx, "", &endpoints) + err := client.get(ctx, "", &endpoints) if err != nil { return nil, fmt.Errorf("failed to get endpoints: %w", err) } return endpoints, nil } -// GetAvailableStreamEndpoints returns available stream endpoints in the API. -func (client *NginxClient) GetAvailableStreamEndpoints() ([]string, error) { - return client.GetAvailableStreamEndpointsWithContext(context.Background()) -} - -// GetAvailableStreamEndpointsWithContext returns available stream endpoints in the API with a context. -func (client *NginxClient) GetAvailableStreamEndpointsWithContext(ctx context.Context) ([]string, error) { +// GetAvailableStreamEndpoints returns available stream endpoints in the API with a context. +func (client *NginxClient) GetAvailableStreamEndpoints(ctx context.Context) ([]string, error) { var endpoints []string - err := client.getWithContext(ctx, "stream", &endpoints) + err := client.get(ctx, "stream", &endpoints) if err != nil { return nil, fmt.Errorf("failed to get endpoints: %w", err) } return endpoints, nil } -// GetNginxInfo returns Nginx stats. -func (client *NginxClient) GetNginxInfo() (*NginxInfo, error) { - return client.GetNginxInfoWithContext(context.Background()) -} - -// GetNginxInfoWithContext returns Nginx stats with a context. -func (client *NginxClient) GetNginxInfoWithContext(ctx context.Context) (*NginxInfo, error) { +// GetNginxInfo returns Nginx stats with a context. +func (client *NginxClient) GetNginxInfo(ctx context.Context) (*NginxInfo, error) { var info NginxInfo - err := client.getWithContext(ctx, "nginx", &info) + err := client.get(ctx, "nginx", &info) if err != nil { return nil, fmt.Errorf("failed to get info: %w", err) } return &info, nil } -// GetCaches returns Cache stats. -func (client *NginxClient) GetCaches() (*Caches, error) { - return client.GetCachesWithContext(context.Background()) -} - -// GetCachesWithContext returns Cache stats with a context. -func (client *NginxClient) GetCachesWithContext(ctx context.Context) (*Caches, error) { +// GetCaches returns Cache stats with a context. +func (client *NginxClient) GetCaches(ctx context.Context) (*Caches, error) { var caches Caches - err := client.getWithContext(ctx, "http/caches", &caches) + err := client.get(ctx, "http/caches", &caches) if err != nil { return nil, fmt.Errorf("failed to get caches: %w", err) } return &caches, nil } -// GetSlabs returns Slabs stats. -func (client *NginxClient) GetSlabs() (*Slabs, error) { - return client.GetSlabsWithContext(context.Background()) -} - -// GetSlabsWithContext returns Slabs stats with a context. -func (client *NginxClient) GetSlabsWithContext(ctx context.Context) (*Slabs, error) { +// GetSlabs returns Slabs stats with a context. +func (client *NginxClient) GetSlabs(ctx context.Context) (*Slabs, error) { var slabs Slabs - err := client.getWithContext(ctx, "slabs", &slabs) + err := client.get(ctx, "slabs", &slabs) if err != nil { return nil, fmt.Errorf("failed to get slabs: %w", err) } return &slabs, nil } -// GetConnections returns Connections stats. -func (client *NginxClient) GetConnections() (*Connections, error) { - return client.GetConnectionsWithContext(context.Background()) -} - -// GetConnectionsWithContext returns Connections stats with a context. -func (client *NginxClient) GetConnectionsWithContext(ctx context.Context) (*Connections, error) { +// GetConnections returns Connections stats with a context. +func (client *NginxClient) GetConnections(ctx context.Context) (*Connections, error) { var cons Connections - err := client.getWithContext(ctx, "connections", &cons) + err := client.get(ctx, "connections", &cons) if err != nil { return nil, fmt.Errorf("failed to get connections: %w", err) } return &cons, nil } -// GetHTTPRequests returns http/requests stats. -func (client *NginxClient) GetHTTPRequests() (*HTTPRequests, error) { - return client.GetHTTPRequestsWithContext(context.Background()) -} - -// GetHTTPRequestsWithContext returns http/requests stats with a context. -func (client *NginxClient) GetHTTPRequestsWithContext(ctx context.Context) (*HTTPRequests, error) { +// GetHTTPRequests returns http/requests stats with a context. +func (client *NginxClient) GetHTTPRequests(ctx context.Context) (*HTTPRequests, error) { var requests HTTPRequests - err := client.getWithContext(ctx, "http/requests", &requests) + err := client.get(ctx, "http/requests", &requests) if err != nil { return nil, fmt.Errorf("failed to get http requests: %w", err) } return &requests, nil } -// GetSSL returns SSL stats. -func (client *NginxClient) GetSSL() (*SSL, error) { - return client.GetSSLWithContext(context.Background()) -} - -// GetSSLWithContext returns SSL stats with a context. -func (client *NginxClient) GetSSLWithContext(ctx context.Context) (*SSL, error) { +// GetSSL returns SSL stats with a context. +func (client *NginxClient) GetSSL(ctx context.Context) (*SSL, error) { var ssl SSL - err := client.getWithContext(ctx, "ssl", &ssl) + err := client.get(ctx, "ssl", &ssl) if err != nil { return nil, fmt.Errorf("failed to get ssl: %w", err) } return &ssl, nil } -// GetServerZones returns http/server_zones stats. -func (client *NginxClient) GetServerZones() (*ServerZones, error) { - return client.GetServerZonesWithContext(context.Background()) -} - -// GetServerZonesWithContext returns http/server_zones stats with a context. -func (client *NginxClient) GetServerZonesWithContext(ctx context.Context) (*ServerZones, error) { +// GetServerZones returns http/server_zones stats with a context. +func (client *NginxClient) GetServerZones(ctx context.Context) (*ServerZones, error) { var zones ServerZones - err := client.getWithContext(ctx, "http/server_zones", &zones) + err := client.get(ctx, "http/server_zones", &zones) if err != nil { return nil, fmt.Errorf("failed to get server zones: %w", err) } return &zones, err } -// GetStreamServerZones returns stream/server_zones stats. -func (client *NginxClient) GetStreamServerZones() (*StreamServerZones, error) { - return client.GetStreamServerZonesWithContext(context.Background()) -} - -// GetStreamServerZonesWithContext returns stream/server_zones stats with a context. -func (client *NginxClient) GetStreamServerZonesWithContext(ctx context.Context) (*StreamServerZones, error) { +// GetStreamServerZones returns stream/server_zones stats with a context. +func (client *NginxClient) GetStreamServerZones(ctx context.Context) (*StreamServerZones, error) { var zones StreamServerZones - err := client.getWithContext(ctx, "stream/server_zones", &zones) + err := client.get(ctx, "stream/server_zones", &zones) if err != nil { var ie *internalError if errors.As(err, &ie) { @@ -1714,30 +1616,20 @@ func (client *NginxClient) GetStreamServerZonesWithContext(ctx context.Context) return &zones, err } -// GetUpstreams returns http/upstreams stats. -func (client *NginxClient) GetUpstreams() (*Upstreams, error) { - return client.GetUpstreamsWithContext(context.Background()) -} - -// GetUpstreamsWithContext returns http/upstreams stats with a context. -func (client *NginxClient) GetUpstreamsWithContext(ctx context.Context) (*Upstreams, error) { +// GetUpstreams returns http/upstreams stats with a context. +func (client *NginxClient) GetUpstreams(ctx context.Context) (*Upstreams, error) { var upstreams Upstreams - err := client.getWithContext(ctx, "http/upstreams", &upstreams) + err := client.get(ctx, "http/upstreams", &upstreams) if err != nil { return nil, fmt.Errorf("failed to get upstreams: %w", err) } return &upstreams, nil } -// GetStreamUpstreams returns stream/upstreams stats. -func (client *NginxClient) GetStreamUpstreams() (*StreamUpstreams, error) { - return client.GetStreamUpstreamsWithContext(context.Background()) -} - -// GetStreamUpstreamsWithContext returns stream/upstreams stats with a context. -func (client *NginxClient) GetStreamUpstreamsWithContext(ctx context.Context) (*StreamUpstreams, error) { +// GetStreamUpstreams returns stream/upstreams stats with a context. +func (client *NginxClient) GetStreamUpstreams(ctx context.Context) (*StreamUpstreams, error) { var upstreams StreamUpstreams - err := client.getWithContext(ctx, "stream/upstreams", &upstreams) + err := client.get(ctx, "stream/upstreams", &upstreams) if err != nil { var ie *internalError if errors.As(err, &ie) { @@ -1750,15 +1642,10 @@ func (client *NginxClient) GetStreamUpstreamsWithContext(ctx context.Context) (* return &upstreams, nil } -// GetStreamZoneSync returns stream/zone_sync stats. -func (client *NginxClient) GetStreamZoneSync() (*StreamZoneSync, error) { - return client.GetStreamZoneSyncWithContext(context.Background()) -} - -// GetStreamZoneSyncWithContext returns stream/zone_sync stats with a context. -func (client *NginxClient) GetStreamZoneSyncWithContext(ctx context.Context) (*StreamZoneSync, error) { +// GetStreamZoneSync returns stream/zone_sync stats with a context. +func (client *NginxClient) GetStreamZoneSync(ctx context.Context) (*StreamZoneSync, error) { var streamZoneSync StreamZoneSync - err := client.getWithContext(ctx, "stream/zone_sync", &streamZoneSync) + err := client.get(ctx, "stream/zone_sync", &streamZoneSync) if err != nil { var ie *internalError if errors.As(err, &ie) { @@ -1772,18 +1659,13 @@ func (client *NginxClient) GetStreamZoneSyncWithContext(ctx context.Context) (*S return &streamZoneSync, err } -// GetLocationZones returns http/location_zones stats. -func (client *NginxClient) GetLocationZones() (*LocationZones, error) { - return client.GetLocationZonesWithContext(context.Background()) -} - -// GetLocationZonesWithContext returns http/location_zones stats with a context. -func (client *NginxClient) GetLocationZonesWithContext(ctx context.Context) (*LocationZones, error) { +// GetLocationZones returns http/location_zones stats with a context. +func (client *NginxClient) GetLocationZones(ctx context.Context) (*LocationZones, error) { var locationZones LocationZones if client.apiVersion < 5 { return &locationZones, nil } - err := client.getWithContext(ctx, "http/location_zones", &locationZones) + err := client.get(ctx, "http/location_zones", &locationZones) if err != nil { return nil, fmt.Errorf("failed to get location zones: %w", err) } @@ -1791,18 +1673,13 @@ func (client *NginxClient) GetLocationZonesWithContext(ctx context.Context) (*Lo return &locationZones, err } -// GetResolvers returns Resolvers stats. -func (client *NginxClient) GetResolvers() (*Resolvers, error) { - return client.GetResolversWithContext(context.Background()) -} - -// GetResolversWithContext returns Resolvers stats with a context. -func (client *NginxClient) GetResolversWithContext(ctx context.Context) (*Resolvers, error) { +// GetResolvers returns Resolvers stats with a context. +func (client *NginxClient) GetResolvers(ctx context.Context) (*Resolvers, error) { var resolvers Resolvers if client.apiVersion < 5 { return &resolvers, nil } - err := client.getWithContext(ctx, "resolvers", &resolvers) + err := client.get(ctx, "resolvers", &resolvers) if err != nil { return nil, fmt.Errorf("failed to get resolvers: %w", err) } @@ -1810,15 +1687,10 @@ func (client *NginxClient) GetResolversWithContext(ctx context.Context) (*Resolv return &resolvers, err } -// GetProcesses returns Processes stats. -func (client *NginxClient) GetProcesses() (*Processes, error) { - return client.GetProcessesWithContext(context.Background()) -} - -// GetProcessesWithContext returns Processes stats with a context. -func (client *NginxClient) GetProcessesWithContext(ctx context.Context) (*Processes, error) { +// GetProcesses returns Processes stats with a context. +func (client *NginxClient) GetProcesses(ctx context.Context) (*Processes, error) { var processes Processes - err := client.getWithContext(ctx, "processes", &processes) + err := client.get(ctx, "processes", &processes) if err != nil { return nil, fmt.Errorf("failed to get processes: %w", err) } @@ -1833,16 +1705,16 @@ type KeyValPairs map[string]string type KeyValPairsByZone map[string]KeyValPairs // GetKeyValPairs fetches key/value pairs for a given HTTP zone. -func (client *NginxClient) GetKeyValPairs(zone string) (KeyValPairs, error) { - return client.getKeyValPairs(zone, httpContext) +func (client *NginxClient) GetKeyValPairs(ctx context.Context, zone string) (KeyValPairs, error) { + return client.getKeyValPairs(ctx, zone, httpContext) } // GetStreamKeyValPairs fetches key/value pairs for a given Stream zone. -func (client *NginxClient) GetStreamKeyValPairs(zone string) (KeyValPairs, error) { - return client.getKeyValPairs(zone, streamContext) +func (client *NginxClient) GetStreamKeyValPairs(ctx context.Context, zone string) (KeyValPairs, error) { + return client.getKeyValPairs(ctx, zone, streamContext) } -func (client *NginxClient) getKeyValPairs(zone string, stream bool) (KeyValPairs, error) { +func (client *NginxClient) getKeyValPairs(ctx context.Context, zone string, stream bool) (KeyValPairs, error) { base := "http" if stream { base = "stream" @@ -1853,7 +1725,7 @@ func (client *NginxClient) getKeyValPairs(zone string, stream bool) (KeyValPairs path := fmt.Sprintf("%v/keyvals/%v", base, zone) var keyValPairs KeyValPairs - err := client.get(path, &keyValPairs) + err := client.get(ctx, path, &keyValPairs) if err != nil { return nil, fmt.Errorf("failed to get keyvals for %v/%v zone: %w", base, zone, err) } @@ -1861,16 +1733,16 @@ func (client *NginxClient) getKeyValPairs(zone string, stream bool) (KeyValPairs } // GetAllKeyValPairs fetches all key/value pairs for all HTTP zones. -func (client *NginxClient) GetAllKeyValPairs() (KeyValPairsByZone, error) { - return client.getAllKeyValPairs(httpContext) +func (client *NginxClient) GetAllKeyValPairs(ctx context.Context) (KeyValPairsByZone, error) { + return client.getAllKeyValPairs(ctx, httpContext) } // GetAllStreamKeyValPairs fetches all key/value pairs for all Stream zones. -func (client *NginxClient) GetAllStreamKeyValPairs() (KeyValPairsByZone, error) { - return client.getAllKeyValPairs(streamContext) +func (client *NginxClient) GetAllStreamKeyValPairs(ctx context.Context) (KeyValPairsByZone, error) { + return client.getAllKeyValPairs(ctx, streamContext) } -func (client *NginxClient) getAllKeyValPairs(stream bool) (KeyValPairsByZone, error) { +func (client *NginxClient) getAllKeyValPairs(ctx context.Context, stream bool) (KeyValPairsByZone, error) { base := "http" if stream { base = "stream" @@ -1878,7 +1750,7 @@ func (client *NginxClient) getAllKeyValPairs(stream bool) (KeyValPairsByZone, er path := fmt.Sprintf("%v/keyvals", base) var keyValPairsByZone KeyValPairsByZone - err := client.get(path, &keyValPairsByZone) + err := client.get(ctx, path, &keyValPairsByZone) if err != nil { return nil, fmt.Errorf("failed to get keyvals for all %v zones: %w", base, err) } @@ -1886,16 +1758,16 @@ func (client *NginxClient) getAllKeyValPairs(stream bool) (KeyValPairsByZone, er } // AddKeyValPair adds a new key/value pair to a given HTTP zone. -func (client *NginxClient) AddKeyValPair(zone string, key string, val string) error { - return client.addKeyValPair(zone, key, val, httpContext) +func (client *NginxClient) AddKeyValPair(ctx context.Context, zone string, key string, val string) error { + return client.addKeyValPair(ctx, zone, key, val, httpContext) } // AddStreamKeyValPair adds a new key/value pair to a given Stream zone. -func (client *NginxClient) AddStreamKeyValPair(zone string, key string, val string) error { - return client.addKeyValPair(zone, key, val, streamContext) +func (client *NginxClient) AddStreamKeyValPair(ctx context.Context, zone string, key string, val string) error { + return client.addKeyValPair(ctx, zone, key, val, streamContext) } -func (client *NginxClient) addKeyValPair(zone string, key string, val string, stream bool) error { +func (client *NginxClient) addKeyValPair(ctx context.Context, zone string, key string, val string, stream bool) error { base := "http" if stream { base = "stream" @@ -1906,7 +1778,7 @@ func (client *NginxClient) addKeyValPair(zone string, key string, val string, st path := fmt.Sprintf("%v/keyvals/%v", base, zone) input := KeyValPairs{key: val} - err := client.post(path, &input) + err := client.post(ctx, path, &input) if err != nil { return fmt.Errorf("failed to add key value pair for %v/%v zone: %w", base, zone, err) } @@ -1914,16 +1786,16 @@ func (client *NginxClient) addKeyValPair(zone string, key string, val string, st } // ModifyKeyValPair modifies the value of an existing key in a given HTTP zone. -func (client *NginxClient) ModifyKeyValPair(zone string, key string, val string) error { - return client.modifyKeyValPair(zone, key, val, httpContext) +func (client *NginxClient) ModifyKeyValPair(ctx context.Context, zone string, key string, val string) error { + return client.modifyKeyValPair(ctx, zone, key, val, httpContext) } // ModifyStreamKeyValPair modifies the value of an existing key in a given Stream zone. -func (client *NginxClient) ModifyStreamKeyValPair(zone string, key string, val string) error { - return client.modifyKeyValPair(zone, key, val, streamContext) +func (client *NginxClient) ModifyStreamKeyValPair(ctx context.Context, zone string, key string, val string) error { + return client.modifyKeyValPair(ctx, zone, key, val, streamContext) } -func (client *NginxClient) modifyKeyValPair(zone string, key string, val string, stream bool) error { +func (client *NginxClient) modifyKeyValPair(ctx context.Context, zone string, key string, val string, stream bool) error { base := "http" if stream { base = "stream" @@ -1934,7 +1806,7 @@ func (client *NginxClient) modifyKeyValPair(zone string, key string, val string, path := fmt.Sprintf("%v/keyvals/%v", base, zone) input := KeyValPairs{key: val} - err := client.patch(path, &input, http.StatusNoContent) + err := client.patch(ctx, path, &input, http.StatusNoContent) if err != nil { return fmt.Errorf("failed to update key value pair for %v/%v zone: %w", base, zone, err) } @@ -1942,18 +1814,18 @@ func (client *NginxClient) modifyKeyValPair(zone string, key string, val string, } // DeleteKeyValuePair deletes the key/value pair for a key in a given HTTP zone. -func (client *NginxClient) DeleteKeyValuePair(zone string, key string) error { - return client.deleteKeyValuePair(zone, key, httpContext) +func (client *NginxClient) DeleteKeyValuePair(ctx context.Context, zone string, key string) error { + return client.deleteKeyValuePair(ctx, zone, key, httpContext) } // DeleteStreamKeyValuePair deletes the key/value pair for a key in a given Stream zone. -func (client *NginxClient) DeleteStreamKeyValuePair(zone string, key string) error { - return client.deleteKeyValuePair(zone, key, streamContext) +func (client *NginxClient) DeleteStreamKeyValuePair(ctx context.Context, zone string, key string) error { + return client.deleteKeyValuePair(ctx, zone, key, streamContext) } // To delete a key/value pair you set the value to null via the API, // then NGINX+ will delete the key. -func (client *NginxClient) deleteKeyValuePair(zone string, key string, stream bool) error { +func (client *NginxClient) deleteKeyValuePair(ctx context.Context, zone string, key string, stream bool) error { base := "http" if stream { base = "stream" @@ -1967,7 +1839,7 @@ func (client *NginxClient) deleteKeyValuePair(zone string, key string, stream bo keyval[key] = nil path := fmt.Sprintf("%v/keyvals/%v", base, zone) - err := client.patch(path, &keyval, http.StatusNoContent) + err := client.patch(ctx, path, &keyval, http.StatusNoContent) if err != nil { return fmt.Errorf("failed to remove key values pair for %v/%v zone: %w", base, zone, err) } @@ -1975,16 +1847,16 @@ func (client *NginxClient) deleteKeyValuePair(zone string, key string, stream bo } // DeleteKeyValPairs deletes all the key-value pairs in a given HTTP zone. -func (client *NginxClient) DeleteKeyValPairs(zone string) error { - return client.deleteKeyValPairs(zone, httpContext) +func (client *NginxClient) DeleteKeyValPairs(ctx context.Context, zone string) error { + return client.deleteKeyValPairs(ctx, zone, httpContext) } // DeleteStreamKeyValPairs deletes all the key-value pairs in a given Stream zone. -func (client *NginxClient) DeleteStreamKeyValPairs(zone string) error { - return client.deleteKeyValPairs(zone, streamContext) +func (client *NginxClient) DeleteStreamKeyValPairs(ctx context.Context, zone string) error { + return client.deleteKeyValPairs(ctx, zone, streamContext) } -func (client *NginxClient) deleteKeyValPairs(zone string, stream bool) error { +func (client *NginxClient) deleteKeyValPairs(ctx context.Context, zone string, stream bool) error { base := "http" if stream { base = "stream" @@ -1994,7 +1866,7 @@ func (client *NginxClient) deleteKeyValPairs(zone string, stream bool) error { } path := fmt.Sprintf("%v/keyvals/%v", base, zone) - err := client.delete(path, http.StatusNoContent) + err := client.delete(ctx, path, http.StatusNoContent) if err != nil { return fmt.Errorf("failed to remove all key value pairs for %v/%v zone: %w", base, zone, err) } @@ -2002,10 +1874,10 @@ func (client *NginxClient) deleteKeyValPairs(zone string, stream bool) error { } // UpdateHTTPServer updates the server of the upstream. -func (client *NginxClient) UpdateHTTPServer(upstream string, server UpstreamServer) error { +func (client *NginxClient) UpdateHTTPServer(ctx context.Context, upstream string, server UpstreamServer) error { path := fmt.Sprintf("http/upstreams/%v/servers/%v", upstream, server.ID) server.ID = 0 - err := client.patch(path, &server, http.StatusOK) + err := client.patch(ctx, path, &server, http.StatusOK) if err != nil { return fmt.Errorf("failed to update %v server to %v upstream: %w", server.Server, upstream, err) } @@ -2014,10 +1886,10 @@ func (client *NginxClient) UpdateHTTPServer(upstream string, server UpstreamServ } // UpdateStreamServer updates the stream server of the upstream. -func (client *NginxClient) UpdateStreamServer(upstream string, server StreamUpstreamServer) error { +func (client *NginxClient) UpdateStreamServer(ctx context.Context, upstream string, server StreamUpstreamServer) error { path := fmt.Sprintf("stream/upstreams/%v/servers/%v", upstream, server.ID) server.ID = 0 - err := client.patch(path, &server, http.StatusOK) + err := client.patch(ctx, path, &server, http.StatusOK) if err != nil { return fmt.Errorf("failed to update %v stream server to %v upstream: %w", server.Server, upstream, err) } @@ -2046,54 +1918,39 @@ func addPortToServer(server string) string { return fmt.Sprintf("%v:%v", server, defaultServerPort) } -// GetHTTPLimitReqs returns http/limit_reqs stats. -func (client *NginxClient) GetHTTPLimitReqs() (*HTTPLimitRequests, error) { - return client.GetHTTPLimitReqsWithContext(context.Background()) -} - -// GetHTTPLimitReqsWithContext returns http/limit_reqs stats with a context. -func (client *NginxClient) GetHTTPLimitReqsWithContext(ctx context.Context) (*HTTPLimitRequests, error) { +// GetHTTPLimitReqs returns http/limit_reqs stats with a context. +func (client *NginxClient) GetHTTPLimitReqs(ctx context.Context) (*HTTPLimitRequests, error) { var limitReqs HTTPLimitRequests if client.apiVersion < 6 { return &limitReqs, nil } - err := client.getWithContext(ctx, "http/limit_reqs", &limitReqs) + err := client.get(ctx, "http/limit_reqs", &limitReqs) if err != nil { return nil, fmt.Errorf("failed to get http limit requests: %w", err) } return &limitReqs, nil } -// GetHTTPConnectionsLimit returns http/limit_conns stats. -func (client *NginxClient) GetHTTPConnectionsLimit() (*HTTPLimitConnections, error) { - return client.GetHTTPConnectionsLimitWithContext(context.Background()) -} - -// GetHTTPConnectionsLimitWithContext returns http/limit_conns stats with a context. -func (client *NginxClient) GetHTTPConnectionsLimitWithContext(ctx context.Context) (*HTTPLimitConnections, error) { +// GetHTTPConnectionsLimit returns http/limit_conns stats with a context. +func (client *NginxClient) GetHTTPConnectionsLimit(ctx context.Context) (*HTTPLimitConnections, error) { var limitConns HTTPLimitConnections if client.apiVersion < 6 { return &limitConns, nil } - err := client.getWithContext(ctx, "http/limit_conns", &limitConns) + err := client.get(ctx, "http/limit_conns", &limitConns) if err != nil { return nil, fmt.Errorf("failed to get http connections limit: %w", err) } return &limitConns, nil } -// GetStreamConnectionsLimit returns stream/limit_conns stats. -func (client *NginxClient) GetStreamConnectionsLimit() (*StreamLimitConnections, error) { - return client.GetStreamConnectionsLimitWithContext(context.Background()) -} - -// GetStreamConnectionsLimitWithContext returns stream/limit_conns stats with a context. -func (client *NginxClient) GetStreamConnectionsLimitWithContext(ctx context.Context) (*StreamLimitConnections, error) { +// GetStreamConnectionsLimit returns stream/limit_conns stats with a context. +func (client *NginxClient) GetStreamConnectionsLimit(ctx context.Context) (*StreamLimitConnections, error) { var limitConns StreamLimitConnections if client.apiVersion < 6 { return &limitConns, nil } - err := client.getWithContext(ctx, "stream/limit_conns", &limitConns) + err := client.get(ctx, "stream/limit_conns", &limitConns) if err != nil { var ie *internalError if errors.As(err, &ie) { @@ -2107,17 +1964,12 @@ func (client *NginxClient) GetStreamConnectionsLimitWithContext(ctx context.Cont } // GetWorkers returns workers stats. -func (client *NginxClient) GetWorkers() ([]*Workers, error) { - return client.GetWorkersWithContext(context.Background()) -} - -// GetWorkersWithContext returns workers stats with a context. -func (client *NginxClient) GetWorkersWithContext(ctx context.Context) ([]*Workers, error) { +func (client *NginxClient) GetWorkers(ctx context.Context) ([]*Workers, error) { var workers []*Workers if client.apiVersion < 9 { return workers, nil } - err := client.getWithContext(ctx, "workers", &workers) + err := client.get(ctx, "workers", &workers) if err != nil { return nil, fmt.Errorf("failed to get workers: %w", err) } diff --git a/client/nginx_test.go b/client/nginx_test.go index 0ad650c9..655b3f82 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -8,7 +8,6 @@ import ( "strings" "sync" "testing" - "time" ) func TestDetermineUpdates(t *testing.T) { @@ -581,27 +580,6 @@ func TestClientWithAPIVersion(t *testing.T) { } } -func TestClientWithTimeout(t *testing.T) { - t.Parallel() - // Test creating a new client with a supported API version on the client - client, err := NewNginxClient("http://api-url", WithTimeout(1*time.Second)) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - if client == nil { - t.Fatalf("client is nil") - } - - // Test creating a new client with an invalid duration - client, err = NewNginxClient("http://api-url", WithTimeout(-1*time.Second)) - if err == nil { - t.Fatalf("expected error, but got nil") - } - if client != nil { - t.Fatalf("expected client to be nil, but got %v", client) - } -} - func TestClientWithHTTPClient(t *testing.T) { t.Parallel() // Test creating a new client passing a custom HTTP client @@ -624,21 +602,6 @@ func TestClientWithHTTPClient(t *testing.T) { } func TestGetStats_NoStreamEndpoint(t *testing.T) { - tests := []struct { - ctx context.Context - name string - }{ - { - ctx: nil, - name: "no context test", - }, - { - ctx: context.Background(), - name: "with context test", - }, - } - var err error - var client *NginxClient var writeLock sync.Mutex t.Parallel() @@ -649,19 +612,19 @@ func TestGetStats_NoStreamEndpoint(t *testing.T) { switch { case r.RequestURI == "/": - _, err = w.Write([]byte(`[4, 5, 6, 7, 8, 9]`)) + _, err := w.Write([]byte(`[4, 5, 6, 7, 8, 9]`)) if err != nil { t.Fatalf("unexpected error: %v", err) } case r.RequestURI == "/7/": - _, err = w.Write([]byte(`["nginx","processes","connections","slabs","http","resolvers","ssl"]`)) + _, err := w.Write([]byte(`["nginx","processes","connections","slabs","http","resolvers","ssl"]`)) if err != nil { t.Fatalf("unexpected error: %v", err) } case strings.HasPrefix(r.RequestURI, "/7/stream"): t.Fatal("Stream endpoint should not be called since it does not exist.") default: - _, err = w.Write([]byte(`{}`)) + _, err := w.Write([]byte(`{}`)) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -670,7 +633,7 @@ func TestGetStats_NoStreamEndpoint(t *testing.T) { defer ts.Close() // Test creating a new client with a supported API version on the server - client, err = NewNginxClient(ts.URL, WithAPIVersion(7), WithCheckAPI()) + client, err := NewNginxClient(ts.URL, WithAPIVersion(7), WithCheckAPI()) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -678,19 +641,9 @@ func TestGetStats_NoStreamEndpoint(t *testing.T) { t.Fatalf("client is nil") } - var stats *Stats - for _, test := range tests { - if test.ctx == nil { - stats, err = client.GetStats() - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - } else { - stats, err = client.GetStatsWithContext(test.ctx) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - } + stats, err := client.GetStats(context.Background()) + if err != nil { + t.Fatalf("unexpected error: %v", err) } if !reflect.DeepEqual(stats.StreamServerZones, StreamServerZones{}) { @@ -708,20 +661,6 @@ func TestGetStats_NoStreamEndpoint(t *testing.T) { } func TestGetStats_SSL(t *testing.T) { - tests := []struct { - ctx context.Context - name string - }{ - { - ctx: nil, - name: "no context test", - }, - { - ctx: context.Background(), - name: "with context test", - }, - } - t.Parallel() ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch { @@ -778,41 +717,30 @@ func TestGetStats_SSL(t *testing.T) { t.Fatalf("client is nil") } - var stats *Stats - - for _, test := range tests { - if test.ctx == nil { - stats, err = client.GetStats() - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - } else { - stats, err = client.GetStatsWithContext(test.ctx) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - } + stats, err := client.GetStats(context.Background()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } - testStats := SSL{ - Handshakes: 79572, - HandshakesFailed: 21025, - SessionReuses: 15762, - NoCommonProtocol: 4, - NoCommonCipher: 2, - HandshakeTimeout: 0, - PeerRejectedCert: 0, - VerifyFailures: VerifyFailures{ - NoCert: 0, - ExpiredCert: 2, - RevokedCert: 1, - HostnameMismatch: 2, - Other: 1, - }, - } + testStats := SSL{ + Handshakes: 79572, + HandshakesFailed: 21025, + SessionReuses: 15762, + NoCommonProtocol: 4, + NoCommonCipher: 2, + HandshakeTimeout: 0, + PeerRejectedCert: 0, + VerifyFailures: VerifyFailures{ + NoCert: 0, + ExpiredCert: 2, + RevokedCert: 1, + HostnameMismatch: 2, + Other: 1, + }, + } - if !reflect.DeepEqual(stats.SSL, testStats) { - t.Fatalf("SSL stats: expected %v, actual %v", testStats, stats.SSL) - } + if !reflect.DeepEqual(stats.SSL, testStats) { + t.Fatalf("SSL stats: expected %v, actual %v", testStats, stats.SSL) } } @@ -839,7 +767,7 @@ func TestGetMaxAPIVersionServer(t *testing.T) { t.Fatalf("unexpected error: %v", err) } - maxVer, err := c.GetMaxAPIVersion() + maxVer, err := c.GetMaxAPIVersion(context.Background()) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -871,7 +799,7 @@ func TestGetMaxAPIVersionClient(t *testing.T) { t.Fatalf("unexpected error: %v", err) } - maxVer, err := c.GetMaxAPIVersion() + maxVer, err := c.GetMaxAPIVersion(context.Background()) if err != nil { t.Fatalf("unexpected error: %v", err) } diff --git a/tests/client_no_stream_test.go b/tests/client_no_stream_test.go index cb29d465..525e3694 100644 --- a/tests/client_no_stream_test.go +++ b/tests/client_no_stream_test.go @@ -1,6 +1,7 @@ package tests import ( + "context" "testing" "github.com/nginxinc/nginx-plus-go-client/client" @@ -16,8 +17,8 @@ func TestStatsNoStream(t *testing.T) { if err != nil { t.Fatalf("Error connecting to nginx: %v", err) } - - stats, err := c.GetStats() + ctx := context.Background() + stats, err := c.GetStats(ctx) if err != nil { t.Errorf("Error getting stats: %v", err) } diff --git a/tests/client_test.go b/tests/client_test.go index 627631e1..bb97609a 100644 --- a/tests/client_test.go +++ b/tests/client_test.go @@ -1,6 +1,7 @@ package tests import ( + "context" "net" "reflect" "testing" @@ -46,13 +47,14 @@ func TestStreamClient(t *testing.T) { } // test adding a stream server + ctx := context.Background() - err = c.AddStreamServer(streamUpstream, streamServer) + err = c.AddStreamServer(ctx, streamUpstream, streamServer) if err != nil { t.Fatalf("Error when adding a server: %v", err) } - err = c.AddStreamServer(streamUpstream, streamServer) + err = c.AddStreamServer(ctx, streamUpstream, streamServer) if err == nil { t.Errorf("Adding a duplicated server succeeded") @@ -60,17 +62,17 @@ func TestStreamClient(t *testing.T) { // test deleting a stream server - err = c.DeleteStreamServer(streamUpstream, streamServer.Server) + err = c.DeleteStreamServer(ctx, streamUpstream, streamServer.Server) if err != nil { t.Fatalf("Error when deleting a server: %v", err) } - err = c.DeleteStreamServer(streamUpstream, streamServer.Server) + err = c.DeleteStreamServer(ctx, streamUpstream, streamServer.Server) if err == nil { t.Errorf("Deleting a nonexisting server succeeded") } - streamServers, err := c.GetStreamServers(streamUpstream) + streamServers, err := c.GetStreamServers(ctx, streamUpstream) if err != nil { t.Errorf("Error getting stream servers: %v", err) } @@ -91,7 +93,7 @@ func TestStreamClient(t *testing.T) { }, } - streamAdded, streamDeleted, streamUpdated, err := c.UpdateStreamServers(streamUpstream, streamServers1) + streamAdded, streamDeleted, streamUpdated, err := c.UpdateStreamServers(ctx, streamUpstream, streamServers1) if err != nil { t.Fatalf("Error when updating servers: %v", err) } @@ -107,7 +109,7 @@ func TestStreamClient(t *testing.T) { // test getting servers - streamServers, err = c.GetStreamServers(streamUpstream) + streamServers, err = c.GetStreamServers(ctx, streamUpstream) if err != nil { t.Fatalf("Error when getting servers: %v", err) } @@ -117,7 +119,7 @@ func TestStreamClient(t *testing.T) { // updating with the same servers - added, deleted, updated, err := c.UpdateStreamServers(streamUpstream, streamServers1) + added, deleted, updated, err := c.UpdateStreamServers(ctx, streamUpstream, streamServers1) if err != nil { t.Fatalf("Error when updating servers: %v", err) } @@ -144,7 +146,7 @@ func TestStreamClient(t *testing.T) { // updating one server with only one different parameter streamServers[1].SlowStart = newSlowStart - added, deleted, updated, err = c.UpdateStreamServers(streamUpstream, streamServers) + added, deleted, updated, err = c.UpdateStreamServers(ctx, streamUpstream, streamServers) if err != nil { t.Fatalf("Error when updating server with different parameters: %v", err) } @@ -158,7 +160,7 @@ func TestStreamClient(t *testing.T) { t.Errorf("The number of updated servers %v != 2", len(updated)) } - streamServers, err = c.GetStreamServers(streamUpstream) + streamServers, err = c.GetStreamServers(ctx, streamUpstream) if err != nil { t.Fatalf("Error when getting servers: %v", err) } @@ -209,7 +211,7 @@ func TestStreamClient(t *testing.T) { // updating with 2 new servers, 1 existing - added, deleted, updated, err = c.UpdateStreamServers(streamUpstream, streamServers2) + added, deleted, updated, err = c.UpdateStreamServers(ctx, streamUpstream, streamServers2) if err != nil { t.Fatalf("Error when updating servers: %v", err) } @@ -225,7 +227,7 @@ func TestStreamClient(t *testing.T) { // updating with zero servers - removing - added, deleted, updated, err = c.UpdateStreamServers(streamUpstream, []client.StreamUpstreamServer{}) + added, deleted, updated, err = c.UpdateStreamServers(ctx, streamUpstream, []client.StreamUpstreamServer{}) if err != nil { t.Fatalf("Error when updating servers: %v", err) } @@ -241,7 +243,7 @@ func TestStreamClient(t *testing.T) { // test getting servers again - servers, err := c.GetStreamServers(streamUpstream) + servers, err := c.GetStreamServers(ctx, streamUpstream) if err != nil { t.Fatalf("Error when getting servers: %v", err) } @@ -273,11 +275,13 @@ func TestStreamUpstreamServer(t *testing.T) { Backup: &backup, Down: &down, } - err = c.AddStreamServer(streamUpstream, streamServer) + ctx := context.Background() + + err = c.AddStreamServer(ctx, streamUpstream, streamServer) if err != nil { t.Errorf("Error adding upstream server: %v", err) } - servers, err := c.GetStreamServers(streamUpstream) + servers, err := c.GetStreamServers(ctx, streamUpstream) if err != nil { t.Fatalf("Error getting stream servers: %v", err) } @@ -292,7 +296,7 @@ func TestStreamUpstreamServer(t *testing.T) { } // remove stream upstream servers - _, _, _, err = c.UpdateStreamServers(streamUpstream, []client.StreamUpstreamServer{}) + _, _, _, err = c.UpdateStreamServers(ctx, streamUpstream, []client.StreamUpstreamServer{}) if err != nil { t.Errorf("Couldn't remove servers: %v", err) } @@ -305,13 +309,13 @@ func TestClient(t *testing.T) { } // test checking an upstream for existence - - err = c.CheckIfUpstreamExists(upstream) + ctx := context.Background() + err = c.CheckIfUpstreamExists(ctx, upstream) if err != nil { t.Fatalf("Error when checking an upstream for existence: %v", err) } - err = c.CheckIfUpstreamExists("random") + err = c.CheckIfUpstreamExists(ctx, "random") if err == nil { t.Errorf("Nonexisting upstream exists") } @@ -322,12 +326,12 @@ func TestClient(t *testing.T) { // test adding a http server - err = c.AddHTTPServer(upstream, server) + err = c.AddHTTPServer(ctx, upstream, server) if err != nil { t.Fatalf("Error when adding a server: %v", err) } - err = c.AddHTTPServer(upstream, server) + err = c.AddHTTPServer(ctx, upstream, server) if err == nil { t.Errorf("Adding a duplicated server succeeded") @@ -335,12 +339,12 @@ func TestClient(t *testing.T) { // test deleting a http server - err = c.DeleteHTTPServer(upstream, server.Server) + err = c.DeleteHTTPServer(ctx, upstream, server.Server) if err != nil { t.Fatalf("Error when deleting a server: %v", err) } - err = c.DeleteHTTPServer(upstream, server.Server) + err = c.DeleteHTTPServer(ctx, upstream, server.Server) if err == nil { t.Errorf("Deleting a nonexisting server succeeded") } @@ -358,7 +362,7 @@ func TestClient(t *testing.T) { }, } - added, deleted, updated, err := c.UpdateHTTPServers(upstream, servers1) + added, deleted, updated, err := c.UpdateHTTPServers(ctx, upstream, servers1) if err != nil { t.Fatalf("Error when updating servers: %v", err) } @@ -374,7 +378,7 @@ func TestClient(t *testing.T) { // test getting servers - servers, err := c.GetHTTPServers(upstream) + servers, err := c.GetHTTPServers(ctx, upstream) if err != nil { t.Fatalf("Error when getting servers: %v", err) } @@ -386,7 +390,7 @@ func TestClient(t *testing.T) { // updating with the same servers - added, deleted, updated, err = c.UpdateHTTPServers(upstream, servers1) + added, deleted, updated, err = c.UpdateHTTPServers(ctx, upstream, servers1) if err != nil { t.Fatalf("Error when updating servers: %v", err) } @@ -413,7 +417,7 @@ func TestClient(t *testing.T) { // updating one server with only one different parameter servers[1].SlowStart = newSlowStart - added, deleted, updated, err = c.UpdateHTTPServers(upstream, servers) + added, deleted, updated, err = c.UpdateHTTPServers(ctx, upstream, servers) if err != nil { t.Fatalf("Error when updating server with different parameters: %v", err) } @@ -427,7 +431,7 @@ func TestClient(t *testing.T) { t.Errorf("The number of updated servers %v != 2", len(updated)) } - servers, err = c.GetHTTPServers(upstream) + servers, err = c.GetHTTPServers(ctx, upstream) if err != nil { t.Fatalf("Error when getting servers: %v", err) } @@ -478,7 +482,7 @@ func TestClient(t *testing.T) { // updating with 2 new servers, 1 existing - added, deleted, updated, err = c.UpdateHTTPServers(upstream, servers2) + added, deleted, updated, err = c.UpdateHTTPServers(ctx, upstream, servers2) if err != nil { t.Fatalf("Error when updating servers: %v", err) } @@ -494,7 +498,7 @@ func TestClient(t *testing.T) { // updating with zero servers - removing - added, deleted, updated, err = c.UpdateHTTPServers(upstream, []client.UpstreamServer{}) + added, deleted, updated, err = c.UpdateHTTPServers(ctx, upstream, []client.UpstreamServer{}) if err != nil { t.Fatalf("Error when updating servers: %v", err) } @@ -510,7 +514,7 @@ func TestClient(t *testing.T) { // test getting servers again - servers, err = c.GetHTTPServers(upstream) + servers, err = c.GetHTTPServers(ctx, upstream) if err != nil { t.Fatalf("Error when getting servers: %v", err) } @@ -543,11 +547,12 @@ func TestUpstreamServer(t *testing.T) { Backup: &backup, Down: &down, } - err = c.AddHTTPServer(upstream, server) + ctx := context.Background() + err = c.AddHTTPServer(ctx, upstream, server) if err != nil { t.Errorf("Error adding upstream server: %v", err) } - servers, err := c.GetHTTPServers(upstream) + servers, err := c.GetHTTPServers(ctx, upstream) if err != nil { t.Fatalf("Error getting HTTPServers: %v", err) } @@ -562,7 +567,7 @@ func TestUpstreamServer(t *testing.T) { } // remove upstream servers - _, _, _, err = c.UpdateHTTPServers(upstream, []client.UpstreamServer{}) + _, _, _, err = c.UpdateHTTPServers(ctx, upstream, []client.UpstreamServer{}) if err != nil { t.Errorf("Couldn't remove servers: %v", err) } @@ -577,12 +582,13 @@ func TestStats(t *testing.T) { server := client.UpstreamServer{ Server: "127.0.0.1:8080", } - err = c.AddHTTPServer(upstream, server) + ctx := context.Background() + err = c.AddHTTPServer(ctx, upstream, server) if err != nil { t.Errorf("Error adding upstream server: %v", err) } - stats, err := c.GetStats() + stats, err := c.GetStats(ctx) if err != nil { t.Errorf("Error getting stats: %v", err) } @@ -703,7 +709,7 @@ func TestStats(t *testing.T) { } // cleanup upstream servers - _, _, _, err = c.UpdateHTTPServers(upstream, []client.UpstreamServer{}) + _, _, _, err = c.UpdateHTTPServers(ctx, upstream, []client.UpstreamServer{}) if err != nil { t.Errorf("Couldn't remove servers: %v", err) } @@ -733,11 +739,12 @@ func TestUpstreamServerDefaultParameters(t *testing.T) { Weight: &defaultWeight, Service: "", } - err = c.AddHTTPServer(upstream, server) + ctx := context.Background() + err = c.AddHTTPServer(ctx, upstream, server) if err != nil { t.Errorf("Error adding upstream server: %v", err) } - servers, err := c.GetHTTPServers(upstream) + servers, err := c.GetHTTPServers(ctx, upstream) if err != nil { t.Fatalf("Error getting HTTPServers: %v", err) } @@ -752,7 +759,7 @@ func TestUpstreamServerDefaultParameters(t *testing.T) { } // remove upstream servers - _, _, _, err = c.UpdateHTTPServers(upstream, []client.UpstreamServer{}) + _, _, _, err = c.UpdateHTTPServers(ctx, upstream, []client.UpstreamServer{}) if err != nil { t.Errorf("Couldn't remove servers: %v", err) } @@ -767,7 +774,8 @@ func TestStreamStats(t *testing.T) { server := client.StreamUpstreamServer{ Server: "127.0.0.1:8080", } - err = c.AddStreamServer(streamUpstream, server) + ctx := context.Background() + err = c.AddStreamServer(ctx, streamUpstream, server) if err != nil { t.Errorf("Error adding stream upstream server: %v", err) } @@ -781,7 +789,7 @@ func TestStreamStats(t *testing.T) { // wait for health checks time.Sleep(50 * time.Millisecond) - stats, err := c.GetStats() + stats, err := c.GetStats(ctx) if err != nil { t.Errorf("Error getting stats: %v", err) } @@ -829,7 +837,7 @@ func TestStreamStats(t *testing.T) { } // cleanup stream upstream servers - _, _, _, err = c.UpdateStreamServers(streamUpstream, []client.StreamUpstreamServer{}) + _, _, _, err = c.UpdateStreamServers(ctx, streamUpstream, []client.StreamUpstreamServer{}) if err != nil { t.Errorf("Couldn't remove stream servers: %v", err) } @@ -857,11 +865,12 @@ func TestStreamUpstreamServerDefaultParameters(t *testing.T) { Weight: &defaultWeight, Service: "", } - err = c.AddStreamServer(streamUpstream, streamServer) + ctx := context.Background() + err = c.AddStreamServer(ctx, streamUpstream, streamServer) if err != nil { t.Errorf("Error adding upstream server: %v", err) } - streamServers, err := c.GetStreamServers(streamUpstream) + streamServers, err := c.GetStreamServers(ctx, streamUpstream) if err != nil { t.Fatalf("Error getting stream servers: %v", err) } @@ -876,7 +885,7 @@ func TestStreamUpstreamServerDefaultParameters(t *testing.T) { } // cleanup stream upstream servers - _, _, _, err = c.UpdateStreamServers(streamUpstream, []client.StreamUpstreamServer{}) + _, _, _, err = c.UpdateStreamServers(ctx, streamUpstream, []client.StreamUpstreamServer{}) if err != nil { t.Errorf("Couldn't remove stream servers: %v", err) } @@ -889,13 +898,14 @@ func TestKeyValue(t *testing.T) { t.Fatalf("Error connecting to nginx: %v", err) } - err = c.AddKeyValPair(zoneName, "key1", "val1") + ctx := context.Background() + err = c.AddKeyValPair(ctx, zoneName, "key1", "val1") if err != nil { t.Errorf("Couldn't set keyvals: %v", err) } var keyValPairs client.KeyValPairs - keyValPairs, err = c.GetKeyValPairs(zoneName) + keyValPairs, err = c.GetKeyValPairs(ctx, zoneName) if err != nil { t.Errorf("Couldn't get keyvals for zone: %v, err: %v", zoneName, err) } @@ -906,7 +916,7 @@ func TestKeyValue(t *testing.T) { t.Errorf("maps are not equal. expected: %+v, got: %+v", expectedKeyValPairs, keyValPairs) } - keyValuPairsByZone, err := c.GetAllKeyValPairs() + keyValuPairsByZone, err := c.GetAllKeyValPairs(ctx) if err != nil { t.Errorf("Couldn't get keyvals, %v", err) } @@ -919,12 +929,12 @@ func TestKeyValue(t *testing.T) { // modify keyval expectedKeyValPairs["key1"] = "valModified1" - err = c.ModifyKeyValPair(zoneName, "key1", "valModified1") + err = c.ModifyKeyValPair(ctx, zoneName, "key1", "valModified1") if err != nil { t.Errorf("couldn't set keyval: %v", err) } - keyValPairs, err = c.GetKeyValPairs(zoneName) + keyValPairs, err = c.GetKeyValPairs(ctx, zoneName) if err != nil { t.Errorf("couldn't get keyval: %v", err) } @@ -933,17 +943,17 @@ func TestKeyValue(t *testing.T) { } // error expected - err = c.AddKeyValPair(zoneName, "key1", "valModified1") + err = c.AddKeyValPair(ctx, zoneName, "key1", "valModified1") if err == nil { t.Errorf("adding same key/val should result in error") } - err = c.AddKeyValPair(zoneName, "key2", "val2") + err = c.AddKeyValPair(ctx, zoneName, "key2", "val2") if err != nil { t.Errorf("error adding another key/val pair: %v", err) } - err = c.DeleteKeyValuePair(zoneName, "key1") + err = c.DeleteKeyValuePair(ctx, zoneName, "key1") if err != nil { t.Errorf("error deleting key") } @@ -951,7 +961,7 @@ func TestKeyValue(t *testing.T) { expectedKeyValPairs2 := client.KeyValPairs{ "key2": "val2", } - keyValPairs, err = c.GetKeyValPairs(zoneName) + keyValPairs, err = c.GetKeyValPairs(ctx, zoneName) if err != nil { t.Errorf("couldn't get keyval: %v", err) } @@ -959,12 +969,12 @@ func TestKeyValue(t *testing.T) { t.Errorf("didn't delete key1 %+v", keyValPairs) } - err = c.DeleteKeyValPairs(zoneName) + err = c.DeleteKeyValPairs(ctx, zoneName) if err != nil { t.Errorf("couldn't delete all: %v", err) } - keyValPairs, err = c.GetKeyValPairs(zoneName) + keyValPairs, err = c.GetKeyValPairs(ctx, zoneName) if err != nil { t.Errorf("couldn't get keyval: %v", err) } @@ -973,7 +983,7 @@ func TestKeyValue(t *testing.T) { } // error expected - err = c.ModifyKeyValPair(zoneName, "key1", "val1") + err = c.ModifyKeyValPair(ctx, zoneName, "key1", "val1") if err == nil { t.Errorf("modifying nonexistent key/val should result in error") } @@ -985,13 +995,13 @@ func TestKeyValueStream(t *testing.T) { if err != nil { t.Fatalf("Error connecting to nginx: %v", err) } - - err = c.AddStreamKeyValPair(zoneName, "key1", "val1") + ctx := context.Background() + err = c.AddStreamKeyValPair(ctx, zoneName, "key1", "val1") if err != nil { t.Errorf("Couldn't set keyvals: %v", err) } - keyValPairs, err := c.GetStreamKeyValPairs(zoneName) + keyValPairs, err := c.GetStreamKeyValPairs(ctx, zoneName) if err != nil { t.Errorf("Couldn't get keyvals for zone: %v, err: %v", zoneName, err) } @@ -1002,7 +1012,7 @@ func TestKeyValueStream(t *testing.T) { t.Errorf("maps are not equal. expected: %+v, got: %+v", expectedKeyValPairs, keyValPairs) } - keyValPairsByZone, err := c.GetAllStreamKeyValPairs() + keyValPairsByZone, err := c.GetAllStreamKeyValPairs(ctx) if err != nil { t.Errorf("Couldn't get keyvals, %v", err) } @@ -1016,12 +1026,12 @@ func TestKeyValueStream(t *testing.T) { // modify keyval expectedKeyValPairs["key1"] = "valModified1" - err = c.ModifyStreamKeyValPair(zoneName, "key1", "valModified1") + err = c.ModifyStreamKeyValPair(ctx, zoneName, "key1", "valModified1") if err != nil { t.Errorf("couldn't set keyval: %v", err) } - keyValPairs, err = c.GetStreamKeyValPairs(zoneName) + keyValPairs, err = c.GetStreamKeyValPairs(ctx, zoneName) if err != nil { t.Errorf("couldn't get keyval: %v", err) } @@ -1030,22 +1040,22 @@ func TestKeyValueStream(t *testing.T) { } // error expected - err = c.AddStreamKeyValPair(zoneName, "key1", "valModified1") + err = c.AddStreamKeyValPair(ctx, zoneName, "key1", "valModified1") if err == nil { t.Errorf("adding same key/val should result in error") } - err = c.AddStreamKeyValPair(zoneName, "key2", "val2") + err = c.AddStreamKeyValPair(ctx, zoneName, "key2", "val2") if err != nil { t.Errorf("error adding another key/val pair: %v", err) } - err = c.DeleteStreamKeyValuePair(zoneName, "key1") + err = c.DeleteStreamKeyValuePair(ctx, zoneName, "key1") if err != nil { t.Errorf("error deleting key") } - keyValPairs, err = c.GetStreamKeyValPairs(zoneName) + keyValPairs, err = c.GetStreamKeyValPairs(ctx, zoneName) if err != nil { t.Errorf("couldn't get keyval: %v", err) } @@ -1056,12 +1066,12 @@ func TestKeyValueStream(t *testing.T) { t.Errorf("didn't delete key1 %+v", keyValPairs) } - err = c.DeleteStreamKeyValPairs(zoneName) + err = c.DeleteStreamKeyValPairs(ctx, zoneName) if err != nil { t.Errorf("couldn't delete all: %v", err) } - keyValPairs, err = c.GetStreamKeyValPairs(zoneName) + keyValPairs, err = c.GetStreamKeyValPairs(ctx, zoneName) if err != nil { t.Errorf("couldn't get keyval: %v", err) } @@ -1070,7 +1080,7 @@ func TestKeyValueStream(t *testing.T) { } // error expected - err = c.ModifyStreamKeyValPair(zoneName, "key1", "valModified") + err = c.ModifyStreamKeyValPair(ctx, zoneName, "key1", "valModified") if err == nil { t.Errorf("modifying nonexistent key/val should result in error") } @@ -1086,8 +1096,8 @@ func TestStreamZoneSync(t *testing.T) { if err != nil { t.Fatalf("Error connecting to nginx: %v", err) } - - err = c1.AddStreamKeyValPair(streamZoneSync, "key1", "val1") + ctx := context.Background() + err = c1.AddStreamKeyValPair(ctx, streamZoneSync, "key1", "val1") if err != nil { t.Errorf("Couldn't set keyvals: %v", err) } @@ -1095,7 +1105,7 @@ func TestStreamZoneSync(t *testing.T) { // wait for nodes to sync information of synced zones time.Sleep(5 * time.Second) - statsC1, err := c1.GetStats() + statsC1, err := c1.GetStats(ctx) if err != nil { t.Errorf("Error getting stats: %v", err) } @@ -1135,7 +1145,7 @@ func TestStreamZoneSync(t *testing.T) { t.Errorf("Sync zone %v missing in stats", streamZoneSync) } - statsC2, err := c2.GetStats() + statsC2, err := c2.GetStats(ctx) if err != nil { t.Errorf("Error getting stats: %v", err) } @@ -1225,7 +1235,8 @@ func TestUpstreamServerWithDrain(t *testing.T) { } // Get existing upstream servers - servers, err := c.GetHTTPServers("test-drain") + ctx := context.Background() + servers, err := c.GetHTTPServers(ctx, "test-drain") if err != nil { t.Fatalf("Error getting HTTPServers: %v", err) } From 1062d6a44b70163be983d06267c635ed4bae7f63 Mon Sep 17 00:00:00 2001 From: aphralG <108004222+aphralG@users.noreply.github.com> Date: Tue, 24 Sep 2024 18:02:14 +0100 Subject: [PATCH 077/244] Add WithMaxAPIVersion Option to NginxClient (#380) * Added WithMaxAPIVersion option to NewNginxClient so that the Max API version can be set by a function --- .gitignore | 3 +++ client/nginx.go | 13 +++++++++ client/nginx_test.go | 63 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) diff --git a/.gitignore b/.gitignore index 7b57f9e7..0e534a13 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,7 @@ # Visual Studio Code settings .vscode +# Goland settings +.idea/ + dist diff --git a/client/nginx.go b/client/nginx.go index 3d868c0e..7d16420a 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -588,6 +588,19 @@ func WithCheckAPI() Option { } } +// WithMaxAPIVersion sets the API version to the max API version. +func WithMaxAPIVersion() Option { + return func(o *NginxClient) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + version, err := o.GetMaxAPIVersion(ctx) + if err != nil { + return + } + o.apiVersion = version + } +} + // NewNginxClient creates a new NginxClient. func NewNginxClient(apiEndpoint string, opts ...Option) (*NginxClient, error) { c := &NginxClient{ diff --git a/client/nginx_test.go b/client/nginx_test.go index 655b3f82..290abeb2 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -601,6 +601,69 @@ func TestClientWithHTTPClient(t *testing.T) { } } +func TestClientWithMaxAPI(t *testing.T) { + t.Parallel() + tests := []struct { + name string + apiVersions string + expected int + }{ + { + name: "Test 1: API versions contains invalid version", + apiVersions: `[4, 5, 6, 7, 8, 9, 25]`, + expected: APIVersion, + }, + { + name: "Test 2: No API versions, default API Version is used", + apiVersions: ``, + expected: APIVersion, + }, + { + name: "Test 3: API version lower than default", + apiVersions: `[4, 5, 6, 7]`, + expected: 7, + }, + { + name: "Test 4: No API versions, default API version is used", + apiVersions: `[""]`, + expected: APIVersion, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + // Test creating a new client with max API version + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch { + case r.RequestURI == "/": + _, err := w.Write([]byte(tt.apiVersions)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + default: + _, err := w.Write([]byte(`{}`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + } + })) + defer ts.Close() + + client, err := NewNginxClient(ts.URL, WithMaxAPIVersion()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if client == nil { + t.Fatalf("client is nil") + } + if client.apiVersion != tt.expected { + t.Fatalf("expected client.apiVersion to be %v, but got %v", tt.expected, client.apiVersion) + } + }) + } +} + func TestGetStats_NoStreamEndpoint(t *testing.T) { var writeLock sync.Mutex From 266da4c3ab06599a0d01a4ca16b02e88a1462590 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Tue, 24 Sep 2024 10:08:26 -0700 Subject: [PATCH 078/244] Add more linters (#382) --- .golangci.yml | 11 +++++ Makefile | 2 +- client/nginx_test.go | 82 +++++++++++++++++++++++++--------- tests/client_no_stream_test.go | 1 + tests/client_test.go | 12 +++++ 5 files changed, 86 insertions(+), 22 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 6c887ac9..0624468a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,24 +5,33 @@ linters-settings: ignore-generated-header: true rules: - name: blank-imports + - name: constant-logical-expr - name: context-as-argument - name: context-keys-type + - name: defer - name: dot-imports + - name: duplicated-imports - name: empty-block - name: error-naming - name: error-return - name: error-strings - name: errorf - name: exported + - name: import-shadowing - name: increment-decrement - name: indent-error-flow - name: package-comments - name: range + - name: range-val-address + - name: range-val-in-closure - name: receiver-naming - name: redefines-builtin-id + - name: string-of-int - name: superfluous-else - name: time-naming + - name: unchecked-type-assertion - name: unexported-return + - name: unnecessary-stmt - name: unreachable-code - name: unused-parameter - name: var-declaration @@ -60,6 +69,7 @@ linters: - ineffassign - intrange - makezero + - mirror - misspell - musttag - nilerr @@ -68,6 +78,7 @@ linters: - perfsprint - prealloc - predeclared + - paralleltest - reassign - revive - staticcheck diff --git a/Makefile b/Makefile index a458bd57..7db5c741 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ GOLANGCI_LINT_VERSION = v1.61.0 test: unit-test test-integration test-integration-no-stream-block clean lint: - docker run --pull always --rm -v $(shell pwd):/nginx-plus-go-client -w /nginx-plus-go-client -v $(shell go env GOCACHE):/cache/go -e GOCACHE=/cache/go -e GOLANGCI_LINT_CACHE=/cache/go -v $(shell go env GOPATH)/pkg:/go/pkg golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) golangci-lint --color always run + go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run --fix unit-test: go test -v -shuffle=on -race client/*.go diff --git a/client/nginx_test.go b/client/nginx_test.go index 290abeb2..86dff190 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -14,6 +14,7 @@ func TestDetermineUpdates(t *testing.T) { t.Parallel() maxConns := 1 tests := []struct { + name string updated []UpstreamServer nginx []UpstreamServer expectedToAdd []UpstreamServer @@ -57,6 +58,7 @@ func TestDetermineUpdates(t *testing.T) { Server: "10.0.0.2:80", }, }, + name: "replace all", }, { updated: []UpstreamServer{ @@ -95,6 +97,7 @@ func TestDetermineUpdates(t *testing.T) { Server: "10.0.0.1:80", }, }, + name: "add and delete", }, { updated: []UpstreamServer{ @@ -119,6 +122,7 @@ func TestDetermineUpdates(t *testing.T) { Server: "10.0.0.3:80", }, }, + name: "same", }, { // empty values @@ -153,14 +157,18 @@ func TestDetermineUpdates(t *testing.T) { MaxConns: &maxConns, }, }, + name: "update field and delete", }, } for _, test := range tests { - toAdd, toDelete, toUpdate := determineUpdates(test.updated, test.nginx) - if !reflect.DeepEqual(toAdd, test.expectedToAdd) || !reflect.DeepEqual(toDelete, test.expectedToDelete) || !reflect.DeepEqual(toUpdate, test.expectedToUpdate) { - t.Errorf("determineUpdates(%v, %v) = (%v, %v, %v)", test.updated, test.nginx, toAdd, toDelete, toUpdate) - } + t.Run(test.name, func(t *testing.T) { + t.Parallel() + toAdd, toDelete, toUpdate := determineUpdates(test.updated, test.nginx) + if !reflect.DeepEqual(toAdd, test.expectedToAdd) || !reflect.DeepEqual(toDelete, test.expectedToDelete) || !reflect.DeepEqual(toUpdate, test.expectedToUpdate) { + t.Errorf("determineUpdates(%v, %v) = (%v, %v, %v)", test.updated, test.nginx, toAdd, toDelete, toUpdate) + } + }) } } @@ -168,6 +176,7 @@ func TestStreamDetermineUpdates(t *testing.T) { t.Parallel() maxConns := 1 tests := []struct { + name string updated []StreamUpstreamServer nginx []StreamUpstreamServer expectedToAdd []StreamUpstreamServer @@ -211,6 +220,7 @@ func TestStreamDetermineUpdates(t *testing.T) { Server: "10.0.0.2:80", }, }, + name: "replace all", }, { updated: []StreamUpstreamServer{ @@ -249,6 +259,7 @@ func TestStreamDetermineUpdates(t *testing.T) { Server: "10.0.0.1:80", }, }, + name: "add and delete", }, { updated: []StreamUpstreamServer{ @@ -276,6 +287,7 @@ func TestStreamDetermineUpdates(t *testing.T) { Server: "10.0.0.3:80", }, }, + name: "same", }, { // empty values @@ -310,14 +322,18 @@ func TestStreamDetermineUpdates(t *testing.T) { MaxConns: &maxConns, }, }, + name: "update field and delete", }, } for _, test := range tests { - toAdd, toDelete, toUpdate := determineStreamUpdates(test.updated, test.nginx) - if !reflect.DeepEqual(toAdd, test.expectedToAdd) || !reflect.DeepEqual(toDelete, test.expectedToDelete) || !reflect.DeepEqual(toUpdate, test.expectedToUpdate) { - t.Errorf("determiteUpdates(%v, %v) = (%v, %v, %v)", test.updated, test.nginx, toAdd, toDelete, toUpdate) - } + t.Run(test.name, func(t *testing.T) { + t.Parallel() + toAdd, toDelete, toUpdate := determineStreamUpdates(test.updated, test.nginx) + if !reflect.DeepEqual(toAdd, test.expectedToAdd) || !reflect.DeepEqual(toDelete, test.expectedToDelete) || !reflect.DeepEqual(toUpdate, test.expectedToUpdate) { + t.Errorf("determiteUpdates(%v, %v) = (%v, %v, %v)", test.updated, test.nginx, toAdd, toDelete, toUpdate) + } + }) } } @@ -367,16 +383,20 @@ func TestAddPortToServer(t *testing.T) { } for _, test := range tests { - result := addPortToServer(test.address) - if result != test.expected { - t.Errorf("addPortToServer(%v) returned %v but expected %v for %v", test.address, result, test.expected, test.msg) - } + t.Run(test.msg, func(t *testing.T) { + t.Parallel() + result := addPortToServer(test.address) + if result != test.expected { + t.Errorf("addPortToServer(%v) returned %v but expected %v for %v", test.address, result, test.expected, test.msg) + } + }) } } func TestHaveSameParameters(t *testing.T) { t.Parallel() tests := []struct { + msg string server UpstreamServer serverNGX UpstreamServer expected bool @@ -385,11 +405,13 @@ func TestHaveSameParameters(t *testing.T) { server: UpstreamServer{}, serverNGX: UpstreamServer{}, expected: true, + msg: "empty", }, { server: UpstreamServer{ID: 2}, serverNGX: UpstreamServer{ID: 3}, expected: true, + msg: "different ID", }, { server: UpstreamServer{}, @@ -403,6 +425,7 @@ func TestHaveSameParameters(t *testing.T) { Down: &defaultDown, }, expected: true, + msg: "default values", }, { server: UpstreamServer{ @@ -428,35 +451,43 @@ func TestHaveSameParameters(t *testing.T) { Down: &defaultDown, }, expected: true, + msg: "same values", }, { server: UpstreamServer{SlowStart: "10s"}, serverNGX: UpstreamServer{}, expected: false, + msg: "different SlowStart", }, { server: UpstreamServer{}, serverNGX: UpstreamServer{SlowStart: "10s"}, expected: false, + msg: "different SlowStart 2", }, { server: UpstreamServer{SlowStart: "20s"}, serverNGX: UpstreamServer{SlowStart: "10s"}, expected: false, + msg: "different SlowStart 3", }, } for _, test := range tests { - result := haveSameParameters(test.server, test.serverNGX) - if result != test.expected { - t.Errorf("haveSameParameters(%v, %v) returned %v but expected %v", test.server, test.serverNGX, result, test.expected) - } + t.Run(test.msg, func(t *testing.T) { + t.Parallel() + result := haveSameParameters(test.server, test.serverNGX) + if result != test.expected { + t.Errorf("haveSameParameters(%v, %v) returned %v but expected %v", test.server, test.serverNGX, result, test.expected) + } + }) } } func TestHaveSameParametersForStream(t *testing.T) { t.Parallel() tests := []struct { + msg string server StreamUpstreamServer serverNGX StreamUpstreamServer expected bool @@ -465,11 +496,13 @@ func TestHaveSameParametersForStream(t *testing.T) { server: StreamUpstreamServer{}, serverNGX: StreamUpstreamServer{}, expected: true, + msg: "empty", }, { server: StreamUpstreamServer{ID: 2}, serverNGX: StreamUpstreamServer{ID: 3}, expected: true, + msg: "different ID", }, { server: StreamUpstreamServer{}, @@ -483,6 +516,7 @@ func TestHaveSameParametersForStream(t *testing.T) { Down: &defaultDown, }, expected: true, + msg: "default values", }, { server: StreamUpstreamServer{ @@ -508,24 +542,30 @@ func TestHaveSameParametersForStream(t *testing.T) { Down: &defaultDown, }, expected: true, + msg: "same values", }, { server: StreamUpstreamServer{}, serverNGX: StreamUpstreamServer{SlowStart: "10s"}, expected: false, + msg: "different SlowStart", }, { server: StreamUpstreamServer{SlowStart: "20s"}, serverNGX: StreamUpstreamServer{SlowStart: "10s"}, expected: false, + msg: "different SlowStart 2", }, } for _, test := range tests { - result := haveSameParametersForStream(test.server, test.serverNGX) - if result != test.expected { - t.Errorf("haveSameParametersForStream(%v, %v) returned %v but expected %v", test.server, test.serverNGX, result, test.expected) - } + t.Run(test.msg, func(t *testing.T) { + t.Parallel() + result := haveSameParametersForStream(test.server, test.serverNGX) + if result != test.expected { + t.Errorf("haveSameParametersForStream(%v, %v) returned %v but expected %v", test.server, test.serverNGX, result, test.expected) + } + }) } } @@ -665,9 +705,9 @@ func TestClientWithMaxAPI(t *testing.T) { } func TestGetStats_NoStreamEndpoint(t *testing.T) { + t.Parallel() var writeLock sync.Mutex - t.Parallel() ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { writeLock.Lock() defer writeLock.Unlock() diff --git a/tests/client_no_stream_test.go b/tests/client_no_stream_test.go index 525e3694..92ee0130 100644 --- a/tests/client_no_stream_test.go +++ b/tests/client_no_stream_test.go @@ -13,6 +13,7 @@ import ( // The API returns a special error code that we can use to determine if the API // is misconfigured or of the stream block is missing. func TestStatsNoStream(t *testing.T) { + t.Parallel() c, err := client.NewNginxClient(helpers.GetAPIEndpoint()) if err != nil { t.Fatalf("Error connecting to nginx: %v", err) diff --git a/tests/client_test.go b/tests/client_test.go index bb97609a..a93af8ff 100644 --- a/tests/client_test.go +++ b/tests/client_test.go @@ -33,6 +33,7 @@ var ( defaultWeight = 1 ) +//nolint:paralleltest func TestStreamClient(t *testing.T) { c, err := client.NewNginxClient( helpers.GetAPIEndpoint(), @@ -254,6 +255,7 @@ func TestStreamClient(t *testing.T) { } func TestStreamUpstreamServer(t *testing.T) { + t.Parallel() c, err := client.NewNginxClient(helpers.GetAPIEndpoint()) if err != nil { t.Fatalf("Error connecting to nginx: %v", err) @@ -302,6 +304,7 @@ func TestStreamUpstreamServer(t *testing.T) { } } +//nolint:paralleltest func TestClient(t *testing.T) { c, err := client.NewNginxClient(helpers.GetAPIEndpoint()) if err != nil { @@ -524,6 +527,7 @@ func TestClient(t *testing.T) { } } +//nolint:paralleltest func TestUpstreamServer(t *testing.T) { c, err := client.NewNginxClient(helpers.GetAPIEndpoint()) if err != nil { @@ -573,6 +577,7 @@ func TestUpstreamServer(t *testing.T) { } } +//nolint:paralleltest func TestStats(t *testing.T) { c, err := client.NewNginxClient(helpers.GetAPIEndpoint()) if err != nil { @@ -715,6 +720,7 @@ func TestStats(t *testing.T) { } } +//nolint:paralleltest func TestUpstreamServerDefaultParameters(t *testing.T) { c, err := client.NewNginxClient(helpers.GetAPIEndpoint()) if err != nil { @@ -765,6 +771,7 @@ func TestUpstreamServerDefaultParameters(t *testing.T) { } } +//nolint:paralleltest func TestStreamStats(t *testing.T) { c, err := client.NewNginxClient(helpers.GetAPIEndpoint()) if err != nil { @@ -843,6 +850,7 @@ func TestStreamStats(t *testing.T) { } } +//nolint:paralleltest func TestStreamUpstreamServerDefaultParameters(t *testing.T) { c, err := client.NewNginxClient(helpers.GetAPIEndpoint()) if err != nil { @@ -891,6 +899,7 @@ func TestStreamUpstreamServerDefaultParameters(t *testing.T) { } } +//nolint:paralleltest func TestKeyValue(t *testing.T) { zoneName := "zone_one" c, err := client.NewNginxClient(helpers.GetAPIEndpoint()) @@ -989,6 +998,7 @@ func TestKeyValue(t *testing.T) { } } +//nolint:paralleltest func TestKeyValueStream(t *testing.T) { zoneName := "zone_one_stream" c, err := client.NewNginxClient(helpers.GetAPIEndpoint()) @@ -1087,6 +1097,7 @@ func TestKeyValueStream(t *testing.T) { } func TestStreamZoneSync(t *testing.T) { + t.Parallel() c1, err := client.NewNginxClient(helpers.GetAPIEndpoint()) if err != nil { t.Fatalf("Error connecting to nginx: %v", err) @@ -1214,6 +1225,7 @@ func compareStreamUpstreamServers(x []client.StreamUpstreamServer, y []client.St } func TestUpstreamServerWithDrain(t *testing.T) { + t.Parallel() c, err := client.NewNginxClient(helpers.GetAPIEndpoint()) if err != nil { t.Fatalf("Error connecting to nginx: %v", err) From 96e662da12368893f48c40c38324542fe7e6dad0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 19:28:01 +0000 Subject: [PATCH 079/244] Update github/codeql-action action to v3.26.9 (#387) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.26.8 | v3.26.9 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7c2c7ae3..14fd89ee 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 + uses: github/codeql-action/init@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 + uses: github/codeql-action/analyze@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index b51fe1c1..accc988c 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 + uses: github/codeql-action/upload-sarif@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 with: sarif_file: results.sarif From dc00e3d56a50f8de4af361658b439bccdf19764b Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Tue, 24 Sep 2024 14:03:57 -0700 Subject: [PATCH 080/244] Update go module to use v2 (#386) --- go.mod | 2 +- tests/client_no_stream_test.go | 4 ++-- tests/client_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 918fd882..6fb1a4f1 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/nginxinc/nginx-plus-go-client +module github.com/nginxinc/nginx-plus-go-client/v2 go 1.22.6 diff --git a/tests/client_no_stream_test.go b/tests/client_no_stream_test.go index 92ee0130..2ec1da93 100644 --- a/tests/client_no_stream_test.go +++ b/tests/client_no_stream_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "github.com/nginxinc/nginx-plus-go-client/client" - "github.com/nginxinc/nginx-plus-go-client/tests/helpers" + "github.com/nginxinc/nginx-plus-go-client/v2/client" + "github.com/nginxinc/nginx-plus-go-client/v2/tests/helpers" ) // TestStatsNoStream tests the peculiar behavior of getting Stream-related diff --git a/tests/client_test.go b/tests/client_test.go index a93af8ff..1217f5ad 100644 --- a/tests/client_test.go +++ b/tests/client_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/nginxinc/nginx-plus-go-client/client" - "github.com/nginxinc/nginx-plus-go-client/tests/helpers" + "github.com/nginxinc/nginx-plus-go-client/v2/client" + "github.com/nginxinc/nginx-plus-go-client/v2/tests/helpers" ) const ( From 230e1a141b7bfd6c49decbcb309ede4d1d5c1573 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 09:05:53 -0700 Subject: [PATCH 081/244] Update reviewdog/action-actionlint action to v1.57.0 (#392) | datasource | package | from | to | | ----------- | --------------------------- | ------- | ------- | | github-tags | reviewdog/action-actionlint | v1.55.0 | v1.57.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 11540699..aeb65316 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Lint Actions - uses: reviewdog/action-actionlint@05c9d7bef25a46caf572df3497afa7082fc111df # v1.55.0 + uses: reviewdog/action-actionlint@7eeec1dd160c2301eb28e1568721837d084558ad # v1.57.0 with: actionlint_flags: -shellcheck "" From 6dc968c3a6bcaa9ed6beb6bb61e7527d26b3ffe5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:08:22 +0000 Subject: [PATCH 082/244] Update dependency ubuntu to v24 (#393) | datasource | package | from | to | | -------------- | ------- | ----- | ----- | | github-runners | ubuntu | 22.04 | 24.04 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependency-review.yml | 2 +- .github/workflows/f5-cla.yml | 2 +- .github/workflows/fossa.yml | 2 +- .github/workflows/labeler.yml | 2 +- .github/workflows/lint.yml | 8 ++++---- .github/workflows/notifications.yml | 2 +- .github/workflows/stale.yml | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ece140f4..c885d931 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ permissions: jobs: unit-test: name: Unit Test - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: contents: read strategy: @@ -50,7 +50,7 @@ jobs: build: name: Build Client - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: contents: write issues: write diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 14fd89ee..caf79a65 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -24,7 +24,7 @@ permissions: jobs: analyze: name: Analyze - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: actions: read # for github/codeql-action/init to get workflow details contents: read # for actions/checkout to fetch code diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index c36a9f2b..ca276903 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -17,7 +17,7 @@ permissions: jobs: dependency-review: name: Dependency Review - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: contents: read # for actions/checkout pull-requests: write # for actions/dependency-review-action to post comments diff --git a/.github/workflows/f5-cla.yml b/.github/workflows/f5-cla.yml index a1c34f89..1bdcc190 100644 --- a/.github/workflows/f5-cla.yml +++ b/.github/workflows/f5-cla.yml @@ -19,7 +19,7 @@ permissions: jobs: f5-cla: name: F5 CLA - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: actions: write contents: read diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index aecd3ad2..5c40b982 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -17,7 +17,7 @@ permissions: jobs: scan: name: Fossa - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index e56a9a15..9671139e 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -10,7 +10,7 @@ jobs: permissions: contents: read pull-requests: write # for actions/labeler to add labels - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index aeb65316..4a5bed07 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,7 +22,7 @@ permissions: jobs: lint: name: Go Lint - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -39,7 +39,7 @@ jobs: actionlint: name: Actionlint - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -51,7 +51,7 @@ jobs: markdown-lint: name: Markdown Lint - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -65,7 +65,7 @@ jobs: yaml-lint: name: YAML lint - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 diff --git a/.github/workflows/notifications.yml b/.github/workflows/notifications.yml index c5bed0d1..dfaeaf0d 100644 --- a/.github/workflows/notifications.yml +++ b/.github/workflows/notifications.yml @@ -16,7 +16,7 @@ permissions: jobs: on-failure: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.repository.fork == false }} permissions: contents: read diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index ddae2323..d63ccc29 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -11,7 +11,7 @@ jobs: permissions: issues: write # for actions/stale to close stale issues pull-requests: write # for actions/stale to close stale PRs - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 with: From cb528216a613144adb3ecb885712dba378cc7b85 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:12:04 +0000 Subject: [PATCH 083/244] Update docker/build-push-action action to v6.9.0 (#391) | datasource | package | from | to | | ----------- | ------------------------ | ------ | ------ | | github-tags | docker/build-push-action | v6.7.0 | v6.9.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c885d931..4574af9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 - name: Build Plus Docker Image - uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0 + uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 with: file: docker/Dockerfile tags: nginx-plus From 9d768e5411a1e307e7c9c0705c6a010b327c703a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:16:31 +0000 Subject: [PATCH 084/244] Update actions/checkout action to v4.2.0 (#390) | datasource | package | from | to | | ----------- | ---------------- | ------ | ------ | | github-tags | actions/checkout | v4.1.7 | v4.2.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependency-review.yml | 2 +- .github/workflows/fossa.yml | 2 +- .github/workflows/labeler.yml | 2 +- .github/workflows/lint.yml | 8 ++++---- .github/workflows/scorecard.yml | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4574af9e..7a638ab4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: go-version: ["1.21", "1.22", stable] steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Golang Environment uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 @@ -57,7 +57,7 @@ jobs: if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Switch Repository (Nightly) if: (github.event_name == 'schedule') diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index caf79a65..33f99f1e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -48,7 +48,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Golang Environment uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index ca276903..b449a5cd 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -24,7 +24,7 @@ jobs: if: ${{ github.event_name != 'merge_group' }} steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Dependency Review uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4 diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index 5c40b982..7b1842ce 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -21,7 +21,7 @@ jobs: if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Scan uses: fossas/fossa-action@09bcf127dc0ccb4b5a023f6f906728878e8610ba # v1.4.0 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 9671139e..45fdba80 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -12,7 +12,7 @@ jobs: pull-requests: write # for actions/labeler to add labels runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | labeler.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4a5bed07..607392c6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Golang Environment uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Lint Actions uses: reviewdog/action-actionlint@7eeec1dd160c2301eb28e1568721837d084558ad # v1.57.0 @@ -54,7 +54,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Lint Markdown uses: DavidAnson/markdownlint-cli2-action@db43aef879112c3119a410d69f66701e0d530809 # v17.0.0 @@ -67,7 +67,7 @@ jobs: name: YAML lint runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Lint YAML uses: reviewdog/action-yamllint@e09f07780388032a624e9eb44a23fd1bbb4052cc # v1.19.0 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index accc988c..35be4177 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -26,7 +26,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: persist-credentials: false From 90d2dd613afad5008af8bf5da083dc2a9bad81e1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:55:03 +0000 Subject: [PATCH 085/244] Update contributor-assistant/github-action action to v2.6.1 (#388) | datasource | package | from | to | | ----------- | ----------------------------------- | ------ | ------ | | github-tags | contributor-assistant/github-action | v2.6.0 | v2.6.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/f5-cla.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/f5-cla.yml b/.github/workflows/f5-cla.yml index 1bdcc190..7f2c1d6c 100644 --- a/.github/workflows/f5-cla.yml +++ b/.github/workflows/f5-cla.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Run F5 Contributor License Agreement (CLA) assistant if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have hereby read the F5 CLA and agree to its terms') || github.event_name == 'pull_request_target' - uses: contributor-assistant/github-action@b1522fa982419e79591a92e1267de463a281cdb7 # v2.6.0 + uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1 with: # Any pull request targeting the following branch will trigger a CLA check. branch: "main" From b5593483553f516345d815df24bceac2ef14986e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:00:45 +0000 Subject: [PATCH 086/244] Update github/codeql-action action to v3.26.10 (#394) | datasource | package | from | to | | ----------- | -------------------- | ------- | -------- | | github-tags | github/codeql-action | v3.26.9 | v3.26.10 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 33f99f1e..d9ff4182 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 + uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 + uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 35be4177..8ffdf646 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 + uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 with: sarif_file: results.sarif From 53ab92c0520e6c1d63f3d4dee4aac088853fecdb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 18:58:27 +0000 Subject: [PATCH 087/244] Update pre-commit hook gitleaks/gitleaks to v8.19.3 (#389) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.19.2 | v8.19.3 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a16d59a0..7bbc5aeb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.19.2 + rev: v8.19.3 hooks: - id: gitleaks From a7af024aecf56342995a3187795daf2f5dc229b2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 17:05:44 +0100 Subject: [PATCH 088/244] Update pre-commit hook pre-commit/pre-commit-hooks to v5 (#399) | datasource | package | from | to | | ----------- | --------------------------- | ------ | ------ | | github-tags | pre-commit/pre-commit-hooks | v4.6.0 | v5.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7bbc5aeb..af22eca9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer From 92b01912bf8cd5b614c808b53889c2b1de6c4e45 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 19:15:29 +0000 Subject: [PATCH 089/244] Update github/codeql-action action to v3.26.12 (#395) | datasource | package | from | to | | ----------- | -------------------- | -------- | -------- | | github-tags | github/codeql-action | v3.26.10 | v3.26.12 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d9ff4182..b66df8aa 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 + uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 + uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 8ffdf646..7f49dc85 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 + uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12 with: sarif_file: results.sarif From e387d5366a41c5ecd5532b51b53ae30b8243e30a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 21:43:55 +0000 Subject: [PATCH 090/244] Update golangci/golangci-lint-action action to v6.1.1 (#396) | datasource | package | from | to | | ----------- | ----------------------------- | ------ | ------ | | github-tags | golangci/golangci-lint-action | v6.1.0 | v6.1.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 607392c6..3e10d94c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,7 +33,7 @@ jobs: go-version: stable - name: Lint Go - uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 + uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 with: version: v1.61.0 # renovate: datasource=github-tags depName=golangci/golangci-lint From 83e7b4d1a4bfceaea960df34a44d5ca49160daba Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 01:54:31 +0000 Subject: [PATCH 091/244] Update docker/setup-buildx-action action to v3.7.1 (#397) | datasource | package | from | to | | ----------- | -------------------------- | ------ | ------ | | github-tags | docker/setup-buildx-action | v3.6.1 | v3.7.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a638ab4..8536e001 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: sed -i 's|\${NGINX_PLUS_VERSION}/||g' docker/Dockerfile - name: Set up Docker Buildx - uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 + uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 - name: Build Plus Docker Image uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 From 5d62417a8f22a8883f7706e7b2c3f285bd84c6c3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:54:32 +0100 Subject: [PATCH 092/244] Update pre-commit hook gitleaks/gitleaks to v8.20.1 (#398) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.19.3 | v8.20.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index af22eca9..743af821 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.19.3 + rev: v8.20.1 hooks: - id: gitleaks From 42a1f3445bdfde0e8658cbeb321d4954bf015016 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:26:41 +0000 Subject: [PATCH 093/244] Update dependency goreleaser/goreleaser to v2.4.4 (#406) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.3.2 | v2.4.4 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8536e001..1b368839 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 with: - version: v2.3.2 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.4.4 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 42d5ae66293875d1bfb9dc73a4cf584a91652cba Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:21:59 +0000 Subject: [PATCH 094/244] Update pre-commit hook DavidAnson/markdownlint-cli2 to v0.15.0 (#411) | datasource | package | from | to | | ----------- | ---------------------------- | ------- | ------- | | github-tags | DavidAnson/markdownlint-cli2 | v0.14.0 | v0.15.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 743af821..80fcffec 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: gitleaks - repo: https://github.com/DavidAnson/markdownlint-cli2 - rev: v0.14.0 + rev: v0.15.0 hooks: - id: markdownlint-cli2 From 53c0ad038c1ba38f450f99e3c6de688d914d0568 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:10:19 +0000 Subject: [PATCH 095/244] Update goreleaser/goreleaser-action action to v6.1.0 (#409) | datasource | package | from | to | | ----------- | ---------------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser-action | v6.0.0 | v6.1.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b368839..a9015fa9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: if: ${{ github.ref_type == 'tag' }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 + uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 with: version: v2.4.4 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean From fc6cde1f418d40367c0c4ae9adc8d2c74e6f04d6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 12:46:03 +0000 Subject: [PATCH 096/244] Update dependency golangci/golangci-lint to v1.62.0 (#408) | datasource | package | from | to | | ----------- | ---------------------- | ------- | ------- | | github-tags | golangci/golangci-lint | v1.61.0 | v1.62.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .pre-commit-config.yaml | 2 +- Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3e10d94c..6b42f04e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 with: - version: v1.61.0 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v1.62.0 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 80fcffec..6adc0a15 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v1.61.0 + rev: v1.62.0 hooks: - id: golangci-lint-full diff --git a/Makefile b/Makefile index 7db5c741..a53ed596 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v1.61.0 +GOLANGCI_LINT_VERSION = v1.62.0 test: unit-test test-integration test-integration-no-stream-block clean From da426b4a71ac7ac3b431eacc536734d80efb8c29 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:24:33 +0000 Subject: [PATCH 097/244] Update actions/checkout action to v4.2.2 (#400) | datasource | package | from | to | | ----------- | ---------------- | ------ | ------ | | github-tags | actions/checkout | v4.2.0 | v4.2.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependency-review.yml | 2 +- .github/workflows/fossa.yml | 2 +- .github/workflows/labeler.yml | 2 +- .github/workflows/lint.yml | 8 ++++---- .github/workflows/scorecard.yml | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9015fa9..230ff5e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: go-version: ["1.21", "1.22", stable] steps: - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 @@ -57,7 +57,7 @@ jobs: if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Switch Repository (Nightly) if: (github.event_name == 'schedule') diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b66df8aa..cc9e0fec 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -48,7 +48,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index b449a5cd..78670dd5 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -24,7 +24,7 @@ jobs: if: ${{ github.event_name != 'merge_group' }} steps: - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Dependency Review uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4 diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index 7b1842ce..20a37ff1 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -21,7 +21,7 @@ jobs: if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Scan uses: fossas/fossa-action@09bcf127dc0ccb4b5a023f6f906728878e8610ba # v1.4.0 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 45fdba80..443756d6 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -12,7 +12,7 @@ jobs: pull-requests: write # for actions/labeler to add labels runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: sparse-checkout: | labeler.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6b42f04e..84a69403 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Actions uses: reviewdog/action-actionlint@7eeec1dd160c2301eb28e1568721837d084558ad # v1.57.0 @@ -54,7 +54,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Markdown uses: DavidAnson/markdownlint-cli2-action@db43aef879112c3119a410d69f66701e0d530809 # v17.0.0 @@ -67,7 +67,7 @@ jobs: name: YAML lint runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint YAML uses: reviewdog/action-yamllint@e09f07780388032a624e9eb44a23fd1bbb4052cc # v1.19.0 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 7f49dc85..2d565d8d 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -26,7 +26,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false From 9d437aaeef4dcc379318997c8684ab8a2eb81ac9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:27:03 +0000 Subject: [PATCH 098/244] Update dependency goreleaser/goreleaser to v2.4.6 (#412) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.4.4 | v2.4.6 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 230ff5e5..a453ec2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 with: - version: v2.4.4 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.4.6 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d68685eea371917f699e08f0f97d295be0a333d2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:50:01 +0000 Subject: [PATCH 099/244] Update actions/upload-artifact action to v4.4.3 (#401) | datasource | package | from | to | | ----------- | ----------------------- | ------ | ------ | | github-tags | actions/upload-artifact | v4.4.0 | v4.4.3 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 2d565d8d..60b1a953 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -49,7 +49,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: SARIF file path: results.sarif From 9c80e3b0058e65e7d1118cf7601153969a6896e8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 11:49:01 +0000 Subject: [PATCH 100/244] Update module golang.org/x/sync to v0.9.0 (#410) | datasource | package | from | to | | ---------- | ----------------- | ------ | ------ | | go | golang.org/x/sync | v0.8.0 | v0.9.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6fb1a4f1..e4619f01 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/nginxinc/nginx-plus-go-client/v2 go 1.22.6 -require golang.org/x/sync v0.8.0 +require golang.org/x/sync v0.9.0 diff --git a/go.sum b/go.sum index e584c1bd..fc7734dc 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= From a167815c2979e3bc8e14c757595bcc9e74675866 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:27:00 +0000 Subject: [PATCH 101/244] Update docker/dockerfile Docker tag to v1.11 (#407) | datasource | package | from | to | | ---------- | ----------------- | ---- | ---- | | docker | docker/dockerfile | 1.10 | 1.11 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 1f1e2ad1..51f54687 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.10 +# syntax=docker/dockerfile:1.11 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " From c3c51e88dc41b1a818ccee5a590858b4bcf855d3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:00:37 +0000 Subject: [PATCH 102/244] Update actions/dependency-review-action action to v4.4.0 (#404) | datasource | package | from | to | | ----------- | -------------------------------- | ------ | ------ | | github-tags | actions/dependency-review-action | v4.3.4 | v4.4.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/dependency-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 78670dd5..02dee51e 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -27,6 +27,6 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Dependency Review - uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4 + uses: actions/dependency-review-action@4081bf99e2866ebe428fc0477b69eb4fcda7220a # v4.4.0 with: config-file: "nginxinc/k8s-common/dependency-review-config.yml@main" From 78abff4592b810901dcd79ad5fa0c2c7743ff5f9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:37:12 +0000 Subject: [PATCH 103/244] Update pre-commit hook gitleaks/gitleaks to v8.21.2 (#403) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.20.1 | v8.21.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6adc0a15..8758b58e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.20.1 + rev: v8.21.2 hooks: - id: gitleaks From 79273bc428e3fabdb7d3c82c5d5f221b095d497a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:40:54 +0000 Subject: [PATCH 104/244] Update dependency goreleaser/goreleaser to v2.4.7 (#415) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.4.6 | v2.4.7 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a453ec2d..da04048b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 with: - version: v2.4.6 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.4.7 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 61d0765579c4db24900037eb96b8118c3eb0e18f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:50:37 +0000 Subject: [PATCH 105/244] Update actions/setup-go action to v5.1.0 (#405) | datasource | package | from | to | | ----------- | ---------------- | ------ | ------ | | github-tags | actions/setup-go | v5.0.2 | v5.1.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/lint.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da04048b..5d4ddedc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 with: go-version: ${{ matrix.go-version }} @@ -100,7 +100,7 @@ jobs: if: ${{ github.event_name == 'push' }} - name: Setup Golang Environment - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 with: go-version: stable if: ${{ github.ref_type == 'tag' }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cc9e0fec..b049b69c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,7 +51,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 with: go-version: stable if: matrix.language == 'go' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 84a69403..b7eeca27 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 with: go-version: stable From 7ea358a6779813de7ec350a317cc9adffc07720a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:30:47 +0000 Subject: [PATCH 106/244] Update github/codeql-action action to v3.27.4 (#402) | datasource | package | from | to | | ----------- | -------------------- | -------- | ------- | | github-tags | github/codeql-action | v3.26.12 | v3.27.4 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b049b69c..33eacce9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12 + uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12 + uses: github/codeql-action/analyze@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 60b1a953..65b93109 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12 + uses: github/codeql-action/upload-sarif@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4 with: sarif_file: results.sarif From 09a47e45c69ba79ef126020dca787e1403a78378 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:16:01 +0000 Subject: [PATCH 107/244] Update DavidAnson/markdownlint-cli2-action action to v18 (#413) | datasource | package | from | to | | ----------- | ----------------------------------- | ------- | ------- | | github-tags | DavidAnson/markdownlint-cli2-action | v17.0.0 | v18.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b7eeca27..4ca626fb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -57,7 +57,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Markdown - uses: DavidAnson/markdownlint-cli2-action@db43aef879112c3119a410d69f66701e0d530809 # v17.0.0 + uses: DavidAnson/markdownlint-cli2-action@eb5ca3ab411449c66620fe7f1b3c9e10547144b0 # v18.0.0 with: config: .markdownlint-cli2.yaml globs: "**/*.md" From 2dcffdd917a1abd7f408e71315e5c24480a60016 Mon Sep 17 00:00:00 2001 From: Paul Abel <128620221+pdabelf5@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:04:07 +0000 Subject: [PATCH 108/244] add license support (#414) --- client/nginx.go | 70 ++++++++++++++++++++++++++++++++++++++++---- client/nginx_test.go | 70 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+), 5 deletions(-) diff --git a/client/nginx.go b/client/nginx.go index 7d16420a..47c2fb3e 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -9,7 +9,9 @@ import ( "io" "net/http" "reflect" + "regexp" "slices" + "strconv" "strings" "sync" "time" @@ -41,11 +43,12 @@ var ( ) var ( - ErrParameterRequired = errors.New("parameter is required") - ErrServerNotFound = errors.New("server not found") - ErrServerExists = errors.New("server already exists") - ErrNotSupported = errors.New("not supported") - ErrInvalidTimeout = errors.New("invalid timeout") + ErrParameterRequired = errors.New("parameter is required") + ErrServerNotFound = errors.New("server not found") + ErrServerExists = errors.New("server already exists") + ErrNotSupported = errors.New("not supported") + ErrInvalidTimeout = errors.New("invalid timeout") + ErrPlusVersionNotFound = errors.New("plus version not found in the input string") ) // NginxClient lets you access NGINX Plus API. @@ -193,6 +196,20 @@ type NginxInfo struct { ParentProcessID uint64 `json:"ppid"` } +// LicenseReporting contains information about license status for NGINX Plus. +type LicenseReporting struct { + Healthy bool + Fails uint64 + Grace uint64 +} + +// NginxLicense contains licensing information about NGINX Plus. +type NginxLicense struct { + ActiveTill uint64 `json:"active_till"` + Eval bool + Reporting LicenseReporting +} + // Caches is a map of cache stats by cache zone. type Caches = map[string]HTTPCache @@ -1553,6 +1570,30 @@ func (client *NginxClient) GetNginxInfo(ctx context.Context) (*NginxInfo, error) return &info, nil } +// GetNginxLicense returns Nginx License data with a context. +func (client *NginxClient) GetNginxLicense(ctx context.Context) (*NginxLicense, error) { + var data NginxLicense + + info, err := client.GetNginxInfo(ctx) + if err != nil { + return nil, fmt.Errorf("failed to get nginx info: %w", err) + } + release, err := extractPlusVersionValues(info.Build) + if err != nil { + return nil, fmt.Errorf("failed to get nginx plus release: %w", err) + } + + if (client.apiVersion < 9) || (release < 33) { + return &data, nil + } + + err = client.get(ctx, "license", &data) + if err != nil { + return nil, fmt.Errorf("failed to get license: %w", err) + } + return &data, nil +} + // GetCaches returns Cache stats with a context. func (client *NginxClient) GetCaches(ctx context.Context) (*Caches, error) { var caches Caches @@ -1988,3 +2029,22 @@ func (client *NginxClient) GetWorkers(ctx context.Context) ([]*Workers, error) { } return workers, nil } + +var rePlus = regexp.MustCompile(`-r(\d+)`) + +// extractPlusVersionValues. +func extractPlusVersionValues(input string) (int, error) { + var rValue int + matches := rePlus.FindStringSubmatch(input) + + if len(matches) < 1 { + return 0, fmt.Errorf("%w [%s]", ErrPlusVersionNotFound, input) + } + + rValue, err := strconv.Atoi(matches[1]) + if err != nil { + return 0, fmt.Errorf("failed to convert NGINX Plus release to integer: %w", err) + } + + return rValue, nil +} diff --git a/client/nginx_test.go b/client/nginx_test.go index 86dff190..36cb87cf 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -910,3 +910,73 @@ func TestGetMaxAPIVersionClient(t *testing.T) { t.Fatalf("expected %v, got %v", c.apiVersion, maxVer) } } + +func TestExtractPlusVersion(t *testing.T) { + t.Parallel() + tests := []struct { + name string + version string + expected int + }{ + { + name: "r32", + version: "nginx-plus-r32", + expected: 32, + }, + { + name: "r32p1", + version: "nginx-plus-r32-p1", + expected: 32, + }, + { + name: "r32p2", + version: "nginx-plus-r32-p2", + expected: 32, + }, + { + name: "r33", + version: "nginx-plus-r33", + expected: 33, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + t.Parallel() + version, err := extractPlusVersionValues(test.version) + if err != nil { + t.Error(err) + } + if version != test.expected { + t.Errorf("values do not match, got: %d, expected %d)", version, test.expected) + } + }) + } +} + +func TestExtractPlusVersionNegativeCase(t *testing.T) { + t.Parallel() + tests := []struct { + name string + version string + }{ + { + name: "no-number", + version: "nginx-plus-rxx", + }, + { + name: "extra-chars", + version: "nginx-plus-rxx4343", + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + t.Parallel() + _, err := extractPlusVersionValues(test.version) + if err == nil { + t.Errorf("Expected error but got %v", err) + } + }) + } +} From b6a4cc96b78b65dfffc37f591d2d0291fae87113 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:09:40 +0000 Subject: [PATCH 109/244] Update actions/dependency-review-action action to v4.5.0 (#418) | datasource | package | from | to | | ----------- | -------------------------------- | ------ | ------ | | github-tags | actions/dependency-review-action | v4.4.0 | v4.5.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/dependency-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 02dee51e..93ee2b05 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -27,6 +27,6 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Dependency Review - uses: actions/dependency-review-action@4081bf99e2866ebe428fc0477b69eb4fcda7220a # v4.4.0 + uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0 with: config-file: "nginxinc/k8s-common/dependency-review-config.yml@main" From 6ed8ac0fcd20218167c4c7a65bfa8605d0c6a369 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:12:15 +0000 Subject: [PATCH 110/244] Update github/codeql-action action to v3.27.5 (#417) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.27.4 | v3.27.5 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 33eacce9..72b8b313 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4 + uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4 + uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 65b93109..1ccd7f5e 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4 + uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 with: sarif_file: results.sarif From 4eca4c40d6df21ab4ff060dac7ca2218320dcba2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:15:01 +0000 Subject: [PATCH 111/244] Update dependency goreleaser/goreleaser to v2.4.8 (#416) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.4.7 | v2.4.8 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d4ddedc..289a2516 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 with: - version: v2.4.7 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.4.8 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 6bc03d18f2b42c9076dc737c09fa19ed4d87b947 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:12:56 +0000 Subject: [PATCH 112/244] Update dependency golangci/golangci-lint to v1.62.2 (#419) | datasource | package | from | to | | ----------- | ---------------------- | ------- | ------- | | github-tags | golangci/golangci-lint | v1.62.0 | v1.62.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .pre-commit-config.yaml | 2 +- Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4ca626fb..e4350fd0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 with: - version: v1.62.0 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v1.62.2 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8758b58e..1e266119 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v1.62.0 + rev: v1.62.2 hooks: - id: golangci-lint-full diff --git a/Makefile b/Makefile index a53ed596..02959b4a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v1.62.0 +GOLANGCI_LINT_VERSION = v1.62.2 test: unit-test test-integration test-integration-no-stream-block clean From b24ebb1754530c4d06cca259a5aac920e2db7b56 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:15:17 +0000 Subject: [PATCH 113/244] Update docker/build-push-action action to v6.10.0 (#420) | datasource | package | from | to | | ----------- | ------------------------ | ------ | ------- | | github-tags | docker/build-push-action | v6.9.0 | v6.10.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 289a2516..836ead50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 - name: Build Plus Docker Image - uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 + uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0 with: file: docker/Dockerfile tags: nginx-plus From f68f570484ee5dbf12a7e5e5c45aa29dc9b7c726 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 20:33:59 +0000 Subject: [PATCH 114/244] Update docker/dockerfile Docker tag to v1.12 (#421) | datasource | package | from | to | | ---------- | ----------------- | ---- | ---- | | docker | docker/dockerfile | 1.11 | 1.12 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 51f54687..edb39864 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.11 +# syntax=docker/dockerfile:1.12 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " From 753539e1f963cfd1c3de7feba5cfcb897a08b9e0 Mon Sep 17 00:00:00 2001 From: Alex Russell <91080557+arussellf5@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:18:00 -0700 Subject: [PATCH 115/244] Client server updates are attempted in full (#422) Client's UpdateHTTPServers and UpdateStreamServers methods now attempt to update all servers and return a combined error Previously these methods would return as soon as an error was encountered. Now they attempt to apply all the server updates and collect all errors encountered along the way. The reasoning behind this is that we want to apply as many of the desired changes as we possibly can and don't want any transitory errors that may affect a single server update to cause all the rest of the updates to be skipped. --- client/nginx.go | 62 ++++++++++----- client/nginx_test.go | 180 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 222 insertions(+), 20 deletions(-) diff --git a/client/nginx.go b/client/nginx.go index 47c2fb3e..4317ad95 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -808,6 +808,7 @@ func (client *NginxClient) DeleteHTTPServer(ctx context.Context, upstream string // Servers that are in the slice, but don't exist in NGINX will be added to NGINX. // Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX. // Servers that are in the slice and exist in NGINX, but have different parameters, will be updated. +// The client will attempt to update all servers, returning all the errors that occurred. func (client *NginxClient) UpdateHTTPServers(ctx context.Context, upstream string, servers []UpstreamServer) (added []UpstreamServer, deleted []UpstreamServer, updated []UpstreamServer, err error) { serversInNginx, err := client.GetHTTPServers(ctx, upstream) if err != nil { @@ -824,27 +825,37 @@ func (client *NginxClient) UpdateHTTPServers(ctx context.Context, upstream strin toAdd, toDelete, toUpdate := determineUpdates(formattedServers, serversInNginx) for _, server := range toAdd { - err := client.AddHTTPServer(ctx, upstream, server) - if err != nil { - return nil, nil, nil, fmt.Errorf("failed to update servers of %v upstream: %w", upstream, err) + addErr := client.AddHTTPServer(ctx, upstream, server) + if addErr != nil { + err = errors.Join(err, addErr) + continue } + added = append(added, server) } for _, server := range toDelete { - err := client.DeleteHTTPServer(ctx, upstream, server.Server) - if err != nil { - return nil, nil, nil, fmt.Errorf("failed to update servers of %v upstream: %w", upstream, err) + deleteErr := client.DeleteHTTPServer(ctx, upstream, server.Server) + if deleteErr != nil { + err = errors.Join(err, deleteErr) + continue } + deleted = append(deleted, server) } for _, server := range toUpdate { - err := client.UpdateHTTPServer(ctx, upstream, server) - if err != nil { - return nil, nil, nil, fmt.Errorf("failed to update servers of %v upstream: %w", upstream, err) + updateErr := client.UpdateHTTPServer(ctx, upstream, server) + if updateErr != nil { + err = errors.Join(err, updateErr) + continue } + updated = append(updated, server) + } + + if err != nil { + err = fmt.Errorf("failed to update servers of %s upstream: %w", upstream, err) } - return toAdd, toDelete, toUpdate, nil + return added, deleted, updated, err } // haveSameParameters checks if a given server has the same parameters as a server already present in NGINX. Order matters. @@ -1108,6 +1119,7 @@ func (client *NginxClient) DeleteStreamServer(ctx context.Context, upstream stri // Servers that are in the slice, but don't exist in NGINX will be added to NGINX. // Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX. // Servers that are in the slice and exist in NGINX, but have different parameters, will be updated. +// The client will attempt to update all servers, returning all the errors that occurred. func (client *NginxClient) UpdateStreamServers(ctx context.Context, upstream string, servers []StreamUpstreamServer) (added []StreamUpstreamServer, deleted []StreamUpstreamServer, updated []StreamUpstreamServer, err error) { serversInNginx, err := client.GetStreamServers(ctx, upstream) if err != nil { @@ -1123,27 +1135,37 @@ func (client *NginxClient) UpdateStreamServers(ctx context.Context, upstream str toAdd, toDelete, toUpdate := determineStreamUpdates(formattedServers, serversInNginx) for _, server := range toAdd { - err := client.AddStreamServer(ctx, upstream, server) - if err != nil { - return nil, nil, nil, fmt.Errorf("failed to update stream servers of %v upstream: %w", upstream, err) + addErr := client.AddStreamServer(ctx, upstream, server) + if addErr != nil { + err = errors.Join(err, addErr) + continue } + added = append(added, server) } for _, server := range toDelete { - err := client.DeleteStreamServer(ctx, upstream, server.Server) - if err != nil { - return nil, nil, nil, fmt.Errorf("failed to update stream servers of %v upstream: %w", upstream, err) + deleteErr := client.DeleteStreamServer(ctx, upstream, server.Server) + if deleteErr != nil { + err = errors.Join(err, deleteErr) + continue } + deleted = append(deleted, server) } for _, server := range toUpdate { - err := client.UpdateStreamServer(ctx, upstream, server) - if err != nil { - return nil, nil, nil, fmt.Errorf("failed to update stream servers of %v upstream: %w", upstream, err) + updateErr := client.UpdateStreamServer(ctx, upstream, server) + if updateErr != nil { + err = errors.Join(err, updateErr) + continue } + updated = append(updated, server) + } + + if err != nil { + err = fmt.Errorf("failed to update stream servers of %s upstream: %w", upstream, err) } - return toAdd, toDelete, toUpdate, nil + return added, deleted, updated, err } func (client *NginxClient) getIDOfStreamServer(ctx context.Context, upstream string, name string) (int, error) { diff --git a/client/nginx_test.go b/client/nginx_test.go index 36cb87cf..920e9c72 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -2,6 +2,7 @@ package client import ( "context" + "encoding/json" "net/http" "net/http/httptest" "reflect" @@ -980,3 +981,182 @@ func TestExtractPlusVersionNegativeCase(t *testing.T) { }) } } + +func TestClientHTTPUpdateServers(t *testing.T) { + t.Parallel() + + responses := []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for AddHTTPServer GET servers for http server + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for AddHTTPServer POST server for http server + { + statusCode: http.StatusInternalServerError, + servers: []UpstreamServer{}, + }, + // response for AddHTTPServer GET servers for https server + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for AddHTTPServer POST server for https server + { + statusCode: http.StatusCreated, + servers: []UpstreamServer{}, + }, + } + + handler := &fakeHandler{ + func(w http.ResponseWriter, _ *http.Request) { + if len(responses) == 0 { + t.Fatal("ran out of responses") + } + + re := responses[0] + responses = responses[1:] + + w.WriteHeader(re.statusCode) + + resp, err := json.Marshal(re.servers) + if err != nil { + t.Fatal(err) + } + _, err = w.Write(resp) + if err != nil { + t.Fatal(err) + } + }, + } + + server := httptest.NewServer(handler) + defer server.Close() + + client, err := NewNginxClient(server.URL, WithHTTPClient(&http.Client{})) + if err != nil { + t.Fatal(err) + } + + httpServer := UpstreamServer{Server: "127.0.0.1:80"} + httpsServer := UpstreamServer{Server: "127.0.0.1:443"} + + // we expect that we will get an error for the 500 error encountered when putting the http server + // but we also expect that we have the https server added + added, _, _, err := client.UpdateHTTPServers(context.TODO(), "fakeUpstream", []UpstreamServer{ + httpServer, + httpsServer, + }) + if err == nil { + t.Fatal("expected to receive an error for 500 response when adding first server") + } + + if len(added) != 1 { + t.Fatalf("expected to get one added server, instead got %d", len(added)) + } + + if !reflect.DeepEqual(httpsServer, added[0]) { + t.Errorf("expected: %v got: %v", httpsServer, added[0]) + } +} + +func TestClientStreamUpdateServers(t *testing.T) { + t.Parallel() + + responses := []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for AddStreamServer GET servers for streamServer1 + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for AddStreamServer POST server for streamServer1 + { + statusCode: http.StatusInternalServerError, + servers: []UpstreamServer{}, + }, + // response for AddStreamServer GET servers for streamServer2 + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for AddStreamServer POST server for streamServer2 + { + statusCode: http.StatusCreated, + servers: []UpstreamServer{}, + }, + } + + handler := &fakeHandler{ + func(w http.ResponseWriter, _ *http.Request) { + if len(responses) == 0 { + t.Fatal("ran out of responses") + } + + re := responses[0] + responses = responses[1:] + + w.WriteHeader(re.statusCode) + + resp, err := json.Marshal(re.servers) + if err != nil { + t.Fatal(err) + } + _, err = w.Write(resp) + if err != nil { + t.Fatal(err) + } + }, + } + + server := httptest.NewServer(handler) + defer server.Close() + + client, err := NewNginxClient(server.URL, WithHTTPClient(&http.Client{})) + if err != nil { + t.Fatal(err) + } + + streamServer1 := StreamUpstreamServer{Server: "127.0.0.1:2000"} + streamServer2 := StreamUpstreamServer{Server: "127.0.0.1:3000"} + + // we expect that we will get an error for the 500 error encountered when putting server1 + // but we also expect that we get the second server added + added, _, _, err := client.UpdateStreamServers(context.TODO(), "fakeUpstream", []StreamUpstreamServer{ + streamServer1, + streamServer2, + }) + if err == nil { + t.Fatal("expected to receive an error for 500 response when adding first server") + } + + if len(added) != 1 { + t.Fatalf("expected to get one added server, instead got %d", len(added)) + } + + if !reflect.DeepEqual(streamServer2, added[0]) { + t.Errorf("expected: %v got: %v", streamServer2, added[0]) + } +} + +type response struct { + servers []UpstreamServer + statusCode int +} + +type fakeHandler struct { + handler func(w http.ResponseWriter, r *http.Request) +} + +func (h *fakeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + h.handler(w, r) +} From e2e4c018492e00671343da9afb9078a6a63aeff6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 31 Dec 2024 18:02:02 -0800 Subject: [PATCH 116/244] Update pre-commit hook DavidAnson/markdownlint-cli2 to v0.17.1 (#425) | datasource | package | from | to | | ----------- | ---------------------------- | ------- | ------- | | github-tags | DavidAnson/markdownlint-cli2 | v0.15.0 | v0.17.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1e266119..c72c111c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: gitleaks - repo: https://github.com/DavidAnson/markdownlint-cli2 - rev: v0.15.0 + rev: v0.17.1 hooks: - id: markdownlint-cli2 From 33bcc933796a623cbf9b0afca30b607697baf6f6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 02:04:27 +0000 Subject: [PATCH 117/244] Update actions/setup-go action to v5.2.0 (#428) | datasource | package | from | to | | ----------- | ---------------- | ------ | ------ | | github-tags | actions/setup-go | v5.1.0 | v5.2.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/lint.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 836ead50..fef30a06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ matrix.go-version }} @@ -100,7 +100,7 @@ jobs: if: ${{ github.event_name == 'push' }} - name: Setup Golang Environment - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: stable if: ${{ github.ref_type == 'tag' }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 72b8b313..8a62b9eb 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,7 +51,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: stable if: matrix.language == 'go' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e4350fd0..b6de7a29 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: stable From 4ff3c45e4ca0bd7109bd0f861f7771a093101473 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 02:19:01 +0000 Subject: [PATCH 118/244] Update github/codeql-action action to v3.28.0 (#423) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.27.5 | v3.28.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8a62b9eb..2e81098c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 + uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 + uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 1ccd7f5e..663d8f7a 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 + uses: github/codeql-action/upload-sarif@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 with: sarif_file: results.sarif From 17254b3ece2e0b1527ecceeb1bc9a4f5c084817f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 02:24:56 +0000 Subject: [PATCH 119/244] Update actions/upload-artifact action to v4.5.0 (#431) | datasource | package | from | to | | ----------- | ----------------------- | ------ | ------ | | github-tags | actions/upload-artifact | v4.4.3 | v4.5.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 663d8f7a..98ce1f83 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -49,7 +49,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: SARIF file path: results.sarif From b56d0477584e523c32b251d4d26952046053e3d5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 04:01:46 +0000 Subject: [PATCH 120/244] Update docker/setup-buildx-action action to v3.8.0 (#430) | datasource | package | from | to | | ----------- | -------------------------- | ------ | ------ | | github-tags | docker/setup-buildx-action | v3.7.1 | v3.8.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fef30a06..11551445 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: sed -i 's|\${NGINX_PLUS_VERSION}/||g' docker/Dockerfile - name: Set up Docker Buildx - uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 + uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 - name: Build Plus Docker Image uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0 From 3c2288b5207aabae27cd89d17f827c3aad6a3990 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 07:27:46 +0000 Subject: [PATCH 121/244] Update dependency goreleaser/goreleaser to v2.5.0 (#429) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.4.8 | v2.5.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11551445..b9745739 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 with: - version: v2.4.8 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.5.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From fe7e938dc67441859e525595f13bde64dffffda6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 09:23:04 +0000 Subject: [PATCH 122/244] Update module golang.org/x/sync to v0.10.0 (#424) | datasource | package | from | to | | ---------- | ----------------- | ------ | ------- | | go | golang.org/x/sync | v0.9.0 | v0.10.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e4619f01..ca1fc76f 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/nginxinc/nginx-plus-go-client/v2 go 1.22.6 -require golang.org/x/sync v0.9.0 +require golang.org/x/sync v0.10.0 diff --git a/go.sum b/go.sum index fc7734dc..cf16d914 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= -golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= From a5069040d83f713c1140a0806be551f664f6b988 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 13:00:19 +0000 Subject: [PATCH 123/244] Update pre-commit hook gitleaks/gitleaks to v8.22.1 (#432) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.21.2 | v8.22.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c72c111c..27d635f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.21.2 + rev: v8.22.1 hooks: - id: gitleaks From de1625880eafdc2287930b33600b9c7e6b17680f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 15:17:04 +0000 Subject: [PATCH 124/244] Update reviewdog/action-actionlint action to v1.61.0 (#426) | datasource | package | from | to | | ----------- | --------------------------- | ------- | ------- | | github-tags | reviewdog/action-actionlint | v1.57.0 | v1.61.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b6de7a29..c8519de8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Actions - uses: reviewdog/action-actionlint@7eeec1dd160c2301eb28e1568721837d084558ad # v1.57.0 + uses: reviewdog/action-actionlint@534eb894142bcf31616e5436cbe4214641c58101 # v1.61.0 with: actionlint_flags: -shellcheck "" From c2f0bf4671af02667984aed3d082930aa5b34bc2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 19:57:43 +0000 Subject: [PATCH 125/244] Update reviewdog/action-yamllint action to v1.20.0 (#427) | datasource | package | from | to | | ----------- | ------------------------- | ------- | ------- | | github-tags | reviewdog/action-yamllint | v1.19.0 | v1.20.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c8519de8..b5cabf7c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -70,4 +70,4 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint YAML - uses: reviewdog/action-yamllint@e09f07780388032a624e9eb44a23fd1bbb4052cc # v1.19.0 + uses: reviewdog/action-yamllint@1dca3ad811867be18fbe293a9818d715a6c2cd46 # v1.20.0 From 7e75c8734affc3455293fcad789feb2d989a6ff9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:04:26 +0000 Subject: [PATCH 126/244] Update dependency goreleaser/goreleaser to v2.5.1 (#433) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.5.0 | v2.5.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9745739..fbf3903e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 with: - version: v2.5.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.5.1 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 64c2407072883e4f4d6c6887f3e13b7279d49e61 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:06:43 +0000 Subject: [PATCH 127/244] Update dependency golangci/golangci-lint to v1.63.4 (#434) | datasource | package | from | to | | ----------- | ---------------------- | ------- | ------- | | github-tags | golangci/golangci-lint | v1.62.2 | v1.63.4 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .pre-commit-config.yaml | 2 +- Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b5cabf7c..1a12e095 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 with: - version: v1.62.2 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v1.63.4 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27d635f1..524320f5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v1.62.2 + rev: v1.63.4 hooks: - id: golangci-lint-full diff --git a/Makefile b/Makefile index 02959b4a..87974328 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v1.62.2 +GOLANGCI_LINT_VERSION = v1.63.4 test: unit-test test-integration test-integration-no-stream-block clean From debf91551fd1f3802313f13ebac4722df47c7faf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:09:09 +0000 Subject: [PATCH 128/244] Update reviewdog/action-actionlint action to v1.62.0 (#435) | datasource | package | from | to | | ----------- | --------------------------- | ------- | ------- | | github-tags | reviewdog/action-actionlint | v1.61.0 | v1.62.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1a12e095..3aac1023 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Actions - uses: reviewdog/action-actionlint@534eb894142bcf31616e5436cbe4214641c58101 # v1.61.0 + uses: reviewdog/action-actionlint@af17f9e3640ac863dbcc515d45f5f35d708d0faf # v1.62.0 with: actionlint_flags: -shellcheck "" From 33a6e6ebde7dca4b2064a5679441369edc2d957b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:14:51 +0000 Subject: [PATCH 129/244] Update DavidAnson/markdownlint-cli2-action action to v19 (#436) | datasource | package | from | to | | ----------- | ----------------------------------- | ------- | ------- | | github-tags | DavidAnson/markdownlint-cli2-action | v18.0.0 | v19.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3aac1023..a3f72425 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -57,7 +57,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Markdown - uses: DavidAnson/markdownlint-cli2-action@eb5ca3ab411449c66620fe7f1b3c9e10547144b0 # v18.0.0 + uses: DavidAnson/markdownlint-cli2-action@a23dae216ce3fee4db69da41fed90d2a4af801cf # v19.0.0 with: config: .markdownlint-cli2.yaml globs: "**/*.md" From d2914b654a9030f252cb9c44b0c04e8006d055e1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:43:38 -0800 Subject: [PATCH 130/244] Update docker/build-push-action action to v6.11.0 (#439) | datasource | package | from | to | | ----------- | ------------------------ | ------- | ------- | | github-tags | docker/build-push-action | v6.10.0 | v6.11.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbf3903e..2929480b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 - name: Build Plus Docker Image - uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0 + uses: docker/build-push-action@b32b51a8eda65d6793cd0494a773d4f6bcef32dc # v6.11.0 with: file: docker/Dockerfile tags: nginx-plus From 41092ac700367ac55d756b3a8286e1a0eb4f32f3 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Thu, 9 Jan 2025 00:54:16 -0800 Subject: [PATCH 131/244] Update from nginxinc to nginx (#437) --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/dependency-review.yml | 2 +- .github/workflows/labeler.yml | 2 +- CHANGELOG.md | 36 ++++++++++++------------- CODEOWNERS | 2 +- CONTRIBUTING.md | 4 +-- README.md | 30 ++++++++++----------- compose.yaml | 4 +-- go.mod | 2 +- release-process.md | 16 +++++------ renovate.json | 2 +- tests/client_no_stream_test.go | 4 +-- tests/client_test.go | 4 +-- 13 files changed, 55 insertions(+), 55 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index b9c0f981..193ee8c6 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -7,7 +7,7 @@ that issue here in this description (not in the title of the PR). Before creating a PR, run through this checklist and mark each as complete. -- [ ] I have read the [CONTRIBUTING](https://github.com/nginxinc/nginx-plus-go-client/blob/main/CONTRIBUTING.md) doc +- [ ] I have read the [CONTRIBUTING](https://github.com/nginx/nginx-plus-go-client/blob/main/CONTRIBUTING.md) doc - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have checked that all unit tests pass after adding my changes - [ ] I have updated necessary documentation diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 93ee2b05..d1be1aff 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -29,4 +29,4 @@ jobs: - name: Dependency Review uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0 with: - config-file: "nginxinc/k8s-common/dependency-review-config.yml@main" + config-file: "nginx/k8s-common/dependency-review-config.yml@main" diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 443756d6..7d9e31de 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -17,7 +17,7 @@ jobs: sparse-checkout: | labeler.yml sparse-checkout-cone-mode: false - repository: nginxinc/k8s-common + repository: nginx/k8s-common - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index bfd9115d..88c57ba1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,14 @@ # Changelog -Starting with version 0.8.0, an automatically generated list of changes can be found on the [GitHub Releases page](https://github.com/nginxinc/nginx-plus-go-client/releases). +Starting with version 0.8.0, an automatically generated list of changes can be found on the [GitHub Releases page](https://github.com/nginx/nginx-plus-go-client/releases). ## 0.7.0 (Jul 10, 2020) FEATURES: -- [38](https://github.com/nginxinc/nginx-plus-go-client/pull/38): *Support for /slabs API endpoint*. The client now +- [38](https://github.com/nginx/nginx-plus-go-client/pull/38): _Support for /slabs API endpoint_. The client now supports retrieving shared memory zone usage info. -- [41](https://github.com/nginxinc/nginx-plus-go-client/pull/41): *Support for /processes API endpoint*. The client now +- [41](https://github.com/nginx/nginx-plus-go-client/pull/41): _Support for /processes API endpoint_. The client now supports retrieving processes info. CHANGES: @@ -20,7 +20,7 @@ CHANGES: FEATURES: -- [34](https://github.com/nginxinc/nginx-plus-go-client/pull/34): *Support for updating upstream servers parameters*. +- [34](https://github.com/nginx/nginx-plus-go-client/pull/34): _Support for updating upstream servers parameters_. The client now supports updating upstream parameters of servers that already exist in NGINX Plus. CHANGES: @@ -35,14 +35,14 @@ CHANGES: FEATURES: -- [30](https://github.com/nginxinc/nginx-plus-go-client/pull/30): *Support additional upstream server parameters*. The -client now supports configuring `route`, `backup`, `down`, `drain`, `weight` and `service` parameters for http -upstreams and `backup`, `down`, `weight` and `service` parameters for stream upstreams. -- [31](https://github.com/nginxinc/nginx-plus-go-client/pull/31): *Support location zones and resolver metrics*. +- [30](https://github.com/nginx/nginx-plus-go-client/pull/30): _Support additional upstream server parameters_. The + client now supports configuring `route`, `backup`, `down`, `drain`, `weight` and `service` parameters for http + upstreams and `backup`, `down`, `weight` and `service` parameters for stream upstreams. +- [31](https://github.com/nginx/nginx-plus-go-client/pull/31): _Support location zones and resolver metrics_. FIXES: -- [29](https://github.com/nginxinc/nginx-plus-go-client/pull/29): *Fix max_fails parameter in upstream servers*. +- [29](https://github.com/nginx/nginx-plus-go-client/pull/29): _Fix max_fails parameter in upstream servers_. Previously, if the MaxFails field was not explicitly set, the client would incorrectly configure an upstream with the value `0` instead of the correct value `1`. @@ -55,36 +55,36 @@ CHANGES: FEATURES: -- [24](https://github.com/nginxinc/nginx-plus-go-client/pull/24): *Support `MaxConns` in upstream servers*. +- [24](https://github.com/nginx/nginx-plus-go-client/pull/24): _Support `MaxConns` in upstream servers_. FIXES: -- [25](https://github.com/nginxinc/nginx-plus-go-client/pull/25): *Fix session metrics for stream server zones*. Session +- [25](https://github.com/nginx/nginx-plus-go-client/pull/25): _Fix session metrics for stream server zones_. Session metrics with a status of `4xx` or `5xx` are now correctly reported. Previously they were always reported as `0`. ## 0.3.1 (June 10, 2019) CHANGES: -- [22](https://github.com/nginxinc/nginx-plus-go-client/pull/22): *Change in stream zone sync metrics*. `StreamZoneSync` +- [22](https://github.com/nginx/nginx-plus-go-client/pull/22): _Change in stream zone sync metrics_. `StreamZoneSync` field of the `Stats` type is now a pointer. It will be nil if NGINX Plus doesn't report any zone sync stats. ## 0.3 (May 29, 2019) FEATURES: -- [20](https://github.com/nginxinc/nginx-plus-go-client/pull/20): *Support for stream zone sync metrics*. The client +- [20](https://github.com/nginx/nginx-plus-go-client/pull/20): _Support for stream zone sync metrics_. The client `GetStats` method now additionally returns stream zone sync metrics. -- [13](https://github.com/nginxinc/nginx-plus-go-client/pull/13): *Support for key-value endpoints*. The client +- [13](https://github.com/nginx/nginx-plus-go-client/pull/13): _Support for key-value endpoints_. The client implements a set of methods to create/modify/delete key-val pairs for both http and stream contexts. -- [12](https://github.com/nginxinc/nginx-plus-go-client/pull/12) *Support for NGINX status info*. The client `GetStats` +- [12](https://github.com/nginx/nginx-plus-go-client/pull/12) _Support for NGINX status info_. The client `GetStats` method now additionally returns NGINX status metrics. Thanks to [jthurman42](https://github.com/jthurman42). CHANGES: - The repository was renamed to `nginx-plus-go-client` instead of `nginx-plus-go-sdk`. If the client is used as a dependency, this name needs to be changed in the import section (`import - "github.com/nginxinc/nginx-plus-go-client/client"`). +"github.com/nginxinc/nginx-plus-go-client/client"`). - The version of the API was changed to 4. - The version of NGINX Plus for e2e testing was changed to R18. @@ -92,8 +92,8 @@ CHANGES: FEATURES: -- [7](https://github.com/nginxinc/nginx-plus-go-sdk/pull/7): *Support for stream server zone and stream upstream - metrics*. The client `GetStats` method now additionally returns stream server zone and stream upstream metrics. +- [7](https://github.com/nginx/nginx-plus-go-client/pull/7): _Support for stream server zone and stream upstream + metrics_. The client `GetStats` method now additionally returns stream server zone and stream upstream metrics. CHANGES: diff --git a/CODEOWNERS b/CODEOWNERS index 77ed024e..47d9e595 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -* @nginxinc/integrations +* @nginx/integrations diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ce4f0c67..2d617150 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ considering contributing! ## Ask a Question -To ask a question please use [Github Discussions](https://github.com/nginxinc/nginx-plus-go-client/discussions). +To ask a question please use [Github Discussions](https://github.com/nginx/nginx-plus-go-client/discussions). You can also join our [Community Slack](https://community.nginx.org/joinslack) which has a wider NGINX audience. @@ -90,6 +90,6 @@ can be merged. Your agreement signature will be safely stored by F5 and no longe - Run `gofmt` over your code to automatically resolve a lot of style issues. Most editors support this running automatically when saving a code file. - Run `go lint` and `go vet` on your code too to catch any other issues. -- Follow this guide on some good practice and idioms for Go - +- Follow this guide on some good practice and idioms for Go - - To check for extra issues, install [golangci-lint](https://github.com/golangci/golangci-lint) and run `make lint` or `golangci-lint run` diff --git a/README.md b/README.md index 7101e710..06e78ded 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -[![OpenSSFScorecard](https://api.securityscorecards.dev/projects/github.com/nginxinc/nginx-plus-go-client/badge)](https://scorecard.dev/viewer/?uri=github.com/nginxinc/nginx-plus-go-client) -[![Continuous Integration](https://github.com/nginxinc/nginx-plus-go-client/workflows/Continuous%20Integration/badge.svg)](https://github.com/nginxinc/nginx-plus-go-client/actions) +[![OpenSSFScorecard](https://api.securityscorecards.dev/projects/github.com/nginx/nginx-plus-go-client/badge)](https://scorecard.dev/viewer/?uri=github.com/nginx/nginx-plus-go-client) +[![Continuous Integration](https://github.com/nginx/nginx-plus-go-client/workflows/Continuous%20Integration/badge.svg)](https://github.com/nginx/nginx-plus-go-client/actions) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -[![Go Report Card](https://goreportcard.com/badge/github.com/nginxinc/nginx-plus-go-client)](https://goreportcard.com/report/github.com/nginxinc/nginx-plus-go-client) -[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B5618%2Fgithub.com%2Fnginxinc%2Fnginx-plus-go-client.svg?type=shield)](https://app.fossa.com/projects/custom%2B5618%2Fgithub.com%2Fnginxinc%2Fnginx-plus-go-client?ref=badge_shield) -[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/nginxinc/nginx-plus-go-client?logo=github&sort=semver)](https://github.com/nginxinc/nginx-plus-go-client/releases/latest) -![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/nginxinc/nginx-plus-go-client?logo=go) +[![Go Report Card](https://goreportcard.com/badge/github.com/nginx/nginx-plus-go-client)](https://goreportcard.com/report/github.com/nginx/nginx-plus-go-client) +[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B5618%2Fgithub.com%2Fnginx%2Fnginx-plus-go-client.svg?type=shield)](https://app.fossa.com/projects/custom%2B5618%2Fgithub.com%2Fnginx%2Fnginx-plus-go-client?ref=badge_shield) +[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/nginx/nginx-plus-go-client?logo=github&sort=semver)](https://github.com/nginx/nginx-plus-go-client/releases/latest) +![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/nginx/nginx-plus-go-client?logo=go) [![Slack](https://img.shields.io/badge/slack-nginxcommunity-green?logo=slack)](https://nginxcommunity.slack.com) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) -[![Community Support](https://badgen.net/badge/support/community/cyan?icon=awesome)](https://github.com/nginxinc/nginx-plus-go-client/blob/main/SECURITY.md) +[![Community Support](https://badgen.net/badge/support/community/cyan?icon=awesome)](https://github.com/nginx/nginx-plus-go-client/blob/main/SECURITY.md) # NGINX Plus Go Client @@ -41,17 +41,17 @@ This Client works against versions 4 to 9 of the NGINX Plus API. The table below the API was first introduced. | API version | NGINX Plus version | -|-------------|--------------------| -| 4 | R18 | -| 5 | R19 | -| 6 | R20 | -| 7 | R25 | -| 8 | R27 | -| 9 | R30 | +| ----------- | ------------------ | +| 4 | R18 | +| 5 | R19 | +| 6 | R20 | +| 7 | R25 | +| 8 | R27 | +| 9 | R30 | ## Using the Client -1. Import `github.com/nginxinc/nginx-plus-go-client/client` into your go project. +1. Import `github.com/nginx/nginx-plus-go-client/client` into your go project. 2. Use your favorite vendor tool to add this to your `/vendor` directory in your project. ## Testing diff --git a/compose.yaml b/compose.yaml index 153ffc90..d1b0433c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -33,8 +33,8 @@ services: volumes: - type: bind source: ./ - target: /go/src/github.com/nginxinc/nginx-plus-go-client - working_dir: /go/src/github.com/nginxinc/nginx-plus-go-client + target: /go/src/github.com/nginx/nginx-plus-go-client + working_dir: /go/src/github.com/nginx/nginx-plus-go-client command: go test -v -shuffle=on -race tests/client_test.go depends_on: - nginx diff --git a/go.mod b/go.mod index ca1fc76f..a94427da 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/nginxinc/nginx-plus-go-client/v2 +module github.com/nginx/nginx-plus-go-client/v2 go 1.22.6 diff --git a/release-process.md b/release-process.md index e3bc9b53..bdb41cc4 100644 --- a/release-process.md +++ b/release-process.md @@ -19,7 +19,7 @@ The project follows [Semantic Versioning](https://semver.org/) for versioning. ## Release Planning and Development The features that will go into the next release are reflected in the -corresponding [milestone](https://github.com/nginxinc/nginx-plus-go-client/milestones). Refer to +corresponding [milestone](https://github.com/nginx/nginx-plus-go-client/milestones). Refer to the [Issue Lifecycle](/ISSUE_LIFECYCLE.md) document for information on issue creation and assignment to releases. ## Releasing a New Version @@ -27,13 +27,13 @@ the [Issue Lifecycle](/ISSUE_LIFECYCLE.md) document for information on issue cre 1. Create an issue to define and track release-related activities. Choose a title that follows the format `Release X.Y.Z`. 2. Stop merging any new work into the main branch. -3. Check the release draft under the [GitHub releases](https://github.com/nginxinc/nginx-plus-go-client/releases) page -to ensure that everything is in order. +3. Check the release draft under the [GitHub releases](https://github.com/nginx/nginx-plus-go-client/releases) page + to ensure that everything is in order. 4. Create and push the release tag in the format `vX.Y.Z`: - ```bash - git tag -a vX.Y.Z -m "Release vX.Y.Z" - git push origin vX.Y.Z - ``` + ```bash + git tag -a vX.Y.Z -m "Release vX.Y.Z" + git push origin vX.Y.Z + ``` - As a result, the CI/CD pipeline will publish the release and announce it in the community Slack. + As a result, the CI/CD pipeline will publish the release and announce it in the community Slack. diff --git a/renovate.json b/renovate.json index 8bf65f91..891b5869 100644 --- a/renovate.json +++ b/renovate.json @@ -1,7 +1,7 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ - "github>nginxinc/k8s-common", + "github>nginx/k8s-common", "schedule:earlyMondays" ] } diff --git a/tests/client_no_stream_test.go b/tests/client_no_stream_test.go index 2ec1da93..2e85fea5 100644 --- a/tests/client_no_stream_test.go +++ b/tests/client_no_stream_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "github.com/nginxinc/nginx-plus-go-client/v2/client" - "github.com/nginxinc/nginx-plus-go-client/v2/tests/helpers" + "github.com/nginx/nginx-plus-go-client/v2/client" + "github.com/nginx/nginx-plus-go-client/v2/tests/helpers" ) // TestStatsNoStream tests the peculiar behavior of getting Stream-related diff --git a/tests/client_test.go b/tests/client_test.go index 1217f5ad..4f1fe6fa 100644 --- a/tests/client_test.go +++ b/tests/client_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/nginxinc/nginx-plus-go-client/v2/client" - "github.com/nginxinc/nginx-plus-go-client/v2/tests/helpers" + "github.com/nginx/nginx-plus-go-client/v2/client" + "github.com/nginx/nginx-plus-go-client/v2/tests/helpers" ) const ( From 738c8ab5ff502198107d9bf789a8462e9618b797 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 09:23:43 +0000 Subject: [PATCH 132/244] Update github/codeql-action action to v3.28.1 (#440) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.28.0 | v3.28.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2e81098c..76f37fc6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 + uses: github/codeql-action/init@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 + uses: github/codeql-action/analyze@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 98ce1f83..5739b132 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 + uses: github/codeql-action/upload-sarif@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1 with: sarif_file: results.sarif From 416456ce547ce5b67b8bc29ee22a6dd97a0415a8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 09:26:04 +0000 Subject: [PATCH 133/244] Update golangci/golangci-lint-action action to v6.2.0 (#446) | datasource | package | from | to | | ----------- | ----------------------------- | ------ | ------ | | github-tags | golangci/golangci-lint-action | v6.1.1 | v6.2.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a3f72425..d4a136f2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,7 +33,7 @@ jobs: go-version: stable - name: Lint Go - uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 + uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0 with: version: v1.63.4 # renovate: datasource=github-tags depName=golangci/golangci-lint From ae00de4546d48b8ca0752eefefad791842524c72 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 09:56:59 +0000 Subject: [PATCH 134/244] Update pre-commit hook DavidAnson/markdownlint-cli2 to v0.17.2 (#443) | datasource | package | from | to | | ----------- | ---------------------------- | ------- | ------- | | github-tags | DavidAnson/markdownlint-cli2 | v0.17.1 | v0.17.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 524320f5..65b130b4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: gitleaks - repo: https://github.com/DavidAnson/markdownlint-cli2 - rev: v0.17.1 + rev: v0.17.2 hooks: - id: markdownlint-cli2 From c83a9205d8117ad9d9eb6feff14abb775f7c130c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 10:03:14 +0000 Subject: [PATCH 135/244] Update DavidAnson/markdownlint-cli2-action action to v19.1.0 (#444) | datasource | package | from | to | | ----------- | ----------------------------------- | ------- | ------- | | github-tags | DavidAnson/markdownlint-cli2-action | v19.0.0 | v19.1.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d4a136f2..e80f77d9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -57,7 +57,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Markdown - uses: DavidAnson/markdownlint-cli2-action@a23dae216ce3fee4db69da41fed90d2a4af801cf # v19.0.0 + uses: DavidAnson/markdownlint-cli2-action@05f32210e84442804257b2a6f20b273450ec8265 # v19.1.0 with: config: .markdownlint-cli2.yaml globs: "**/*.md" From 5d978777d461eac11bf49dfed5cf8d011d6f1333 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 10:06:05 +0000 Subject: [PATCH 136/244] Update actions/upload-artifact action to v4.6.0 (#441) | datasource | package | from | to | | ----------- | ----------------------- | ------ | ------ | | github-tags | actions/upload-artifact | v4.5.0 | v4.6.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 5739b132..e1ce209c 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -49,7 +49,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 with: name: SARIF file path: results.sarif From 90baa523d11afb16bceecab0a206d89643357ea1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 10:10:17 +0000 Subject: [PATCH 137/244] Update docker/build-push-action action to v6.12.0 (#445) | datasource | package | from | to | | ----------- | ------------------------ | ------- | ------- | | github-tags | docker/build-push-action | v6.11.0 | v6.12.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2929480b..2ca8fca4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 - name: Build Plus Docker Image - uses: docker/build-push-action@b32b51a8eda65d6793cd0494a773d4f6bcef32dc # v6.11.0 + uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0 with: file: docker/Dockerfile tags: nginx-plus From 37c33c6aac7eff0311fdece2a60b5e8d2f34dc3e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 10:21:48 +0000 Subject: [PATCH 138/244] Update pre-commit hook gitleaks/gitleaks to v8.23.1 (#447) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.22.1 | v8.23.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 65b130b4..5f852dc0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.22.1 + rev: v8.23.1 hooks: - id: gitleaks From dbb68700987a40eafe6392f2137e723171264ebc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 11:57:34 +0000 Subject: [PATCH 139/244] Update reviewdog/action-actionlint action to v1.63.0 (#442) | datasource | package | from | to | | ----------- | --------------------------- | ------- | ------- | | github-tags | reviewdog/action-actionlint | v1.62.0 | v1.63.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e80f77d9..85371af7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Actions - uses: reviewdog/action-actionlint@af17f9e3640ac863dbcc515d45f5f35d708d0faf # v1.62.0 + uses: reviewdog/action-actionlint@f3dcc52bc6039e5d736486952379dce3e869e8a2 # v1.63.0 with: actionlint_flags: -shellcheck "" From db6f4e76a055fb453b1641371fac496749c88d77 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:58:33 +0000 Subject: [PATCH 140/244] Update fossas/fossa-action action to v1.5.0 (#456) | datasource | package | from | to | | ----------- | ------------------- | ------ | ------ | | github-tags | fossas/fossa-action | v1.4.0 | v1.5.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/fossa.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index 20a37ff1..ce730445 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -24,6 +24,6 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Scan - uses: fossas/fossa-action@09bcf127dc0ccb4b5a023f6f906728878e8610ba # v1.4.0 + uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0 with: api-key: ${{ secrets.FOSSA_TOKEN }} From ddc361e6fa5cf7772229b58afb0998b1b731e77d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:00:55 +0000 Subject: [PATCH 141/244] Update github/codeql-action action to v3.28.5 (#449) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.28.1 | v3.28.5 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 76f37fc6..7875db4a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1 + uses: github/codeql-action/init@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1 + uses: github/codeql-action/analyze@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index e1ce209c..1c9cc615 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1 + uses: github/codeql-action/upload-sarif@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5 with: sarif_file: results.sarif From 23ab3bd503f52ec4524256dbad60e72a5b24db49 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:05:08 +0000 Subject: [PATCH 142/244] Update pre-commit hook gitleaks/gitleaks to v8.23.2 (#450) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.23.1 | v8.23.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5f852dc0..6c0f8156 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.23.1 + rev: v8.23.2 hooks: - id: gitleaks From 2d0dab023d8abdfc72cb3096b7fdcd583a3898d9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:10:07 +0000 Subject: [PATCH 143/244] Update actions/setup-go action to v5.3.0 (#451) | datasource | package | from | to | | ----------- | ---------------- | ------ | ------ | | github-tags | actions/setup-go | v5.2.0 | v5.3.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/lint.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ca8fca4..80a42f99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: go-version: ${{ matrix.go-version }} @@ -100,7 +100,7 @@ jobs: if: ${{ github.event_name == 'push' }} - name: Setup Golang Environment - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: go-version: stable if: ${{ github.ref_type == 'tag' }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7875db4a..04a681cb 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,7 +51,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: go-version: stable if: matrix.language == 'go' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 85371af7..970f2bcb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: go-version: stable From fd3511d6849b74317ecda48d6afc2e93136e72cb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:20:05 +0000 Subject: [PATCH 144/244] Update actions/stale action to v9.1.0 (#452) | datasource | package | from | to | | ----------- | ------------- | ------ | ------ | | github-tags | actions/stale | v9.0.0 | v9.1.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index d63ccc29..3f3b6b90 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,7 +13,7 @@ jobs: pull-requests: write # for actions/stale to close stale PRs runs-on: ubuntu-24.04 steps: - - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 + - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: "This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days." From b7807e896b7c9a8362dfeed97c41397a33dd9a9d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:29:01 +0000 Subject: [PATCH 145/244] Update dependency goreleaser/goreleaser to v2.6.1 (#453) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.5.1 | v2.6.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80a42f99..e074ce93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 with: - version: v2.5.1 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.6.1 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 86d2cd2ef429a1a9196fa36bfaa672385077c315 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:37:29 +0000 Subject: [PATCH 146/244] Update docker/build-push-action action to v6.13.0 (#454) | datasource | package | from | to | | ----------- | ------------------------ | ------- | ------- | | github-tags | docker/build-push-action | v6.12.0 | v6.13.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e074ce93..feb5a906 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 - name: Build Plus Docker Image - uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0 + uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0 with: file: docker/Dockerfile tags: nginx-plus From 0ac5b8e9ac6f0bca6704156da6834063b43f5b49 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:57:03 +0000 Subject: [PATCH 147/244] Update reviewdog/action-actionlint action to v1.64.1 (#457) | datasource | package | from | to | | ----------- | --------------------------- | ------- | ------- | | github-tags | reviewdog/action-actionlint | v1.63.0 | v1.64.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 970f2bcb..111e99f6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Actions - uses: reviewdog/action-actionlint@f3dcc52bc6039e5d736486952379dce3e869e8a2 # v1.63.0 + uses: reviewdog/action-actionlint@abd537417cf4991e1ba8e21a67b1119f4f53b8e0 # v1.64.1 with: actionlint_flags: -shellcheck "" From 15b12a8deeec311e36f6bac17a5e3aa94d45dbf5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 12:04:41 +0000 Subject: [PATCH 148/244] Update docker/dockerfile Docker tag to v1.13 (#455) | datasource | package | from | to | | ---------- | ----------------- | ---- | ---- | | docker | docker/dockerfile | 1.12 | 1.13 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index edb39864..dd321a34 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.12 +# syntax=docker/dockerfile:1.13 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " From ffec1a5dac2932243a30b2eda912caa3c38865e8 Mon Sep 17 00:00:00 2001 From: dylan-way <36932226+dylan-way@users.noreply.github.com> Date: Tue, 28 Jan 2025 10:24:37 -0700 Subject: [PATCH 149/244] Update servers improvements (#448) * Add Content-Type header to NGINX client PATCH requests * Update to reduce unnecessary API calls and sanitize input Update UpdateHTTPServers and UpdateStreamServers: - No longer make extra GET requests for each PUT and DELETE request. - Removes identical duplicate servers. - Returns errors for duplicate servers with different parameters. --- client/nginx.go | 207 ++++++++++++---- client/nginx_test.go | 550 +++++++++++++++++++++++++++++++++---------- tests/client_test.go | 70 +++++- 3 files changed, 643 insertions(+), 184 deletions(-) diff --git a/client/nginx.go b/client/nginx.go index 4317ad95..4a44d98c 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -48,6 +48,7 @@ var ( ErrServerExists = errors.New("server already exists") ErrNotSupported = errors.New("not supported") ErrInvalidTimeout = errors.New("invalid timeout") + ErrParameterMismatch = errors.New("encountered duplicate server with different parameters") ErrPlusVersionNotFound = errors.New("plus version not found in the input string") ) @@ -775,9 +776,13 @@ func (client *NginxClient) AddHTTPServer(ctx context.Context, upstream string, s if id != -1 { return fmt.Errorf("failed to add %v server to %v upstream: %w", server.Server, upstream, ErrServerExists) } + err = client.addHTTPServer(ctx, upstream, server) + return err +} +func (client *NginxClient) addHTTPServer(ctx context.Context, upstream string, server UpstreamServer) error { path := fmt.Sprintf("http/upstreams/%v/servers/", upstream) - err = client.post(ctx, path, &server) + err := client.post(ctx, path, &server) if err != nil { return fmt.Errorf("failed to add %v server to %v upstream: %w", server.Server, upstream, err) } @@ -794,9 +799,13 @@ func (client *NginxClient) DeleteHTTPServer(ctx context.Context, upstream string if id == -1 { return fmt.Errorf("failed to remove %v server from %v upstream: %w", server, upstream, ErrServerNotFound) } + err = client.deleteHTTPServer(ctx, upstream, server, id) + return err +} - path := fmt.Sprintf("http/upstreams/%v/servers/%v", upstream, id) - err = client.delete(ctx, path, http.StatusOK) +func (client *NginxClient) deleteHTTPServer(ctx context.Context, upstream, server string, serverID int) error { + path := fmt.Sprintf("http/upstreams/%v/servers/%v", upstream, serverID) + err := client.delete(ctx, path, http.StatusOK) if err != nil { return fmt.Errorf("failed to remove %v server from %v upstream: %w", server, upstream, err) } @@ -809,6 +818,8 @@ func (client *NginxClient) DeleteHTTPServer(ctx context.Context, upstream string // Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX. // Servers that are in the slice and exist in NGINX, but have different parameters, will be updated. // The client will attempt to update all servers, returning all the errors that occurred. +// If there are duplicate servers with equivalent parameters, the duplicates will be ignored. +// If there are duplicate servers with different parameters, those server entries will be ignored and an error returned. func (client *NginxClient) UpdateHTTPServers(ctx context.Context, upstream string, servers []UpstreamServer) (added []UpstreamServer, deleted []UpstreamServer, updated []UpstreamServer, err error) { serversInNginx, err := client.GetHTTPServers(ctx, upstream) if err != nil { @@ -822,10 +833,12 @@ func (client *NginxClient) UpdateHTTPServers(ctx context.Context, upstream strin formattedServers = append(formattedServers, server) } + formattedServers, err = deduplicateServers(upstream, formattedServers) + toAdd, toDelete, toUpdate := determineUpdates(formattedServers, serversInNginx) for _, server := range toAdd { - addErr := client.AddHTTPServer(ctx, upstream, server) + addErr := client.addHTTPServer(ctx, upstream, server) if addErr != nil { err = errors.Join(err, addErr) continue @@ -834,7 +847,7 @@ func (client *NginxClient) UpdateHTTPServers(ctx context.Context, upstream strin } for _, server := range toDelete { - deleteErr := client.DeleteHTTPServer(ctx, upstream, server.Server) + deleteErr := client.deleteHTTPServer(ctx, upstream, server.Server, server.ID) if deleteErr != nil { err = errors.Join(err, deleteErr) continue @@ -858,46 +871,82 @@ func (client *NginxClient) UpdateHTTPServers(ctx context.Context, upstream strin return added, deleted, updated, err } -// haveSameParameters checks if a given server has the same parameters as a server already present in NGINX. Order matters. -func haveSameParameters(newServer UpstreamServer, serverNGX UpstreamServer) bool { - newServer.ID = serverNGX.ID +func deduplicateServers(upstream string, servers []UpstreamServer) ([]UpstreamServer, error) { + type serverCheck struct { + server UpstreamServer + valid bool + } - if serverNGX.MaxConns != nil && newServer.MaxConns == nil { - newServer.MaxConns = &defaultMaxConns + serverMap := make(map[string]*serverCheck, len(servers)) + var err error + for _, server := range servers { + if prev, ok := serverMap[server.Server]; ok { + if !prev.valid { + continue + } + if !server.hasSameParametersAs(prev.server) { + prev.valid = false + err = errors.Join(err, fmt.Errorf( + "failed to update %s server to %s upstream: %w", + server.Server, upstream, ErrParameterMismatch)) + } + continue + } + serverMap[server.Server] = &serverCheck{server, true} } + retServers := make([]UpstreamServer, 0, len(serverMap)) + for _, server := range servers { + if check, ok := serverMap[server.Server]; ok && check.valid { + retServers = append(retServers, server) + delete(serverMap, server.Server) + } + } + return retServers, err +} - if serverNGX.MaxFails != nil && newServer.MaxFails == nil { - newServer.MaxFails = &defaultMaxFails +// hasSameParametersAs checks if a given server has the same parameters. +func (s UpstreamServer) hasSameParametersAs(compareServer UpstreamServer) bool { + s.ID = compareServer.ID + s.applyDefaults() + compareServer.applyDefaults() + return reflect.DeepEqual(s, compareServer) +} + +func (s *UpstreamServer) applyDefaults() { + if s.MaxConns == nil { + s.MaxConns = &defaultMaxConns } - if serverNGX.FailTimeout != "" && newServer.FailTimeout == "" { - newServer.FailTimeout = defaultFailTimeout + if s.MaxFails == nil { + s.MaxFails = &defaultMaxFails } - if serverNGX.SlowStart != "" && newServer.SlowStart == "" { - newServer.SlowStart = defaultSlowStart + if s.FailTimeout == "" { + s.FailTimeout = defaultFailTimeout } - if serverNGX.Backup != nil && newServer.Backup == nil { - newServer.Backup = &defaultBackup + if s.SlowStart == "" { + s.SlowStart = defaultSlowStart } - if serverNGX.Down != nil && newServer.Down == nil { - newServer.Down = &defaultDown + if s.Backup == nil { + s.Backup = &defaultBackup } - if serverNGX.Weight != nil && newServer.Weight == nil { - newServer.Weight = &defaultWeight + if s.Down == nil { + s.Down = &defaultDown } - return reflect.DeepEqual(newServer, serverNGX) + if s.Weight == nil { + s.Weight = &defaultWeight + } } func determineUpdates(updatedServers []UpstreamServer, nginxServers []UpstreamServer) (toAdd []UpstreamServer, toRemove []UpstreamServer, toUpdate []UpstreamServer) { for _, server := range updatedServers { updateFound := false for _, serverNGX := range nginxServers { - if server.Server == serverNGX.Server && !haveSameParameters(server, serverNGX) { + if server.Server == serverNGX.Server && !server.hasSameParametersAs(serverNGX) { server.ID = serverNGX.ID updateFound = true break @@ -1046,6 +1095,7 @@ func (client *NginxClient) patch(ctx context.Context, path string, input interfa if err != nil { return fmt.Errorf("failed to create a patch request: %w", err) } + req.Header.Set("Content-Type", "application/json") resp, err := client.httpClient.Do(req) if err != nil { @@ -1088,9 +1138,13 @@ func (client *NginxClient) AddStreamServer(ctx context.Context, upstream string, if id != -1 { return fmt.Errorf("failed to add %v stream server to %v upstream: %w", server.Server, upstream, ErrServerExists) } + err = client.addStreamServer(ctx, upstream, server) + return err +} +func (client *NginxClient) addStreamServer(ctx context.Context, upstream string, server StreamUpstreamServer) error { path := fmt.Sprintf("stream/upstreams/%v/servers/", upstream) - err = client.post(ctx, path, &server) + err := client.post(ctx, path, &server) if err != nil { return fmt.Errorf("failed to add %v stream server to %v upstream: %w", server.Server, upstream, err) } @@ -1106,9 +1160,13 @@ func (client *NginxClient) DeleteStreamServer(ctx context.Context, upstream stri if id == -1 { return fmt.Errorf("failed to remove %v stream server from %v upstream: %w", server, upstream, ErrServerNotFound) } + err = client.deleteStreamServer(ctx, upstream, server, id) + return err +} - path := fmt.Sprintf("stream/upstreams/%v/servers/%v", upstream, id) - err = client.delete(ctx, path, http.StatusOK) +func (client *NginxClient) deleteStreamServer(ctx context.Context, upstream, server string, serverID int) error { + path := fmt.Sprintf("stream/upstreams/%v/servers/%v", upstream, serverID) + err := client.delete(ctx, path, http.StatusOK) if err != nil { return fmt.Errorf("failed to remove %v stream server from %v upstream: %w", server, upstream, err) } @@ -1120,6 +1178,8 @@ func (client *NginxClient) DeleteStreamServer(ctx context.Context, upstream stri // Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX. // Servers that are in the slice and exist in NGINX, but have different parameters, will be updated. // The client will attempt to update all servers, returning all the errors that occurred. +// If there are duplicate servers with equivalent parameters, the duplicates will be ignored. +// If there are duplicate servers with different parameters, those server entries will be ignored and an error returned. func (client *NginxClient) UpdateStreamServers(ctx context.Context, upstream string, servers []StreamUpstreamServer) (added []StreamUpstreamServer, deleted []StreamUpstreamServer, updated []StreamUpstreamServer, err error) { serversInNginx, err := client.GetStreamServers(ctx, upstream) if err != nil { @@ -1132,10 +1192,12 @@ func (client *NginxClient) UpdateStreamServers(ctx context.Context, upstream str formattedServers = append(formattedServers, server) } + formattedServers, err = deduplicateStreamServers(upstream, formattedServers) + toAdd, toDelete, toUpdate := determineStreamUpdates(formattedServers, serversInNginx) for _, server := range toAdd { - addErr := client.AddStreamServer(ctx, upstream, server) + addErr := client.addStreamServer(ctx, upstream, server) if addErr != nil { err = errors.Join(err, addErr) continue @@ -1144,7 +1206,7 @@ func (client *NginxClient) UpdateStreamServers(ctx context.Context, upstream str } for _, server := range toDelete { - deleteErr := client.DeleteStreamServer(ctx, upstream, server.Server) + deleteErr := client.deleteStreamServer(ctx, upstream, server.Server, server.ID) if deleteErr != nil { err = errors.Join(err, deleteErr) continue @@ -1183,45 +1245,82 @@ func (client *NginxClient) getIDOfStreamServer(ctx context.Context, upstream str return -1, nil } -// haveSameParametersForStream checks if a given server has the same parameters as a server already present in NGINX. Order matters. -func haveSameParametersForStream(newServer StreamUpstreamServer, serverNGX StreamUpstreamServer) bool { - newServer.ID = serverNGX.ID - if serverNGX.MaxConns != nil && newServer.MaxConns == nil { - newServer.MaxConns = &defaultMaxConns +func deduplicateStreamServers(upstream string, servers []StreamUpstreamServer) ([]StreamUpstreamServer, error) { + type serverCheck struct { + server StreamUpstreamServer + valid bool } - if serverNGX.MaxFails != nil && newServer.MaxFails == nil { - newServer.MaxFails = &defaultMaxFails + serverMap := make(map[string]*serverCheck, len(servers)) + var err error + for _, server := range servers { + if prev, ok := serverMap[server.Server]; ok { + if !prev.valid { + continue + } + if !server.hasSameParametersAs(prev.server) { + prev.valid = false + err = errors.Join(err, fmt.Errorf( + "failed to update stream %s server to %s upstream: %w", + server.Server, upstream, ErrParameterMismatch)) + } + continue + } + serverMap[server.Server] = &serverCheck{server, true} } + retServers := make([]StreamUpstreamServer, 0, len(serverMap)) + for _, server := range servers { + if check, ok := serverMap[server.Server]; ok && check.valid { + retServers = append(retServers, server) + delete(serverMap, server.Server) + } + } + return retServers, err +} - if serverNGX.FailTimeout != "" && newServer.FailTimeout == "" { - newServer.FailTimeout = defaultFailTimeout +// hasSameParametersAs checks if a given server has the same parameters. +func (s StreamUpstreamServer) hasSameParametersAs(compareServer StreamUpstreamServer) bool { + s.ID = compareServer.ID + s.applyDefaults() + compareServer.applyDefaults() + return reflect.DeepEqual(s, compareServer) +} + +func (s *StreamUpstreamServer) applyDefaults() { + if s.MaxConns == nil { + s.MaxConns = &defaultMaxConns + } + + if s.MaxFails == nil { + s.MaxFails = &defaultMaxFails } - if serverNGX.SlowStart != "" && newServer.SlowStart == "" { - newServer.SlowStart = defaultSlowStart + if s.FailTimeout == "" { + s.FailTimeout = defaultFailTimeout } - if serverNGX.Backup != nil && newServer.Backup == nil { - newServer.Backup = &defaultBackup + if s.SlowStart == "" { + s.SlowStart = defaultSlowStart } - if serverNGX.Down != nil && newServer.Down == nil { - newServer.Down = &defaultDown + if s.Backup == nil { + s.Backup = &defaultBackup } - if serverNGX.Weight != nil && newServer.Weight == nil { - newServer.Weight = &defaultWeight + if s.Down == nil { + s.Down = &defaultDown } - return reflect.DeepEqual(newServer, serverNGX) + if s.Weight == nil { + s.Weight = &defaultWeight + } } func determineStreamUpdates(updatedServers []StreamUpstreamServer, nginxServers []StreamUpstreamServer) (toAdd []StreamUpstreamServer, toRemove []StreamUpstreamServer, toUpdate []StreamUpstreamServer) { for _, server := range updatedServers { updateFound := false for _, serverNGX := range nginxServers { - if server.Server == serverNGX.Server && !haveSameParametersForStream(server, serverNGX) { + if server.Server == serverNGX.Server && !server.hasSameParametersAs(serverNGX) { server.ID = serverNGX.ID updateFound = true break @@ -1949,9 +2048,13 @@ func (client *NginxClient) deleteKeyValPairs(ctx context.Context, zone string, s return nil } -// UpdateHTTPServer updates the server of the upstream. +// UpdateHTTPServer updates the server of the upstream with the matching server ID. func (client *NginxClient) UpdateHTTPServer(ctx context.Context, upstream string, server UpstreamServer) error { path := fmt.Sprintf("http/upstreams/%v/servers/%v", upstream, server.ID) + // The server ID is expected in the URI, but not expected in the body. + // The NGINX API will return + // {"error":{"status":400,"text":"unknown parameter \"id\"","code":"UpstreamConfFormatError"} + // if the ID field is present. server.ID = 0 err := client.patch(ctx, path, &server, http.StatusOK) if err != nil { @@ -1961,9 +2064,13 @@ func (client *NginxClient) UpdateHTTPServer(ctx context.Context, upstream string return nil } -// UpdateStreamServer updates the stream server of the upstream. +// UpdateStreamServer updates the stream server of the upstream with the matching server ID. func (client *NginxClient) UpdateStreamServer(ctx context.Context, upstream string, server StreamUpstreamServer) error { path := fmt.Sprintf("stream/upstreams/%v/servers/%v", upstream, server.ID) + // The server ID is expected in the URI, but not expected in the body. + // The NGINX API will return + // {"error":{"status":400,"text":"unknown parameter \"id\"","code":"UpstreamConfFormatError"} + // if the ID field is present. server.ID = 0 err := client.patch(ctx, path, &server, http.StatusOK) if err != nil { diff --git a/client/nginx_test.go b/client/nginx_test.go index 920e9c72..46467477 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -477,9 +477,9 @@ func TestHaveSameParameters(t *testing.T) { for _, test := range tests { t.Run(test.msg, func(t *testing.T) { t.Parallel() - result := haveSameParameters(test.server, test.serverNGX) + result := test.server.hasSameParametersAs(test.serverNGX) if result != test.expected { - t.Errorf("haveSameParameters(%v, %v) returned %v but expected %v", test.server, test.serverNGX, result, test.expected) + t.Errorf("(%v) hasSameParametersAs (%v) returned %v but expected %v", test.server, test.serverNGX, result, test.expected) } }) } @@ -562,9 +562,9 @@ func TestHaveSameParametersForStream(t *testing.T) { for _, test := range tests { t.Run(test.msg, func(t *testing.T) { t.Parallel() - result := haveSameParametersForStream(test.server, test.serverNGX) + result := test.server.hasSameParametersAs(test.serverNGX) if result != test.expected { - t.Errorf("haveSameParametersForStream(%v, %v) returned %v but expected %v", test.server, test.serverNGX, result, test.expected) + t.Errorf("(%v) hasSameParametersAs (%v) returned %v but expected %v", test.server, test.serverNGX, result, test.expected) } }) } @@ -982,174 +982,464 @@ func TestExtractPlusVersionNegativeCase(t *testing.T) { } } -func TestClientHTTPUpdateServers(t *testing.T) { +func TestUpdateHTTPServers(t *testing.T) { t.Parallel() - responses := []response{ - // response for first serversInNginx GET servers - { - statusCode: http.StatusOK, - servers: []UpstreamServer{}, + testcases := map[string]struct { + reqServers []UpstreamServer + responses []response + expAdded, expDeleted, expUpdated int + expErr bool + }{ + "successfully add 1 server": { + reqServers: []UpstreamServer{{Server: "127.0.0.1:80"}}, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + }, + // response for addHTTPServer POST server for http server + { + statusCode: http.StatusCreated, + }, + }, + expAdded: 1, }, - // response for AddHTTPServer GET servers for http server - { - statusCode: http.StatusOK, - servers: []UpstreamServer{}, + "successfully update 1 server": { + reqServers: []UpstreamServer{{Server: "127.0.0.1:80"}}, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []UpstreamServer{ + {ID: 1, Server: "127.0.0.1:80", Route: "/test"}, + }, + }, + // response for UpdateHTTPServer PATCH server for http server + { + statusCode: http.StatusOK, + }, + }, + expUpdated: 1, }, - // response for AddHTTPServer POST server for http server - { - statusCode: http.StatusInternalServerError, - servers: []UpstreamServer{}, + "successfully delete 1 server": { + reqServers: []UpstreamServer{{Server: "127.0.0.1:80"}}, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []UpstreamServer{ + {ID: 1, Server: "127.0.0.1:80"}, + {ID: 2, Server: "127.0.0.2:80"}, + }, + }, + // response for deleteHTTPServer DELETE server for http server + { + statusCode: http.StatusOK, + }, + }, + expDeleted: 1, }, - // response for AddHTTPServer GET servers for https server - { - statusCode: http.StatusOK, - servers: []UpstreamServer{}, + "successfully add 1 server, update 1 server, delete 1 server": { + reqServers: []UpstreamServer{ + {Server: "127.0.0.1:80", Route: "/test"}, + {Server: "127.0.0.2:80"}, + }, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []UpstreamServer{ + {ID: 1, Server: "127.0.0.1:80"}, + {ID: 2, Server: "127.0.0.3:80"}, + }, + }, + // response for addHTTPServer POST server for http server + { + statusCode: http.StatusCreated, + }, + // response for deleteHTTPServer DELETE server for http server + { + statusCode: http.StatusOK, + }, + // response for UpdateHTTPServer PATCH server for http server + { + statusCode: http.StatusOK, + }, + }, + expAdded: 1, + expUpdated: 1, + expDeleted: 1, }, - // response for AddHTTPServer POST server for https server - { - statusCode: http.StatusCreated, - servers: []UpstreamServer{}, + "successfully add 1 server with ignored identical duplicate": { + reqServers: []UpstreamServer{ + {Server: "127.0.0.1:80", Route: "/test"}, + {Server: "127.0.0.1", Route: "/test"}, + {Server: "127.0.0.1:80", Route: "/test", MaxConns: &defaultMaxConns}, + {Server: "127.0.0.1:80", Route: "/test", Backup: &defaultBackup}, + {Server: "127.0.0.1", Route: "/test", SlowStart: defaultSlowStart}, + }, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for addHTTPServer POST server for http server + { + statusCode: http.StatusCreated, + }, + }, + expAdded: 1, + }, + "successfully add 1 server, receive 1 error for non-identical duplicates": { + reqServers: []UpstreamServer{ + {Server: "127.0.0.1:80", Route: "/test"}, + {Server: "127.0.0.1:80", Route: "/test"}, + {Server: "127.0.0.2:80", Route: "/test1"}, + {Server: "127.0.0.2:80", Route: "/test2"}, + {Server: "127.0.0.2:80", Route: "/test3"}, + }, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for addHTTPServer POST server for http server + { + statusCode: http.StatusCreated, + }, + }, + expAdded: 1, + expErr: true, + }, + "successfully add 1 server, receive 1 error": { + reqServers: []UpstreamServer{ + {Server: "127.0.0.1:80"}, + {Server: "127.0.0.1:443"}, + }, + responses: []response{ // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for addHTTPServer POST server for server1 + { + statusCode: http.StatusInternalServerError, + servers: []UpstreamServer{}, + }, + // response for addHTTPServer POST server for server2 + { + statusCode: http.StatusCreated, + servers: []UpstreamServer{}, + }, + }, + expAdded: 1, + expErr: true, }, } - handler := &fakeHandler{ - func(w http.ResponseWriter, _ *http.Request) { - if len(responses) == 0 { - t.Fatal("ran out of responses") - } + for name, tc := range testcases { + t.Run(name, func(t *testing.T) { + t.Parallel() - re := responses[0] - responses = responses[1:] + var requests []*http.Request + handler := &fakeHandler{ + func(w http.ResponseWriter, r *http.Request) { + requests = append(requests, r) - w.WriteHeader(re.statusCode) + if len(tc.responses) == 0 { + t.Fatal("ran out of responses") + } + if r.Method == http.MethodPost || r.Method == http.MethodPut { + contentType, ok := r.Header["Content-Type"] + if !ok { + t.Fatalf("expected request type %s to have a Content-Type header", r.Method) + } + if len(contentType) != 1 || contentType[0] != "application/json" { + t.Fatalf("expected request type %s to have a Content-Type header value of 'application/json'", r.Method) + } + } - resp, err := json.Marshal(re.servers) - if err != nil { - t.Fatal(err) - } - _, err = w.Write(resp) - if err != nil { - t.Fatal(err) - } - }, - } + re := tc.responses[0] + tc.responses = tc.responses[1:] - server := httptest.NewServer(handler) - defer server.Close() + w.WriteHeader(re.statusCode) - client, err := NewNginxClient(server.URL, WithHTTPClient(&http.Client{})) - if err != nil { - t.Fatal(err) - } + resp, err := json.Marshal(re.servers) + if err != nil { + t.Fatal(err) + } + _, err = w.Write(resp) + if err != nil { + t.Fatal(err) + } + }, + } - httpServer := UpstreamServer{Server: "127.0.0.1:80"} - httpsServer := UpstreamServer{Server: "127.0.0.1:443"} + server := httptest.NewServer(handler) + defer server.Close() - // we expect that we will get an error for the 500 error encountered when putting the http server - // but we also expect that we have the https server added - added, _, _, err := client.UpdateHTTPServers(context.TODO(), "fakeUpstream", []UpstreamServer{ - httpServer, - httpsServer, - }) - if err == nil { - t.Fatal("expected to receive an error for 500 response when adding first server") - } + client, err := NewNginxClient(server.URL, WithHTTPClient(&http.Client{})) + if err != nil { + t.Fatal(err) + } - if len(added) != 1 { - t.Fatalf("expected to get one added server, instead got %d", len(added)) - } + added, deleted, updated, err := client.UpdateHTTPServers(context.Background(), "fakeUpstream", tc.reqServers) + if tc.expErr && err == nil { + t.Fatal("expected to receive an error") + } + if !tc.expErr && err != nil { + t.Fatalf("received an unexpected error: %v", err) + } - if !reflect.DeepEqual(httpsServer, added[0]) { - t.Errorf("expected: %v got: %v", httpsServer, added[0]) + if len(added) != tc.expAdded { + t.Fatalf("expected to get %d added server(s), instead got %d", tc.expAdded, len(added)) + } + if len(deleted) != tc.expDeleted { + t.Fatalf("expected to get %d deleted server(s), instead got %d", tc.expDeleted, len(deleted)) + } + if len(updated) != tc.expUpdated { + t.Fatalf("expected to get %d updated server(s), instead got %d", tc.expUpdated, len(updated)) + } + if len(tc.responses) != 0 { + t.Fatalf("did not use all expected responses, %d unused", len(tc.responses)) + } + }) } } -func TestClientStreamUpdateServers(t *testing.T) { +func TestUpdateStreamServers(t *testing.T) { t.Parallel() - responses := []response{ - // response for first serversInNginx GET servers - { - statusCode: http.StatusOK, - servers: []UpstreamServer{}, + testcases := map[string]struct { + reqServers []StreamUpstreamServer + responses []response + expAdded, expDeleted, expUpdated int + expErr bool + }{ + "successfully add 1 server": { + reqServers: []StreamUpstreamServer{{Server: "127.0.0.1:80"}}, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + }, + // response for addStreamServer POST server for stream server + { + statusCode: http.StatusCreated, + }, + }, + expAdded: 1, }, - // response for AddStreamServer GET servers for streamServer1 - { - statusCode: http.StatusOK, - servers: []UpstreamServer{}, + "successfully update 1 server": { + reqServers: []StreamUpstreamServer{{Server: "127.0.0.1:80"}}, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []StreamUpstreamServer{ + {ID: 1, Server: "127.0.0.1:80", SlowStart: "30s"}, + }, + }, + // response for UpdateStreamServer PATCH server for stream server + { + statusCode: http.StatusOK, + }, + }, + expUpdated: 1, }, - // response for AddStreamServer POST server for streamServer1 - { - statusCode: http.StatusInternalServerError, - servers: []UpstreamServer{}, + "successfully delete 1 server": { + reqServers: []StreamUpstreamServer{{Server: "127.0.0.1:80"}}, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []StreamUpstreamServer{ + {ID: 1, Server: "127.0.0.1:80"}, + {ID: 2, Server: "127.0.0.2:80"}, + }, + }, + // response for deleteStreamServer DELETE server for stream server + { + statusCode: http.StatusOK, + }, + }, + expDeleted: 1, }, - // response for AddStreamServer GET servers for streamServer2 - { - statusCode: http.StatusOK, - servers: []UpstreamServer{}, + "successfully add 1 server, update 1 server, delete 1 server": { + reqServers: []StreamUpstreamServer{ + {Server: "127.0.0.1:80", SlowStart: "30s"}, + {Server: "127.0.0.2:80"}, + }, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []StreamUpstreamServer{ + {ID: 1, Server: "127.0.0.1:80"}, + {ID: 2, Server: "127.0.0.3:80"}, + }, + }, + // response for addStreamServer POST server for stream server + { + statusCode: http.StatusCreated, + }, + // response for deleteStreamServer DELETE server for stream server + { + statusCode: http.StatusOK, + }, + // response for UpdateStreamServer PATCH server for stream server + { + statusCode: http.StatusOK, + }, + }, + expAdded: 1, + expUpdated: 1, + expDeleted: 1, }, - // response for AddStreamServer POST server for streamServer2 - { - statusCode: http.StatusCreated, - servers: []UpstreamServer{}, + "successfully add 1 server with ignored identical duplicate": { + reqServers: []StreamUpstreamServer{ + {Server: "127.0.0.1:80", SlowStart: "30s"}, + {Server: "127.0.0.1", SlowStart: "30s"}, + {Server: "127.0.0.1:80", SlowStart: "30s", MaxConns: &defaultMaxConns}, + {Server: "127.0.0.1", SlowStart: "30s", MaxFails: &defaultMaxFails}, + {Server: "127.0.0.1", SlowStart: "30s", FailTimeout: defaultFailTimeout}, + }, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for addStreamServer POST server for stream server + { + statusCode: http.StatusCreated, + }, + }, + expAdded: 1, + }, + "successfully add 1 server, receive 1 error for non-identical duplicates": { + reqServers: []StreamUpstreamServer{ + {Server: "127.0.0.1:80", SlowStart: "30s"}, + {Server: "127.0.0.1:80", SlowStart: "30s"}, + {Server: "127.0.0.2:80", SlowStart: "10s"}, + {Server: "127.0.0.2:80", SlowStart: "20s"}, + {Server: "127.0.0.2:80", SlowStart: "30s"}, + }, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for addStreamServer POST server for stream server + { + statusCode: http.StatusCreated, + }, + }, + expAdded: 1, + expErr: true, + }, + "successfully add 1 server, receive 1 error": { + reqServers: []StreamUpstreamServer{ + {Server: "127.0.0.1:2000"}, + {Server: "127.0.0.1:3000"}, + }, + responses: []response{ + // response for first serversInNginx GET servers + { + statusCode: http.StatusOK, + servers: []UpstreamServer{}, + }, + // response for addStreamServer POST server for server1 + { + statusCode: http.StatusInternalServerError, + servers: []UpstreamServer{}, + }, + // response for addStreamServer POST server for server2 + { + statusCode: http.StatusCreated, + servers: []UpstreamServer{}, + }, + }, + expAdded: 1, + expErr: true, }, } - handler := &fakeHandler{ - func(w http.ResponseWriter, _ *http.Request) { - if len(responses) == 0 { - t.Fatal("ran out of responses") - } + for name, tc := range testcases { + t.Run(name, func(t *testing.T) { + t.Parallel() - re := responses[0] - responses = responses[1:] + var requests []*http.Request + handler := &fakeHandler{ + func(w http.ResponseWriter, r *http.Request) { + requests = append(requests, r) - w.WriteHeader(re.statusCode) + if len(tc.responses) == 0 { + t.Fatal("ran out of responses") + } + if r.Method == http.MethodPost || r.Method == http.MethodPut { + contentType, ok := r.Header["Content-Type"] + if !ok { + t.Fatalf("expected request type %s to have a Content-Type header", r.Method) + } + if len(contentType) != 1 || contentType[0] != "application/json" { + t.Fatalf("expected request type %s to have a Content-Type header value of 'application/json'", r.Method) + } + } - resp, err := json.Marshal(re.servers) - if err != nil { - t.Fatal(err) - } - _, err = w.Write(resp) - if err != nil { - t.Fatal(err) - } - }, - } + re := tc.responses[0] + tc.responses = tc.responses[1:] - server := httptest.NewServer(handler) - defer server.Close() + w.WriteHeader(re.statusCode) - client, err := NewNginxClient(server.URL, WithHTTPClient(&http.Client{})) - if err != nil { - t.Fatal(err) - } - - streamServer1 := StreamUpstreamServer{Server: "127.0.0.1:2000"} - streamServer2 := StreamUpstreamServer{Server: "127.0.0.1:3000"} + resp, err := json.Marshal(re.servers) + if err != nil { + t.Fatal(err) + } + _, err = w.Write(resp) + if err != nil { + t.Fatal(err) + } + }, + } - // we expect that we will get an error for the 500 error encountered when putting server1 - // but we also expect that we get the second server added - added, _, _, err := client.UpdateStreamServers(context.TODO(), "fakeUpstream", []StreamUpstreamServer{ - streamServer1, - streamServer2, - }) - if err == nil { - t.Fatal("expected to receive an error for 500 response when adding first server") - } + server := httptest.NewServer(handler) + defer server.Close() - if len(added) != 1 { - t.Fatalf("expected to get one added server, instead got %d", len(added)) - } + client, err := NewNginxClient(server.URL, WithHTTPClient(&http.Client{})) + if err != nil { + t.Fatal(err) + } - if !reflect.DeepEqual(streamServer2, added[0]) { - t.Errorf("expected: %v got: %v", streamServer2, added[0]) + added, deleted, updated, err := client.UpdateStreamServers(context.Background(), "fakeUpstream", tc.reqServers) + if tc.expErr && err == nil { + t.Fatal("expected to receive an error") + } + if !tc.expErr && err != nil { + t.Fatalf("received an unexpected error: %v", err) + } + if len(added) != tc.expAdded { + t.Fatalf("expected to get %d added server(s), instead got %d", tc.expAdded, len(added)) + } + if len(deleted) != tc.expDeleted { + t.Fatalf("expected to get %d deleted server(s), instead got %d", tc.expDeleted, len(deleted)) + } + if len(updated) != tc.expUpdated { + t.Fatalf("expected to get %d updated server(s), instead got %d", tc.expUpdated, len(updated)) + } + if len(tc.responses) != 0 { + t.Fatalf("did not use all expected responses, %d unused", len(tc.responses)) + } + }) } } type response struct { - servers []UpstreamServer + servers interface{} statusCode int } diff --git a/tests/client_test.go b/tests/client_test.go index 4f1fe6fa..cdc185a1 100644 --- a/tests/client_test.go +++ b/tests/client_test.go @@ -61,8 +61,39 @@ func TestStreamClient(t *testing.T) { t.Errorf("Adding a duplicated server succeeded") } - // test deleting a stream server + // test updating a stream server + streamServers, err := c.GetStreamServers(ctx, streamUpstream) + if err != nil { + t.Errorf("Error getting stream servers: %v", err) + } + if len(streamServers) != 1 { + t.Errorf("Expected 1 servers, got %v", streamServers) + } + + streamServers[0].SlowStart = "30s" + err = c.UpdateStreamServer(ctx, streamUpstream, streamServers[0]) + if err != nil { + t.Errorf("Error when updating a server: %v", err) + } + streamServers, err = c.GetStreamServers(ctx, streamUpstream) + if err != nil { + t.Errorf("Error getting stream servers: %v", err) + } + if len(streamServers) != 1 { + t.Errorf("Expected 1 servers, got %v", streamServers) + } + if streamServers[0].SlowStart != "30s" { + t.Errorf("The server wasn't successfully updated: expected a 'SlowStart' of 30s, actual was %s", streamServers[0].SlowStart) + } + + streamServers[0].ID++ + err = c.UpdateStreamServer(ctx, streamUpstream, streamServers[0]) + if err == nil { + t.Errorf("Updating a server without a matching server ID succeeded") + } + + // test deleting a stream server err = c.DeleteStreamServer(ctx, streamUpstream, streamServer.Server) if err != nil { t.Fatalf("Error when deleting a server: %v", err) @@ -73,7 +104,7 @@ func TestStreamClient(t *testing.T) { t.Errorf("Deleting a nonexisting server succeeded") } - streamServers, err := c.GetStreamServers(ctx, streamUpstream) + streamServers, err = c.GetStreamServers(ctx, streamUpstream) if err != nil { t.Errorf("Error getting stream servers: %v", err) } @@ -340,8 +371,39 @@ func TestClient(t *testing.T) { t.Errorf("Adding a duplicated server succeeded") } - // test deleting a http server + // test updating an http server + servers, err := c.GetHTTPServers(ctx, upstream) + if err != nil { + t.Errorf("Error getting servers: %v", err) + } + if len(servers) != 1 { + t.Errorf("Expected 1 servers, got %v", servers) + } + + servers[0].SlowStart = "30s" + err = c.UpdateHTTPServer(ctx, upstream, servers[0]) + if err != nil { + t.Errorf("Error when updating a server: %v", err) + } + servers, err = c.GetHTTPServers(ctx, upstream) + if err != nil { + t.Errorf("Error getting servers: %v", err) + } + if len(servers) != 1 { + t.Errorf("Expected 1 servers, got %v", servers) + } + if servers[0].SlowStart != "30s" { + t.Errorf("The server wasn't successfully updated: expected a 'SlowStart' of 30s, actual was %s", servers[0].SlowStart) + } + + servers[0].ID++ + err = c.UpdateHTTPServer(ctx, upstream, servers[0]) + if err == nil { + t.Errorf("Updating a server without a matching server ID succeeded") + } + + // test deleting a http server err = c.DeleteHTTPServer(ctx, upstream, server.Server) if err != nil { t.Fatalf("Error when deleting a server: %v", err) @@ -381,7 +443,7 @@ func TestClient(t *testing.T) { // test getting servers - servers, err := c.GetHTTPServers(ctx, upstream) + servers, err = c.GetHTTPServers(ctx, upstream) if err != nil { t.Fatalf("Error when getting servers: %v", err) } From 301edf3a2b981c72e5aac19f1fce3dd3b964d254 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 10:09:52 -0800 Subject: [PATCH 150/244] Update pre-commit hook gitleaks/gitleaks to v8.23.3 (#460) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.23.2 | v8.23.3 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6c0f8156..4c800dd7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.23.2 + rev: v8.23.3 hooks: - id: gitleaks From 43800be04516272ab2c84912cd719b8d40bd7fe5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 18:12:13 +0000 Subject: [PATCH 151/244] Update github/codeql-action action to v3.28.8 (#459) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.28.5 | v3.28.8 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 04a681cb..4ee2bc7a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5 + uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5 + uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 1c9cc615..b9cb668a 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5 + uses: github/codeql-action/upload-sarif@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 with: sarif_file: results.sarif From 15f719b2f8fd8aaf59c15432b226b8decd0a0b3e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 11:45:46 -0800 Subject: [PATCH 152/244] Update module golang.org/x/sync to v0.11.0 (#462) | datasource | package | from | to | | ---------- | ----------------- | ------- | ------- | | go | golang.org/x/sync | v0.10.0 | v0.11.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a94427da..df9b5eff 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/nginx/nginx-plus-go-client/v2 go 1.22.6 -require golang.org/x/sync v0.10.0 +require golang.org/x/sync v0.11.0 diff --git a/go.sum b/go.sum index cf16d914..dffd122c 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= From 94f755e8f7a7f03b76503f01e53bb9eafe52da7d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 19:48:00 +0000 Subject: [PATCH 153/244] Update golangci/golangci-lint-action action to v6.3.0 (#461) | datasource | package | from | to | | ----------- | ----------------------------- | ------ | ------ | | github-tags | golangci/golangci-lint-action | v6.2.0 | v6.3.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 111e99f6..9a42f859 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,7 +33,7 @@ jobs: go-version: stable - name: Lint Go - uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0 + uses: golangci/golangci-lint-action@e60da84bfae8c7920a47be973d75e15710aa8bd7 # v6.3.0 with: version: v1.63.4 # renovate: datasource=github-tags depName=golangci/golangci-lint From 41c38b612b32f9fc427910947ea88ddfbfe3dee3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 13:34:59 +0000 Subject: [PATCH 154/244] Update pre-commit hook gitleaks/gitleaks to v8.24.0 (#475) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.23.3 | v8.24.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4c800dd7..83b8388a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.23.3 + rev: v8.24.0 hooks: - id: gitleaks From 28be6f5cf07a88de1876adca3d2799150ae659c1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 14:39:38 +0000 Subject: [PATCH 155/244] Update goreleaser/goreleaser-action action to v6.2.1 (#469) | datasource | package | from | to | | ----------- | ---------------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser-action | v6.1.0 | v6.2.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index feb5a906..89e69096 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: if: ${{ github.ref_type == 'tag' }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 + uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1 with: version: v2.6.1 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean From 4edb598b0ea189d279ec8dc69e5928497314a25b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 14:56:36 +0000 Subject: [PATCH 156/244] Update golangci/golangci-lint-action action to v6.5.0 (#464) | datasource | package | from | to | | ----------- | ----------------------------- | ------ | ------ | | github-tags | golangci/golangci-lint-action | v6.3.0 | v6.5.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9a42f859..40155097 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,7 +33,7 @@ jobs: go-version: stable - name: Lint Go - uses: golangci/golangci-lint-action@e60da84bfae8c7920a47be973d75e15710aa8bd7 # v6.3.0 + uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0 with: version: v1.63.4 # renovate: datasource=github-tags depName=golangci/golangci-lint From 3fcee65ca839b633b6fba8b54a3d78dcdd30b700 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 19:13:36 +0000 Subject: [PATCH 157/244] Update actions/upload-artifact action to v4.6.1 (#471) | datasource | package | from | to | | ----------- | ----------------------- | ------ | ------ | | github-tags | actions/upload-artifact | v4.6.0 | v4.6.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index b9cb668a..b351cd40 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -49,7 +49,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 with: name: SARIF file path: results.sarif From ec9fcdfe9b23909a0a90c8a5a47d25a3344f07ad Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 22:32:43 +0000 Subject: [PATCH 158/244] Update github/codeql-action action to v3.28.10 (#463) | datasource | package | from | to | | ----------- | -------------------- | ------- | -------- | | github-tags | github/codeql-action | v3.28.8 | v3.28.10 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4ee2bc7a..dcda7517 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/init@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/analyze@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index b351cd40..1a5a0a99 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 with: sarif_file: results.sarif From e7696000477802903c488fa47fc07203b17767a8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 03:12:42 +0000 Subject: [PATCH 159/244] Update reviewdog/action-actionlint action to v1.65.0 (#470) | datasource | package | from | to | | ----------- | --------------------------- | ------- | ------- | | github-tags | reviewdog/action-actionlint | v1.64.1 | v1.65.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 40155097..5a6c674d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Actions - uses: reviewdog/action-actionlint@abd537417cf4991e1ba8e21a67b1119f4f53b8e0 # v1.64.1 + uses: reviewdog/action-actionlint@db58217885f9a6570da9c71be4e40ec33fe44a1f # v1.65.0 with: actionlint_flags: -shellcheck "" From 9f237ae407af9c3a73d4d7340f83a9fcf066eee3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 09:06:05 +0000 Subject: [PATCH 160/244] Update ossf/scorecard-action action to v2.4.1 (#472) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | ossf/scorecard-action | v2.4.0 | v2.4.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 1a5a0a99..b05cff47 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -31,7 +31,7 @@ jobs: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 + uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 with: results_file: results.sarif results_format: sarif From ec20d35621243c1184f9a65275e9532271c2d5f4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 10:12:45 +0000 Subject: [PATCH 161/244] Update dependency golangci/golangci-lint to v1.64.5 (#466) | datasource | package | from | to | | ----------- | ---------------------- | ------- | ------- | | github-tags | golangci/golangci-lint | v1.63.4 | v1.64.5 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .pre-commit-config.yaml | 2 +- Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5a6c674d..c7c82bf5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0 with: - version: v1.63.4 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v1.64.5 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 83b8388a..923d3746 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v1.63.4 + rev: v1.64.5 hooks: - id: golangci-lint-full diff --git a/Makefile b/Makefile index 87974328..4d2b7378 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v1.63.4 +GOLANGCI_LINT_VERSION = v1.64.5 test: unit-test test-integration test-integration-no-stream-block clean From 09ea6eb1bb3e122a995b094b7959ca538aabf8d1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 13:56:14 +0000 Subject: [PATCH 162/244] Update dependency goreleaser/goreleaser to v2.7.0 (#467) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.6.1 | v2.7.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89e69096..a71e49ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1 with: - version: v2.6.1 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.7.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 15ebd7dc5faf9e35885f3de83baa432ab84b5eb5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 18:17:24 +0000 Subject: [PATCH 163/244] Update docker/build-push-action action to v6.15.0 (#473) | datasource | package | from | to | | ----------- | ------------------------ | ------- | ------- | | github-tags | docker/build-push-action | v6.13.0 | v6.15.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a71e49ec..bd93f13a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 - name: Build Plus Docker Image - uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0 + uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 with: file: docker/Dockerfile tags: nginx-plus From c27e5347a7f91bd3350659ec6470b1ea258b7ecc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 22:33:10 +0000 Subject: [PATCH 164/244] Update docker/dockerfile Docker tag to v1.14 (#474) | datasource | package | from | to | | ---------- | ----------------- | ---- | ---- | | docker | docker/dockerfile | 1.13 | 1.14 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index dd321a34..b8099ac5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.13 +# syntax=docker/dockerfile:1.14 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " From 177be9320abd072ff3e1d552737be7657245f78c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 1 Mar 2025 01:54:40 +0000 Subject: [PATCH 165/244] Update docker/setup-buildx-action action to v3.10.0 (#465) | datasource | package | from | to | | ----------- | -------------------------- | ------ | ------- | | github-tags | docker/setup-buildx-action | v3.8.0 | v3.10.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd93f13a..110e6fa7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: sed -i 's|\${NGINX_PLUS_VERSION}/||g' docker/Dockerfile - name: Set up Docker Buildx - uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 + uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 - name: Build Plus Docker Image uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 From 6e94c5331427ec62053e1a40ee1f520b4131afd0 Mon Sep 17 00:00:00 2001 From: Alex Russell <91080557+arussellf5@users.noreply.github.com> Date: Fri, 28 Mar 2025 09:15:25 -0600 Subject: [PATCH 166/244] Make status code and NGINX error codes on internalError publicly accessible (#489) --- client/nginx.go | 31 +++++++++++++++++---- client/nginx_test.go | 65 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 6 deletions(-) diff --git a/client/nginx.go b/client/nginx.go index 4a44d98c..ebe59212 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -52,6 +52,15 @@ var ( ErrPlusVersionNotFound = errors.New("plus version not found in the input string") ) +// StatusError is an interface that defines our API with consumers of the plus client errors. +// The error will return a http status code and an NGINX error code. +type StatusError interface { + Status() int + Code() string +} + +var _ StatusError = (*internalError)(nil) + // NginxClient lets you access NGINX Plus API. type NginxClient struct { httpClient *http.Client @@ -112,8 +121,18 @@ type apiError struct { } type internalError struct { - err string - apiError + err string + apiError apiError +} + +// Status returns the HTTP status code of the error. +func (internalError *internalError) Status() int { + return internalError.apiError.Status +} + +// Status returns the NGINX error code on the response. +func (internalError *internalError) Code() string { + return internalError.apiError.Code } // Error allows internalError to match the Error interface. @@ -1782,7 +1801,7 @@ func (client *NginxClient) GetStreamServerZones(ctx context.Context) (*StreamSer if err != nil { var ie *internalError if errors.As(err, &ie) { - if ie.Code == pathNotFoundCode { + if ie.Code() == pathNotFoundCode { return &zones, nil } } @@ -1808,7 +1827,7 @@ func (client *NginxClient) GetStreamUpstreams(ctx context.Context) (*StreamUpstr if err != nil { var ie *internalError if errors.As(err, &ie) { - if ie.Code == pathNotFoundCode { + if ie.Code() == pathNotFoundCode { return &upstreams, nil } } @@ -1824,7 +1843,7 @@ func (client *NginxClient) GetStreamZoneSync(ctx context.Context) (*StreamZoneSy if err != nil { var ie *internalError if errors.As(err, &ie) { - if ie.Code == pathNotFoundCode { + if ie.Code() == pathNotFoundCode { return nil, nil } } @@ -2137,7 +2156,7 @@ func (client *NginxClient) GetStreamConnectionsLimit(ctx context.Context) (*Stre if err != nil { var ie *internalError if errors.As(err, &ie) { - if ie.Code == pathNotFoundCode { + if ie.Code() == pathNotFoundCode { return &limitConns, nil } } diff --git a/client/nginx_test.go b/client/nginx_test.go index 46467477..8d565cae 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -3,6 +3,7 @@ package client import ( "context" "encoding/json" + "errors" "net/http" "net/http/httptest" "reflect" @@ -1438,6 +1439,70 @@ func TestUpdateStreamServers(t *testing.T) { } } +func TestInternalError(t *testing.T) { + t.Parallel() + + // mimic a user-defined interface type + type TestStatusError interface { + Status() int + Code() string + } + + //nolint // ignore golangci-lint err113 sugggestion to create package level static error + anotherErr := errors.New("another error") + + notFoundErr := &internalError{ + err: "not found error", + apiError: apiError{ + Text: "not found error", + Status: http.StatusNotFound, + Code: "not found code", + }, + } + + testcases := map[string]struct { + inputErr error + expectedCode string + expectedStatus int + }{ + "simple not found": { + inputErr: notFoundErr, + expectedStatus: http.StatusNotFound, + expectedCode: "not found code", + }, + "not found joined with another error": { + inputErr: errors.Join(notFoundErr, anotherErr), + expectedStatus: http.StatusNotFound, + expectedCode: "not found code", + }, + "not found wrapped with another error": { + inputErr: notFoundErr.Wrap("some error"), + expectedStatus: http.StatusNotFound, + expectedCode: "not found code", + }, + } + + for name, tc := range testcases { + t.Run(name, func(t *testing.T) { + t.Parallel() + + var se TestStatusError + ok := errors.As(tc.inputErr, &se) + if !ok { + t.Fatalf("could not cast error %v as StatusError", tc.inputErr) + } + + if se.Status() != tc.expectedStatus { + t.Fatalf("expected status %d, got status %d", tc.expectedStatus, se.Status()) + } + + if se.Code() != tc.expectedCode { + t.Fatalf("expected code %s, got code %s", tc.expectedCode, se.Code()) + } + }) + } +} + type response struct { servers interface{} statusCode int From 58f10e11dc59cfb8446a377ddf1ef51d89e2e65c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 11 Apr 2025 10:14:18 +0100 Subject: [PATCH 167/244] Update actions/dependency-review-action action to v4.6.0 (#495) | datasource | package | from | to | | ----------- | -------------------------------- | ------ | ------ | | github-tags | actions/dependency-review-action | v4.5.0 | v4.6.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/dependency-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index d1be1aff..073f91df 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -27,6 +27,6 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Dependency Review - uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0 + uses: actions/dependency-review-action@ce3cf9537a52e8119d91fd484ab5b8a807627bf8 # v4.6.0 with: config-file: "nginx/k8s-common/dependency-review-config.yml@main" From 9ba178578fd71b909a91678d471f27ecef735d1a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 11 Apr 2025 12:43:43 +0000 Subject: [PATCH 168/244] Update actions/upload-artifact action to v4.6.2 (#480) | datasource | package | from | to | | ----------- | ----------------------- | ------ | ------ | | github-tags | actions/upload-artifact | v4.6.1 | v4.6.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index b05cff47..d6dedaef 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -49,7 +49,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: SARIF file path: results.sarif From 71693603bd74e7d193c59a6b563f658cd0459316 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:22:03 +0100 Subject: [PATCH 169/244] Update dependency golangci/golangci-lint to v1.64.8 (#476) | datasource | package | from | to | | ----------- | ---------------------- | ------- | ------- | | github-tags | golangci/golangci-lint | v1.64.5 | v1.64.8 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .pre-commit-config.yaml | 2 +- Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c7c82bf5..dd4e6cb6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0 with: - version: v1.64.5 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v1.64.8 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 923d3746..09c5c069 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v1.64.5 + rev: v1.64.8 hooks: - id: golangci-lint-full diff --git a/Makefile b/Makefile index 4d2b7378..a8b93c55 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v1.64.5 +GOLANGCI_LINT_VERSION = v1.64.8 test: unit-test test-integration test-integration-no-stream-block clean From 37720456a8ce40e9093db1bcc532f9546643c56e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:25:50 +0000 Subject: [PATCH 170/244] Update 8398a7/action-slack action to v3.18.0 (#491) | datasource | package | from | to | | ----------- | ------------------- | ------- | ------- | | github-tags | 8398a7/action-slack | v3.16.2 | v3.18.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/notifications.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/notifications.yml b/.github/workflows/notifications.yml index dfaeaf0d..bb13506e 100644 --- a/.github/workflows/notifications.yml +++ b/.github/workflows/notifications.yml @@ -44,7 +44,7 @@ jobs: } - name: Send Notification - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 + uses: 8398a7/action-slack@1750b5085f3ec60384090fb7c52965ef822e869e # v3.18.0 with: status: custom custom_payload: | From fcf5a978d330b2ad610b69d3f806f09d4be308a7 Mon Sep 17 00:00:00 2001 From: Ciara Stacke <18287516+ciarams87@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:58:15 +0100 Subject: [PATCH 171/244] Chore: update dependencies (#498) * Update dependencies * Update linter and fix linting issues * Remove go 1.21 from unit tests and add 1.23 --- .github/workflows/ci.yml | 6 +- .github/workflows/codeql-analysis.yml | 4 +- .github/workflows/lint.yml | 6 +- .github/workflows/scorecard.yml | 2 +- .golangci.yml | 115 ++++++++++++++------------ .pre-commit-config.yaml | 6 +- Makefile | 4 +- client/nginx_test.go | 12 +-- compose.yaml | 2 +- docker/Dockerfile | 2 +- go.mod | 4 +- go.sum | 4 +- 12 files changed, 90 insertions(+), 77 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 110e6fa7..1eff326e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: strategy: fail-fast: false matrix: - go-version: ["1.21", "1.22", stable] + go-version: ["1.22", "1.23", stable] steps: - name: Checkout Repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -90,7 +90,7 @@ jobs: run: docker compose up test-no-stream --exit-code-from test-no-stream - name: Create/Update Draft - uses: lucacome/draft-release@5d29432a46bff6c122cd4b07a1fb94e1bb158d34 # v1.1.1 + uses: lucacome/draft-release@f15262dc3ac8c3efbf09a8ce5406cd0fc47aabb1 # v1.2.2 id: release-notes with: minor-label: "enhancement" @@ -106,7 +106,7 @@ jobs: if: ${{ github.ref_type == 'tag' }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1 + uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 with: version: v2.7.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index dcda7517..136bd717 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 + uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 + uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index dd4e6cb6..ab1714a4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,9 +33,9 @@ jobs: go-version: stable - name: Lint Go - uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0 + uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0 with: - version: v1.64.8 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v2.1.5 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Actions - uses: reviewdog/action-actionlint@db58217885f9a6570da9c71be4e40ec33fe44a1f # v1.65.0 + uses: reviewdog/action-actionlint@a5524e1c19e62881d79c1f1b9b6f09f16356e281 # v1.65.2 with: actionlint_flags: -shellcheck "" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index d6dedaef..e3dec9e7 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 + uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 with: sarif_file: results.sarif diff --git a/.golangci.yml b/.golangci.yml index 0624468a..07d01b78 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,44 +1,6 @@ -linters-settings: - misspell: - locale: US - revive: - ignore-generated-header: true - rules: - - name: blank-imports - - name: constant-logical-expr - - name: context-as-argument - - name: context-keys-type - - name: defer - - name: dot-imports - - name: duplicated-imports - - name: empty-block - - name: error-naming - - name: error-return - - name: error-strings - - name: errorf - - name: exported - - name: import-shadowing - - name: increment-decrement - - name: indent-error-flow - - name: package-comments - - name: range - - name: range-val-address - - name: range-val-in-closure - - name: receiver-naming - - name: redefines-builtin-id - - name: string-of-int - - name: superfluous-else - - name: time-naming - - name: unchecked-type-assertion - - name: unexported-return - - name: unnecessary-stmt - - name: unreachable-code - - name: unused-parameter - - name: var-declaration - - name: var-naming - govet: - enable-all: true +version: "2" linters: + default: none enable: - asasalint - asciicheck @@ -59,11 +21,7 @@ linters: - gochecksumtype - gocritic - godot - - gofmt - - gofumpt - - goimports - gosec - - gosimple - gosmopolitan - govet - ineffassign @@ -75,19 +33,16 @@ linters: - nilerr - noctx - nolintlint + - paralleltest - perfsprint - prealloc - predeclared - - paralleltest - reassign - revive - staticcheck - - stylecheck - tagalign - - tenv - thelper - tparallel - - typecheck - unconvert - unparam - unused @@ -95,9 +50,67 @@ linters: - wastedassign - whitespace - wrapcheck - disable-all: true + settings: + govet: + enable-all: true + misspell: + locale: US + revive: + rules: + - name: blank-imports + - name: constant-logical-expr + - name: context-as-argument + - name: context-keys-type + - name: defer + - name: dot-imports + - name: duplicated-imports + - name: empty-block + - name: error-naming + - name: error-return + - name: error-strings + - name: errorf + - name: exported + - name: import-shadowing + - name: increment-decrement + - name: indent-error-flow + - name: package-comments + - name: range + - name: range-val-address + - name: range-val-in-closure + - name: receiver-naming + - name: redefines-builtin-id + - name: string-of-int + - name: superfluous-else + - name: time-naming + - name: unchecked-type-assertion + - name: unexported-return + - name: unnecessary-stmt + - name: unreachable-code + - name: unused-parameter + - name: var-declaration + - name: var-naming + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ issues: max-issues-per-linter: 0 max-same-issues: 0 -run: - timeout: 5m +formatters: + enable: + - gofmt + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 09c5c069..fedbc5f5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,12 +24,12 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v1.64.8 + rev: v2.0.2 hooks: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.24.0 + rev: v8.24.3 hooks: - id: gitleaks @@ -39,7 +39,7 @@ repos: - id: markdownlint-cli2 - repo: https://github.com/adrienverge/yamllint.git - rev: v1.35.1 + rev: v1.37.0 hooks: - id: yamllint diff --git a/Makefile b/Makefile index a8b93c55..33e974d8 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v1.64.8 +GOLANGCI_LINT_VERSION = v2.1.5 test: unit-test test-integration test-integration-no-stream-block clean lint: - go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run --fix + go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run --fix unit-test: go test -v -shuffle=on -race client/*.go diff --git a/client/nginx_test.go b/client/nginx_test.go index 8d565cae..6d1661a0 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -677,8 +677,8 @@ func TestClientWithMaxAPI(t *testing.T) { t.Parallel() // Test creating a new client with max API version ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch { - case r.RequestURI == "/": + switch r.RequestURI { + case "/": _, err := w.Write([]byte(tt.apiVersions)) if err != nil { t.Fatalf("unexpected error: %v", err) @@ -852,8 +852,8 @@ func TestGetStats_SSL(t *testing.T) { func TestGetMaxAPIVersionServer(t *testing.T) { t.Parallel() ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch { - case r.RequestURI == "/": + switch r.RequestURI { + case "/": _, err := w.Write([]byte(`[4, 5, 6, 7]`)) if err != nil { t.Fatalf("unexpected error: %v", err) @@ -884,8 +884,8 @@ func TestGetMaxAPIVersionServer(t *testing.T) { func TestGetMaxAPIVersionClient(t *testing.T) { t.Parallel() ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch { - case r.RequestURI == "/": + switch r.RequestURI { + case "/": _, err := w.Write([]byte(`[4, 5, 6, 7, 8, 9, 25]`)) if err != nil { t.Fatalf("unexpected error: %v", err) diff --git a/compose.yaml b/compose.yaml index d1b0433c..c68d0f67 100644 --- a/compose.yaml +++ b/compose.yaml @@ -29,7 +29,7 @@ services: service: nginx test: - image: golang:1.23 + image: golang:1.24 volumes: - type: bind source: ./ diff --git a/docker/Dockerfile b/docker/Dockerfile index b8099ac5..f31000aa 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.14 +# syntax=docker/dockerfile:1.15 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " diff --git a/go.mod b/go.mod index df9b5eff..90276c54 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/nginx/nginx-plus-go-client/v2 -go 1.22.6 +go 1.24.2 -require golang.org/x/sync v0.11.0 +require golang.org/x/sync v0.13.0 diff --git a/go.sum b/go.sum index dffd122c..67fee8ff 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= -golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= +golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= From 179816587aa9e53f4336000cea97baff3a1a7bb2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:00:43 +0000 Subject: [PATCH 172/244] Update reviewdog/action-yamllint action to v1.21.0 (#488) | datasource | package | from | to | | ----------- | ------------------------- | ------- | ------- | | github-tags | reviewdog/action-yamllint | v1.20.0 | v1.21.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ab1714a4..4c994eec 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -70,4 +70,4 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint YAML - uses: reviewdog/action-yamllint@1dca3ad811867be18fbe293a9818d715a6c2cd46 # v1.20.0 + uses: reviewdog/action-yamllint@f01d8a48fd8d89f89895499fca2cff09f9e9e8c0 # v1.21.0 From 8a1df797db6d5f9637e0f678e4f2d914fffcb412 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:11:13 +0000 Subject: [PATCH 173/244] Update actions/setup-go action to v5.4.0 (#484) | datasource | package | from | to | | ----------- | ---------------- | ------ | ------ | | github-tags | actions/setup-go | v5.3.0 | v5.4.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/lint.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1eff326e..0b397aab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 with: go-version: ${{ matrix.go-version }} @@ -100,7 +100,7 @@ jobs: if: ${{ github.event_name == 'push' }} - name: Setup Golang Environment - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 with: go-version: stable if: ${{ github.ref_type == 'tag' }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 136bd717..16efcde5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,7 +51,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 with: go-version: stable if: matrix.language == 'go' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4c994eec..abb49312 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 with: go-version: stable From 4e8e181acfa9e17dd0a37f37c52909558ad11920 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:13:33 +0000 Subject: [PATCH 174/244] Update dependency goreleaser/goreleaser to v2.8.2 (#485) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.7.0 | v2.8.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b397aab..f931931e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 with: - version: v2.7.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.8.2 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f60ae9dd29866636d6381671e565ae021a2bcdb6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:31:08 +0000 Subject: [PATCH 175/244] Update fossas/fossa-action action to v1.6.0 (#486) | datasource | package | from | to | | ----------- | ------------------- | ------ | ------ | | github-tags | fossas/fossa-action | v1.5.0 | v1.6.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/fossa.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index ce730445..3dec0515 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -24,6 +24,6 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Scan - uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0 + uses: fossas/fossa-action@c0a7d013f84c8ee5e910593186598625513cc1e4 # v1.6.0 with: api-key: ${{ secrets.FOSSA_TOKEN }} From c21dd79807e0b1a7f4f3c48912ae92ad18a2c3c1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:36:15 +0000 Subject: [PATCH 176/244] Update pre-commit hook golangci/golangci-lint to v2.1.5 (#493) | datasource | package | from | to | | ----------- | ---------------------- | ------ | ------ | | github-tags | golangci/golangci-lint | v2.0.2 | v2.1.5 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fedbc5f5..a52aa5d0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v2.0.2 + rev: v2.1.5 hooks: - id: golangci-lint-full From 15904aa61ceb7593226088ac0f40c8649fd383a4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 1 May 2025 13:58:15 +0100 Subject: [PATCH 177/244] Update docker/build-push-action action to v6.16.0 (#499) | datasource | package | from | to | | ----------- | ------------------------ | ------- | ------- | | github-tags | docker/build-push-action | v6.15.0 | v6.16.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f931931e..9ffa0c06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 - name: Build Plus Docker Image - uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 + uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0 with: file: docker/Dockerfile tags: nginx-plus From 7895f72bf764667f2c3f6dccad256e88546954c4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 11:12:52 +0100 Subject: [PATCH 178/244] Update golangci/golangci-lint-action action to v8 (#506) | datasource | package | from | to | | ----------- | ----------------------------- | ------ | ------ | | github-tags | golangci/golangci-lint-action | v7.0.0 | v8.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index abb49312..ad7fc88c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,7 +33,7 @@ jobs: go-version: stable - name: Lint Go - uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0 + uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: version: v2.1.5 # renovate: datasource=github-tags depName=golangci/golangci-lint From 4baf32d7fcbc6e2d222b5dfedc7af27ef6ef82a0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 11:38:20 +0000 Subject: [PATCH 179/244] Update dependency golangci/golangci-lint to v2.1.6 (#500) | datasource | package | from | to | | ----------- | ---------------------- | ------ | ------ | | github-tags | golangci/golangci-lint | v2.1.5 | v2.1.6 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .pre-commit-config.yaml | 2 +- Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ad7fc88c..e3300691 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: - version: v2.1.5 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v2.1.6 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a52aa5d0..106d4465 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v2.1.5 + rev: v2.1.6 hooks: - id: golangci-lint-full diff --git a/Makefile b/Makefile index 33e974d8..14133b36 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v2.1.5 +GOLANGCI_LINT_VERSION = v2.1.6 test: unit-test test-integration test-integration-no-stream-block clean From e76cc872fad085ea012f2084c9538c1021bb4d48 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 16:42:12 +0000 Subject: [PATCH 180/244] Update github/codeql-action action to v3.28.17 (#501) | datasource | package | from | to | | ----------- | -------------------- | -------- | -------- | | github-tags | github/codeql-action | v3.28.16 | v3.28.17 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 16efcde5..0a160ed0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 + uses: github/codeql-action/init@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 + uses: github/codeql-action/analyze@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index e3dec9e7..67efb313 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 + uses: github/codeql-action/upload-sarif@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17 with: sarif_file: results.sarif From 672c81ff8f61aeb16e41ed3c460497b8161f0df4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 22:45:21 +0000 Subject: [PATCH 181/244] Update pre-commit hook adrienverge/yamllint to v1.37.1 (#503) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | adrienverge/yamllint | v1.37.0 | v1.37.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 106d4465..aa359677 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: - id: markdownlint-cli2 - repo: https://github.com/adrienverge/yamllint.git - rev: v1.37.0 + rev: v1.37.1 hooks: - id: yamllint From 10dad3b14a348ceab09b3d4c4b0ac01123b32bf5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 03:07:09 +0000 Subject: [PATCH 182/244] Update dependency goreleaser/goreleaser to v2.9.0 (#504) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser | v2.8.2 | v2.9.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ffa0c06..5760d1bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 with: - version: v2.8.2 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.9.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From aeb0d25c0f365cfceff0d0dbb2b6279644ae9527 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 06:34:27 +0000 Subject: [PATCH 183/244] Update pre-commit hook gitleaks/gitleaks to v8.26.0 (#505) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.24.3 | v8.26.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa359677..0346fae3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.24.3 + rev: v8.26.0 hooks: - id: gitleaks From 6197cae965f16a5ba1e4f251d98c754d59c55722 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 17:05:30 +0100 Subject: [PATCH 184/244] Update github/codeql-action action to v3.29.2 (#507) | datasource | package | from | to | | ----------- | -------------------- | -------- | ------- | | github-tags | github/codeql-action | v3.28.17 | v3.29.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 0a160ed0..d970f322 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17 + uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17 + uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 67efb313..46d41618 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17 + uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2 with: sarif_file: results.sarif From 3fe295d304676e30e11047e58564bec2dd88c2a1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 17:07:37 +0100 Subject: [PATCH 185/244] Update lucacome/draft-release action to v1.2.3 (#518) | datasource | package | from | to | | ----------- | ---------------------- | ------ | ------ | | github-tags | lucacome/draft-release | v1.2.2 | v1.2.3 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5760d1bd..dd397dac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: run: docker compose up test-no-stream --exit-code-from test-no-stream - name: Create/Update Draft - uses: lucacome/draft-release@f15262dc3ac8c3efbf09a8ce5406cd0fc47aabb1 # v1.2.2 + uses: lucacome/draft-release@38def8b74645796e9743b53e0f187d4a8915ea3e # v1.2.3 id: release-notes with: minor-label: "enhancement" From ee0bfcbdd6c3e5e15b8166bdadd7098f7e0f86ab Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 16:16:39 +0000 Subject: [PATCH 186/244] Update ossf/scorecard-action action to v2.4.2 (#508) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | ossf/scorecard-action | v2.4.1 | v2.4.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 46d41618..c533d448 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -31,7 +31,7 @@ jobs: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 + uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 with: results_file: results.sarif results_format: sarif From d23efcfdb01e6044df66b7311eb8e689adac4c04 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 16:23:25 +0000 Subject: [PATCH 187/244] Update actions/dependency-review-action action to v4.7.1 (#509) | datasource | package | from | to | | ----------- | -------------------------------- | ------ | ------ | | github-tags | actions/dependency-review-action | v4.6.0 | v4.7.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/dependency-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 073f91df..73022eb2 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -27,6 +27,6 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Dependency Review - uses: actions/dependency-review-action@ce3cf9537a52e8119d91fd484ab5b8a807627bf8 # v4.6.0 + uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1 with: config-file: "nginx/k8s-common/dependency-review-config.yml@main" From 861558c1f4704d702b72bde873af7b878d0fd12a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 23:36:20 +0000 Subject: [PATCH 188/244] Update actions/setup-go action to v5.5.0 (#510) | datasource | package | from | to | | ----------- | ---------------- | ------ | ------ | | github-tags | actions/setup-go | v5.4.0 | v5.5.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/lint.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd397dac..03861df2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version: ${{ matrix.go-version }} @@ -100,7 +100,7 @@ jobs: if: ${{ github.event_name == 'push' }} - name: Setup Golang Environment - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version: stable if: ${{ github.ref_type == 'tag' }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d970f322..b46f37de 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,7 +51,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version: stable if: matrix.language == 'go' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e3300691..6dff55c7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Golang Environment - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version: stable From d82b3da04142ff21178b25d56451d1cb0c6243e9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 03:33:07 +0000 Subject: [PATCH 189/244] Update dependency goreleaser/goreleaser to v2.10.2 (#519) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------- | | github-tags | goreleaser/goreleaser | v2.9.0 | v2.10.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03861df2..dccc5aa7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 with: - version: v2.9.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.10.2 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c7a20ab34486b8ff6a7b2abd27c9da597421ba73 Mon Sep 17 00:00:00 2001 From: Paul Abel <128620221+pdabelf5@users.noreply.github.com> Date: Tue, 1 Jul 2025 09:08:32 +0100 Subject: [PATCH 190/244] Address markdown lint feedback (#520) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d617150..284d66a1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,7 +63,7 @@ issue template. ### F5 Contributor License Agreement (CLA) -F5 requires all external contributors to agree to the terms of the F5 CLA (available [here](https://github.com/f5/.github/blob/main/CLA/cla-markdown.md)) +F5 requires all external contributors to agree to the terms of the [F5 CLA](https://github.com/f5/.github/blob/main/CLA/cla-markdown.md) before any of their changes can be incorporated into an F5 Open Source repository. If you have not yet agreed to the F5 CLA terms and submit a PR to this repository, a bot will prompt you to view and From 4722a0eb962de1d5d6a15fc38fdd1989441c43db Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 08:10:40 +0000 Subject: [PATCH 191/244] Update fossas/fossa-action action to v1.7.0 (#513) | datasource | package | from | to | | ----------- | ------------------- | ------ | ------ | | github-tags | fossas/fossa-action | v1.6.0 | v1.7.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/fossa.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index 3dec0515..9cd8da2a 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -24,6 +24,6 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Scan - uses: fossas/fossa-action@c0a7d013f84c8ee5e910593186598625513cc1e4 # v1.6.0 + uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0 with: api-key: ${{ secrets.FOSSA_TOKEN }} From f4bf26f693e28c973d7f917663807f3e4c7120df Mon Sep 17 00:00:00 2001 From: Paul Abel <128620221+pdabelf5@users.noreply.github.com> Date: Tue, 1 Jul 2025 11:22:51 +0100 Subject: [PATCH 192/244] Update to use GITHUB_TOKEN for scorecard reports (#521) --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index c533d448..7a152edd 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -35,7 +35,7 @@ jobs: with: results_file: results.sarif results_format: sarif - repo_token: ${{ secrets.SCORECARD_TOKEN }} + repo_token: ${{ secrets.GITHUB_TOKEN }} # Public repositories: # - Publish results to OpenSSF REST API for easy access by consumers From 184d846c73e5ad9ec9cece777d3253852e39a56b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 10:24:53 +0000 Subject: [PATCH 193/244] Update docker/build-push-action action to v6.18.0 (#511) | datasource | package | from | to | | ----------- | ------------------------ | ------- | ------- | | github-tags | docker/build-push-action | v6.16.0 | v6.18.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dccc5aa7..ae586eb9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 - name: Build Plus Docker Image - uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0 + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: file: docker/Dockerfile tags: nginx-plus From 21460a8dd24dca63db4ab60ce5c47b512ca6be53 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 10:50:21 +0000 Subject: [PATCH 194/244] Update DavidAnson/markdownlint-cli2-action action to v20 (#517) | datasource | package | from | to | | ----------- | ----------------------------------- | ------- | ------- | | github-tags | DavidAnson/markdownlint-cli2-action | v19.1.0 | v20.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6dff55c7..25f7bc0d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -57,7 +57,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Markdown - uses: DavidAnson/markdownlint-cli2-action@05f32210e84442804257b2a6f20b273450ec8265 # v19.1.0 + uses: DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e # v20.0.0 with: config: .markdownlint-cli2.yaml globs: "**/*.md" From 22606ee1bfbd670e0cf6717a557329b9db045e4f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 11:02:29 +0000 Subject: [PATCH 195/244] Update docker/dockerfile Docker tag to v1.17 (#512) | datasource | package | from | to | | ---------- | ----------------- | ---- | ---- | | docker | docker/dockerfile | 1.15 | 1.17 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f31000aa..5380a7c3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.15 +# syntax=docker/dockerfile:1.17 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " From dd3d2f6fedb3ce2c744debdde21fb227feb96b7e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 11:06:42 +0000 Subject: [PATCH 196/244] Update module golang.org/x/sync to v0.15.0 (#514) | datasource | package | from | to | | ---------- | ----------------- | ------- | ------- | | go | golang.org/x/sync | v0.13.0 | v0.15.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 90276c54..b9e8e280 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/nginx/nginx-plus-go-client/v2 go 1.24.2 -require golang.org/x/sync v0.13.0 +require golang.org/x/sync v0.15.0 diff --git a/go.sum b/go.sum index 67fee8ff..f98f706e 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= -golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= +golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= From 790cf4bd786df27359e62de37562414cb03fe43c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 11:10:22 +0000 Subject: [PATCH 197/244] Update pre-commit hook DavidAnson/markdownlint-cli2 to v0.18.1 (#515) | datasource | package | from | to | | ----------- | ---------------------------- | ------- | ------- | | github-tags | DavidAnson/markdownlint-cli2 | v0.17.2 | v0.18.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0346fae3..674ebe23 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: gitleaks - repo: https://github.com/DavidAnson/markdownlint-cli2 - rev: v0.17.2 + rev: v0.18.1 hooks: - id: markdownlint-cli2 From f5937326598c9e2fc6f177f0701b81b19bf7165d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 11:26:43 +0000 Subject: [PATCH 198/244] Update pre-commit hook gitleaks/gitleaks to v8.27.2 (#516) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.26.0 | v8.27.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 674ebe23..242cced3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.26.0 + rev: v8.27.2 hooks: - id: gitleaks From c24c58b2a09f626558c6ca5c41659a45910217cc Mon Sep 17 00:00:00 2001 From: Andrei Belov Date: Tue, 29 Jul 2025 09:35:06 -0600 Subject: [PATCH 199/244] Update N+ license handling to reflect reporting section presence (#528) --- client/nginx.go | 2 +- client/nginx_test.go | 137 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 1 deletion(-) diff --git a/client/nginx.go b/client/nginx.go index ebe59212..e6c9c0ad 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -225,9 +225,9 @@ type LicenseReporting struct { // NginxLicense contains licensing information about NGINX Plus. type NginxLicense struct { + Reporting *LicenseReporting ActiveTill uint64 `json:"active_till"` Eval bool - Reporting LicenseReporting } // Caches is a map of cache stats by cache zone. diff --git a/client/nginx_test.go b/client/nginx_test.go index 6d1661a0..33e6416c 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -1503,6 +1503,143 @@ func TestInternalError(t *testing.T) { } } +func TestLicenseWithReporting(t *testing.T) { + t.Parallel() + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch { + case r.RequestURI == "/": + _, err := w.Write([]byte(`[1,2,3,4,5,6,7,8,9]`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + case r.RequestURI == "/9/": + _, err := w.Write([]byte(`["nginx","processes","connections","slabs","http","resolvers","ssl","license","workers"]`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + case strings.HasPrefix(r.RequestURI, "/9/nginx"): + _, err := w.Write([]byte(`{ + "version": "1.29.0", + "build": "nginx-plus-r34" + }`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + case strings.HasPrefix(r.RequestURI, "/9/license"): + _, err := w.Write([]byte(`{ + "active_till" : 428250000, + "eval": false, + "reporting": { + "healthy": true, + "fails": 42, + "grace": 86400 + } + }`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + default: + _, err := w.Write([]byte(`{}`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + } + })) + defer ts.Close() + + client, err := NewNginxClient(ts.URL, WithAPIVersion(9), WithCheckAPI()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if client == nil { + t.Fatalf("client is nil") + } + + license, err := client.GetNginxLicense(context.Background()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + testReporting := LicenseReporting{ + Healthy: true, + Fails: 42, + Grace: 86400, + } + + testLicense := NginxLicense{ + ActiveTill: 428250000, + Eval: false, + Reporting: &testReporting, + } + + if !reflect.DeepEqual(license, &testLicense) { + t.Fatalf("NGINX license: expected %v, actual %v; NGINX reporting: expected %v, actual %v", testLicense, license, testReporting, license.Reporting) + } +} + +func TestLicenseWithoutReporting(t *testing.T) { + t.Parallel() + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch { + case r.RequestURI == "/": + _, err := w.Write([]byte(`[1,2,3,4,5,6,7,8,9]`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + case r.RequestURI == "/9/": + _, err := w.Write([]byte(`["nginx","processes","connections","slabs","http","resolvers","ssl","license","workers"]`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + case strings.HasPrefix(r.RequestURI, "/9/nginx"): + _, err := w.Write([]byte(`{ + "version": "1.29.0", + "build": "nginx-plus-r34" + }`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + case strings.HasPrefix(r.RequestURI, "/9/license"): + _, err := w.Write([]byte(`{ + "active_till" : 428250000, + "eval": false + }`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + default: + _, err := w.Write([]byte(`{}`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + } + })) + defer ts.Close() + + client, err := NewNginxClient(ts.URL, WithAPIVersion(9), WithCheckAPI()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if client == nil { + t.Fatalf("client is nil") + } + + license, err := client.GetNginxLicense(context.Background()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + testLicense := NginxLicense{ + ActiveTill: 428250000, + Eval: false, + Reporting: nil, + } + + if !reflect.DeepEqual(license, &testLicense) { + t.Fatalf("NGINX license: expected %v, actual %v", testLicense, license) + } +} + type response struct { servers interface{} statusCode int From 74b2856a075cb1a882566bf6f6065c78d4de739f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Jul 2025 15:37:20 +0000 Subject: [PATCH 200/244] Update dependency goreleaser/goreleaser to v2.11.1 (#525) | datasource | package | from | to | | ----------- | --------------------- | ------- | ------- | | github-tags | goreleaser/goreleaser | v2.10.2 | v2.11.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae586eb9..891994b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 with: - version: v2.10.2 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.11.1 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 739331ac6eb7397d555ad3ff5cd31a5907aca579 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Jul 2025 15:41:07 +0000 Subject: [PATCH 201/244] Update lucacome/draft-release action to v1.2.4 (#523) | datasource | package | from | to | | ----------- | ---------------------- | ------ | ------ | | github-tags | lucacome/draft-release | v1.2.3 | v1.2.4 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 891994b9..4d28a4b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: run: docker compose up test-no-stream --exit-code-from test-no-stream - name: Create/Update Draft - uses: lucacome/draft-release@38def8b74645796e9743b53e0f187d4a8915ea3e # v1.2.3 + uses: lucacome/draft-release@00f74370c044c322da6cb52acc707d62c7762c71 # v1.2.4 id: release-notes with: minor-label: "enhancement" From 4021036d9728f7f94080c839aeac4bef83d6a3af Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Jul 2025 19:36:21 +0000 Subject: [PATCH 202/244] Update docker/setup-buildx-action action to v3.11.1 (#526) | datasource | package | from | to | | ----------- | -------------------------- | ------- | ------- | | github-tags | docker/setup-buildx-action | v3.10.0 | v3.11.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d28a4b0..97e8b7d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: sed -i 's|\${NGINX_PLUS_VERSION}/||g' docker/Dockerfile - name: Set up Docker Buildx - uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 + uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 - name: Build Plus Docker Image uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 From 95f462a4688b4e6b38ed0d29fde540607797a4c3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Jul 2025 23:06:20 +0000 Subject: [PATCH 203/244] Update module golang.org/x/sync to v0.16.0 (#527) | datasource | package | from | to | | ---------- | ----------------- | ------- | ------- | | go | golang.org/x/sync | v0.15.0 | v0.16.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b9e8e280..39fef917 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/nginx/nginx-plus-go-client/v2 go 1.24.2 -require golang.org/x/sync v0.15.0 +require golang.org/x/sync v0.16.0 diff --git a/go.sum b/go.sum index f98f706e..878acfe4 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= -golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= +golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= From e3d4843edc43564693dcaa2f4d2ea960a85fec4e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 Aug 2025 08:31:25 +0000 Subject: [PATCH 204/244] [pre-commit.ci] pre-commit autoupdate (#522) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/golangci/golangci-lint: v2.1.6 → v2.2.1](https://github.com/golangci/golangci-lint/compare/v2.1.6...v2.2.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 242cced3..439bcbef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v2.1.6 + rev: v2.2.1 hooks: - id: golangci-lint-full From a08437fd50d8138c43394989c372c48fb8f46e63 Mon Sep 17 00:00:00 2001 From: Paul Abel <128620221+pdabelf5@users.noreply.github.com> Date: Thu, 7 Aug 2025 11:16:39 +0100 Subject: [PATCH 205/244] Switch to DialContext() to address lint issue (#530) --- tests/client_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/client_test.go b/tests/client_test.go index cdc185a1..aaeed124 100644 --- a/tests/client_test.go +++ b/tests/client_test.go @@ -850,7 +850,8 @@ func TestStreamStats(t *testing.T) { } // make connection so we have stream server zone stats - ignore response - _, err = net.Dial("tcp", helpers.GetStreamAddress()) + d := &net.Dialer{} + _, err = d.DialContext(context.Background(), "tcp", helpers.GetStreamAddress()) if err != nil { t.Errorf("Error making tcp connection: %v", err) } From ccf6aa5c8d947250c8db8b9ad884c92f28ba08d5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Aug 2025 10:18:43 +0000 Subject: [PATCH 206/244] Update dependency golangci/golangci-lint to v2.3.1 (#524) | datasource | package | from | to | | ----------- | ---------------------- | ------ | ------ | | github-tags | golangci/golangci-lint | v2.1.6 | v2.3.1 | | github-tags | golangci/golangci-lint | v2.2.1 | v2.3.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .pre-commit-config.yaml | 2 +- Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 25f7bc0d..84d06367 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: - version: v2.1.6 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v2.3.1 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 439bcbef..3436174d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v2.2.1 + rev: v2.3.1 hooks: - id: golangci-lint-full diff --git a/Makefile b/Makefile index 14133b36..8f72c183 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v2.1.6 +GOLANGCI_LINT_VERSION = v2.3.1 test: unit-test test-integration test-integration-no-stream-block clean From a0a0e0b72a2b8acae4e15f3d0a4228263045bbd2 Mon Sep 17 00:00:00 2001 From: Paul Abel <128620221+pdabelf5@users.noreply.github.com> Date: Thu, 7 Aug 2025 11:34:15 +0100 Subject: [PATCH 207/244] Update to v3 client (#531) --- go.mod | 2 +- tests/client_no_stream_test.go | 4 ++-- tests/client_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 39fef917..f62a1c16 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/nginx/nginx-plus-go-client/v2 +module github.com/nginx/nginx-plus-go-client/v3 go 1.24.2 diff --git a/tests/client_no_stream_test.go b/tests/client_no_stream_test.go index 2e85fea5..d6ce2f47 100644 --- a/tests/client_no_stream_test.go +++ b/tests/client_no_stream_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "github.com/nginx/nginx-plus-go-client/v2/client" - "github.com/nginx/nginx-plus-go-client/v2/tests/helpers" + "github.com/nginx/nginx-plus-go-client/v3/client" + "github.com/nginx/nginx-plus-go-client/v3/tests/helpers" ) // TestStatsNoStream tests the peculiar behavior of getting Stream-related diff --git a/tests/client_test.go b/tests/client_test.go index aaeed124..0907fc89 100644 --- a/tests/client_test.go +++ b/tests/client_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/nginx/nginx-plus-go-client/v2/client" - "github.com/nginx/nginx-plus-go-client/v2/tests/helpers" + "github.com/nginx/nginx-plus-go-client/v3/client" + "github.com/nginx/nginx-plus-go-client/v3/tests/helpers" ) const ( From ddfbf19f55ca1b9e86430b19c54b8f8efeba6b88 Mon Sep 17 00:00:00 2001 From: Paul Abel <128620221+pdabelf5@users.noreply.github.com> Date: Thu, 7 Aug 2025 15:16:08 +0100 Subject: [PATCH 208/244] Remove community slack announcement (#532) --- .github/workflows/ci.yml | 1 - .goreleaser.yaml | 6 ------ 2 files changed, 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97e8b7d1..b3422e3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -112,5 +112,4 @@ jobs: args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_COMMUNITY }} if: ${{ github.ref_type == 'tag' }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 5753ffc4..0514898c 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -5,11 +5,5 @@ builds: changelog: disable: true -announce: - slack: - enabled: true - channel: "#announcements" - message_template: "NGINX Plus Go Client {{ .Tag }} is out! Check it out: {{ .ReleaseURL }}" - milestones: - close: true From a7b9625cd7fe6c79c2487d6cf07a7447131f309d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 13:48:17 +0100 Subject: [PATCH 209/244] Update dependency goreleaser/goreleaser to v2.11.2 (#533) | datasource | package | from | to | | ----------- | --------------------- | ------- | ------- | | github-tags | goreleaser/goreleaser | v2.11.1 | v2.11.2 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3422e3d..a82f4330 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 with: - version: v2.11.1 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.11.2 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a638254fa695a2de0a5639da7ec9e3f9bba6787a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 12:50:32 +0000 Subject: [PATCH 210/244] Update github/codeql-action action to v3.29.9 (#534) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.29.2 | v3.29.9 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b46f37de..aef3da97 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2 + uses: github/codeql-action/init@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2 + uses: github/codeql-action/analyze@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 7a152edd..c858dd51 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2 + uses: github/codeql-action/upload-sarif@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9 with: sarif_file: results.sarif From 95386239a5102ff8ff7b909e99de8f5d5abd873c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 13:26:23 +0000 Subject: [PATCH 211/244] Update pre-commit hook gitleaks/gitleaks to v8.28.0 (#535) | datasource | package | from | to | | ----------- | ----------------- | ------- | ------- | | github-tags | gitleaks/gitleaks | v8.27.2 | v8.28.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3436174d..bd0ff3dd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.27.2 + rev: v8.28.0 hooks: - id: gitleaks From d0c59a80c8a1f754d28465f6837bb0190c3232c0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 14:11:04 +0000 Subject: [PATCH 212/244] Update pre-commit hook pre-commit/pre-commit-hooks to v6 (#537) | datasource | package | from | to | | ----------- | --------------------------- | ------ | ------ | | github-tags | pre-commit/pre-commit-hooks | v5.0.0 | v6.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd0ff3dd..16067c55 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer From 8154527353cdece86ce66e228b8018326b86c83c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 14:31:24 +0000 Subject: [PATCH 213/244] Update reviewdog/action-actionlint action to v1.66.0 (#536) | datasource | package | from | to | | ----------- | --------------------------- | ------- | ------- | | github-tags | reviewdog/action-actionlint | v1.65.2 | v1.66.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 84d06367..bafb1f5c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Actions - uses: reviewdog/action-actionlint@a5524e1c19e62881d79c1f1b9b6f09f16356e281 # v1.65.2 + uses: reviewdog/action-actionlint@50b75b9513baa71e6a1899a1ebaa9ac9851cf16c # v1.66.0 with: actionlint_flags: -shellcheck "" From 8566ab22256f0ade18765eef2d27e6d0e1ba225d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:01:54 +0100 Subject: [PATCH 214/244] Update reviewdog/action-actionlint action to v1.66.1 (#546) | datasource | package | from | to | | ----------- | --------------------------- | ------- | ------- | | github-tags | reviewdog/action-actionlint | v1.66.0 | v1.66.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bafb1f5c..6a7cecdb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Actions - uses: reviewdog/action-actionlint@50b75b9513baa71e6a1899a1ebaa9ac9851cf16c # v1.66.0 + uses: reviewdog/action-actionlint@e37e2ca68a70112d21e135229272da28ce2d0d5a # v1.66.1 with: actionlint_flags: -shellcheck "" From d1415de0edae373cc5e95443d9aa242afc46c69e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:04:12 +0000 Subject: [PATCH 215/244] Update actions/dependency-review-action action to v4.7.3 (#544) | datasource | package | from | to | | ----------- | -------------------------------- | ------ | ------ | | github-tags | actions/dependency-review-action | v4.7.1 | v4.7.3 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/dependency-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 73022eb2..2759e91a 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -27,6 +27,6 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Dependency Review - uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1 + uses: actions/dependency-review-action@595b5aeba73380359d98a5e087f648dbb0edce1b # v4.7.3 with: config-file: "nginx/k8s-common/dependency-review-config.yml@main" From 82cac80eeb4789a24c24354ef3a48fdf8313cfd4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:11:52 +0000 Subject: [PATCH 216/244] Update github/codeql-action action to v3.30.0 (#545) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.29.9 | v3.30.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index aef3da97..efaaa2e9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9 + uses: github/codeql-action/init@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9 + uses: github/codeql-action/analyze@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index c858dd51..b7a79034 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9 + uses: github/codeql-action/upload-sarif@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0 with: sarif_file: results.sarif From 6ec5720f7c8248c7b22a8f26e5b2b4a5a782465a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:56:48 +0000 Subject: [PATCH 217/244] Update actions/checkout action to v4.3.0 (#538) | datasource | package | from | to | | ----------- | ---------------- | ------ | ------ | | github-tags | actions/checkout | v4.2.2 | v4.3.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependency-review.yml | 2 +- .github/workflows/fossa.yml | 2 +- .github/workflows/labeler.yml | 2 +- .github/workflows/lint.yml | 8 ++++---- .github/workflows/scorecard.yml | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a82f4330..d7b4a5a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: go-version: ["1.22", "1.23", stable] steps: - name: Checkout Repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Setup Golang Environment uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 @@ -57,7 +57,7 @@ jobs: if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Switch Repository (Nightly) if: (github.event_name == 'schedule') diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index efaaa2e9..ec56a12c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -48,7 +48,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Setup Golang Environment uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 2759e91a..10293743 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -24,7 +24,7 @@ jobs: if: ${{ github.event_name != 'merge_group' }} steps: - name: Checkout Repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Dependency Review uses: actions/dependency-review-action@595b5aeba73380359d98a5e087f648dbb0edce1b # v4.7.3 diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index 9cd8da2a..1d4f7bed 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -21,7 +21,7 @@ jobs: if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Scan uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 7d9e31de..f5994ff7 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -12,7 +12,7 @@ jobs: pull-requests: write # for actions/labeler to add labels runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: sparse-checkout: | labeler.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6a7cecdb..67078bf6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Setup Golang Environment uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Lint Actions uses: reviewdog/action-actionlint@e37e2ca68a70112d21e135229272da28ce2d0d5a # v1.66.1 @@ -54,7 +54,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Lint Markdown uses: DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e # v20.0.0 @@ -67,7 +67,7 @@ jobs: name: YAML lint runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Lint YAML uses: reviewdog/action-yamllint@f01d8a48fd8d89f89895499fca2cff09f9e9e8c0 # v1.21.0 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index b7a79034..45d6f4a0 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -26,7 +26,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: persist-credentials: false From 66ceab967ec45b259fe4accc94767dedb9409e10 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:37:48 +0000 Subject: [PATCH 218/244] Update dependency golangci/golangci-lint to v2.4.0 (#539) | datasource | package | from | to | | ----------- | ---------------------- | ------ | ------ | | github-tags | golangci/golangci-lint | v2.3.1 | v2.4.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .pre-commit-config.yaml | 2 +- Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 67078bf6..00d7bd0a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: - version: v2.3.1 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v2.4.0 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 16067c55..8075d36e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v2.3.1 + rev: v2.4.0 hooks: - id: golangci-lint-full diff --git a/Makefile b/Makefile index 8f72c183..39415af4 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v2.3.1 +GOLANGCI_LINT_VERSION = v2.4.0 test: unit-test test-integration test-integration-no-stream-block clean From 4098988e44ffb9a3a5b2780de5a48f105ff1a46d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:55:05 +0000 Subject: [PATCH 219/244] Update golang Docker tag to v1.25 (#540) | datasource | package | from | to | | ---------- | ------- | ---- | ---- | | docker | golang | 1.24 | 1.25 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose.yaml b/compose.yaml index c68d0f67..189267f7 100644 --- a/compose.yaml +++ b/compose.yaml @@ -29,7 +29,7 @@ services: service: nginx test: - image: golang:1.24 + image: golang:1.25 volumes: - type: bind source: ./ From 50961c8b90dda712954066f959f1d7c2cd911984 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 15:00:50 +0000 Subject: [PATCH 220/244] Update goreleaser/goreleaser-action action to v6.4.0 (#541) | datasource | package | from | to | | ----------- | ---------------------------- | ------ | ------ | | github-tags | goreleaser/goreleaser-action | v6.3.0 | v6.4.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7b4a5a2..49f9af5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: if: ${{ github.ref_type == 'tag' }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 + uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 with: version: v2.11.2 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean From 16057c2d6a562a0173a5b37336c261c7c8d60d16 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 15:04:14 +0000 Subject: [PATCH 221/244] Update actions/checkout action to v5 (#542) | datasource | package | from | to | | ----------- | ---------------- | ------ | ------ | | github-tags | actions/checkout | v4.3.0 | v5.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependency-review.yml | 2 +- .github/workflows/fossa.yml | 2 +- .github/workflows/labeler.yml | 2 +- .github/workflows/lint.yml | 8 ++++---- .github/workflows/scorecard.yml | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49f9af5f..31a442bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: go-version: ["1.22", "1.23", stable] steps: - name: Checkout Repository - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Setup Golang Environment uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 @@ -57,7 +57,7 @@ jobs: if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Switch Repository (Nightly) if: (github.event_name == 'schedule') diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ec56a12c..a903b534 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -48,7 +48,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Setup Golang Environment uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 10293743..ea7b119b 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -24,7 +24,7 @@ jobs: if: ${{ github.event_name != 'merge_group' }} steps: - name: Checkout Repository - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Dependency Review uses: actions/dependency-review-action@595b5aeba73380359d98a5e087f648dbb0edce1b # v4.7.3 diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index 1d4f7bed..dff10f4b 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -21,7 +21,7 @@ jobs: if: ${{ github.event.repository.fork == false }} steps: - name: Checkout Repository - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Scan uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index f5994ff7..1d921f04 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -12,7 +12,7 @@ jobs: pull-requests: write # for actions/labeler to add labels runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: sparse-checkout: | labeler.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 00d7bd0a..a0cdf9b4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Setup Golang Environment uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Lint Actions uses: reviewdog/action-actionlint@e37e2ca68a70112d21e135229272da28ce2d0d5a # v1.66.1 @@ -54,7 +54,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout Repository - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Lint Markdown uses: DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e # v20.0.0 @@ -67,7 +67,7 @@ jobs: name: YAML lint runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Lint YAML uses: reviewdog/action-yamllint@f01d8a48fd8d89f89895499fca2cff09f9e9e8c0 # v1.21.0 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 45d6f4a0..ae2e773c 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -26,7 +26,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false From e6bd663123b77affda8512dbc965a79caed473b6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 11:24:24 +0100 Subject: [PATCH 222/244] Update github/codeql-action action to v3.30.3 (#547) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.30.0 | v3.30.3 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a903b534..02382982 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0 + uses: github/codeql-action/init@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0 + uses: github/codeql-action/analyze@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index ae2e773c..e36fe9ae 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0 + uses: github/codeql-action/upload-sarif@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3 with: sarif_file: results.sarif From e9b8c73fe1d673ef80e3f8cf08195ecadd05553c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 13:03:20 +0000 Subject: [PATCH 223/244] Update 8398a7/action-slack action to v3.19.0 (#548) | datasource | package | from | to | | ----------- | ------------------- | ------- | ------- | | github-tags | 8398a7/action-slack | v3.18.0 | v3.19.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/notifications.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/notifications.yml b/.github/workflows/notifications.yml index bb13506e..97519040 100644 --- a/.github/workflows/notifications.yml +++ b/.github/workflows/notifications.yml @@ -44,7 +44,7 @@ jobs: } - name: Send Notification - uses: 8398a7/action-slack@1750b5085f3ec60384090fb7c52965ef822e869e # v3.18.0 + uses: 8398a7/action-slack@77eaa4f1c608a7d68b38af4e3f739dcd8cba273e # v3.19.0 with: status: custom custom_payload: | From 92a9f05cfd82cf6b3ec38302e31e161e9b2de323 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 17:28:17 +0000 Subject: [PATCH 224/244] Update actions/github-script action to v7.1.0 (#549) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | actions/github-script | v7.0.1 | v7.1.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/notifications.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/notifications.yml b/.github/workflows/notifications.yml index 97519040..eac1aea0 100644 --- a/.github/workflows/notifications.yml +++ b/.github/workflows/notifications.yml @@ -23,7 +23,7 @@ jobs: actions: read # for 8398a7/action-slack steps: - name: Data - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 continue-on-error: true id: data with: From 2366e55d50d15ff1767baaeb8fa88bbaabfcc6b5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 10:49:40 +0100 Subject: [PATCH 225/244] Update lucacome/draft-release action to v2 (#559) | datasource | package | from | to | | ----------- | ---------------------- | ------ | ------ | | github-tags | lucacome/draft-release | v1.2.4 | v2.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31a442bc..350bfa34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: run: docker compose up test-no-stream --exit-code-from test-no-stream - name: Create/Update Draft - uses: lucacome/draft-release@00f74370c044c322da6cb52acc707d62c7762c71 # v1.2.4 + uses: lucacome/draft-release@fd099feb33710d1fa27b915a08a7acd6a1fb7fd2 # v2.0.0 id: release-notes with: minor-label: "enhancement" From 6c5e5c7f5e4e8e3a8564ccd69a541b731696487d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 12:37:22 +0000 Subject: [PATCH 226/244] Update actions/stale action to v10 (#557) | datasource | package | from | to | | ----------- | ------------- | ------ | ------- | | github-tags | actions/stale | v9.1.0 | v10.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 3f3b6b90..0455ffda 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,7 +13,7 @@ jobs: pull-requests: write # for actions/stale to close stale PRs runs-on: ubuntu-24.04 steps: - - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0 + - uses: actions/stale@3a9db7e6a41a89f618792c92c0e97cc736e1b13f # v10.0.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: "This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days." From 590280cd707699ff9d5610e8fde0894ee89e6195 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 29 Sep 2025 14:28:34 +0100 Subject: [PATCH 227/244] Update actions/dependency-review-action action to v4.8.0 (#561) | datasource | package | from | to | | ----------- | -------------------------------- | ------ | ------ | | github-tags | actions/dependency-review-action | v4.7.3 | v4.8.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/dependency-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index ea7b119b..019d08b6 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -27,6 +27,6 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Dependency Review - uses: actions/dependency-review-action@595b5aeba73380359d98a5e087f648dbb0edce1b # v4.7.3 + uses: actions/dependency-review-action@56339e523c0409420f6c2c9a2f4292bbb3c07dd3 # v4.8.0 with: config-file: "nginx/k8s-common/dependency-review-config.yml@main" From d796cf386aee97f192aacf5a2ef5c91685570467 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 29 Sep 2025 14:56:38 +0000 Subject: [PATCH 228/244] Update github/codeql-action action to v3.30.5 (#560) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.30.3 | v3.30.5 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 02382982..eabe26fd 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3 + uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3 + uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index e36fe9ae..2ff3af75 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3 + uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5 with: sarif_file: results.sarif From 3e0d2da6174a3ec6437effbaa288e8eaad69e326 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 29 Sep 2025 17:42:36 +0000 Subject: [PATCH 229/244] Update docker/dockerfile Docker tag to v1.18 (#551) | datasource | package | from | to | | ---------- | ----------------- | ---- | ---- | | docker | docker/dockerfile | 1.17 | 1.18 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 5380a7c3..36054e64 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.17 +# syntax=docker/dockerfile:1.18 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " From 1079c36fb0c2c5b9e117df05fd3b0b78a0080345 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 29 Sep 2025 22:54:37 +0000 Subject: [PATCH 230/244] Update dependency goreleaser/goreleaser to v2.12.3 (#550) | datasource | package | from | to | | ----------- | --------------------- | ------- | ------- | | github-tags | goreleaser/goreleaser | v2.11.2 | v2.12.3 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 350bfa34..8d802290 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 with: - version: v2.11.2 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.12.3 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 6eb6146f1d15243073e9560f52d5528583ecd12c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 30 Sep 2025 02:14:13 +0000 Subject: [PATCH 231/244] Update module golang.org/x/sync to v0.17.0 (#552) | datasource | package | from | to | | ---------- | ----------------- | ------- | ------- | | go | golang.org/x/sync | v0.16.0 | v0.17.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f62a1c16..c1a12e69 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/nginx/nginx-plus-go-client/v3 go 1.24.2 -require golang.org/x/sync v0.16.0 +require golang.org/x/sync v0.17.0 diff --git a/go.sum b/go.sum index 878acfe4..c02bc3ef 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= -golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= From 0c78f84f808e28a502e4d99200c578b4e2b58816 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 30 Sep 2025 05:12:35 +0000 Subject: [PATCH 232/244] Update actions/labeler action to v6 (#555) | datasource | package | from | to | | ----------- | --------------- | ------ | ------ | | github-tags | actions/labeler | v5.0.0 | v6.0.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 1d921f04..76280fb1 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -19,7 +19,7 @@ jobs: sparse-checkout-cone-mode: false repository: nginx/k8s-common - - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 + - uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" sync-labels: true From 2224b4db533d585a111e7691963870264e780f65 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 13:33:42 +0100 Subject: [PATCH 233/244] [pre-commit.ci] pre-commit autoupdate (#567) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/golangci/golangci-lint: v2.4.0 → v2.5.0](https://github.com/golangci/golangci-lint/compare/v2.4.0...v2.5.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8075d36e..f45a86af 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v2.4.0 + rev: v2.5.0 hooks: - id: golangci-lint-full From c5dee129e29353bad8f56e6e977aee7e2f784347 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 12:35:51 +0000 Subject: [PATCH 234/244] Update ossf/scorecard-action action to v2.4.3 (#564) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | ossf/scorecard-action | v2.4.2 | v2.4.3 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 2ff3af75..068ab72b 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -31,7 +31,7 @@ jobs: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 + uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 with: results_file: results.sarif results_format: sarif From fc906113d1806e987efa88ad1ff19c8423e859b5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 14:25:06 +0000 Subject: [PATCH 235/244] Update dependency goreleaser/goreleaser to v2.12.5 (#562) | datasource | package | from | to | | ----------- | --------------------- | ------- | ------- | | github-tags | goreleaser/goreleaser | v2.12.3 | v2.12.5 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d802290..4a061c19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 with: - version: v2.12.3 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.12.5 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 63781deab0207889ea5d841adb6ec2dffaf2a765 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 14:26:55 +0000 Subject: [PATCH 236/244] Update github/codeql-action action to v3.30.7 (#563) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.30.5 | v3.30.7 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index eabe26fd..78e5ee3d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5 + uses: github/codeql-action/init@a8d1ac45b9a34d11fe398d5503176af0d06b303e # v3.30.7 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5 + uses: github/codeql-action/analyze@a8d1ac45b9a34d11fe398d5503176af0d06b303e # v3.30.7 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 068ab72b..5aa8b84e 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5 + uses: github/codeql-action/upload-sarif@a8d1ac45b9a34d11fe398d5503176af0d06b303e # v3.30.7 with: sarif_file: results.sarif From 54877780b67659a61e5ce4a69f6e64658ccba0b0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 14:29:07 +0000 Subject: [PATCH 237/244] Update actions/setup-go action to v6 (#556) | datasource | package | from | to | | ----------- | ---------------- | ------ | ------ | | github-tags | actions/setup-go | v5.5.0 | v6.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/lint.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a061c19..9afe2503 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Setup Golang Environment - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version: ${{ matrix.go-version }} @@ -100,7 +100,7 @@ jobs: if: ${{ github.event_name == 'push' }} - name: Setup Golang Environment - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version: stable if: ${{ github.ref_type == 'tag' }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 78e5ee3d..e4c2f6ea 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,7 +51,7 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Setup Golang Environment - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version: stable if: matrix.language == 'go' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a0cdf9b4..b753570c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Setup Golang Environment - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version: stable From 2afb8fdb2faee718b441795a06b9fd933762b770 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 15:04:14 +0000 Subject: [PATCH 238/244] Update docker/dockerfile Docker tag to v1.19 (#566) | datasource | package | from | to | | ---------- | ----------------- | ---- | ---- | | docker | docker/dockerfile | 1.18 | 1.19 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 36054e64..8e7b07b2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.18 +# syntax=docker/dockerfile:1.19 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " From fdaa5a7bf328d83dc34797fb2538196c33e746ec Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 15:23:43 +0000 Subject: [PATCH 239/244] Update actions/stale action to v10.1.0 (#565) | datasource | package | from | to | | ----------- | ------------- | ------- | ------- | | github-tags | actions/stale | v10.0.0 | v10.1.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 0455ffda..71389e86 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,7 +13,7 @@ jobs: pull-requests: write # for actions/stale to close stale PRs runs-on: ubuntu-24.04 steps: - - uses: actions/stale@3a9db7e6a41a89f618792c92c0e97cc736e1b13f # v10.0.0 + - uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: "This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days." From 644b4072571fec7c6aa6a5d370fee3578688bd7a Mon Sep 17 00:00:00 2001 From: Paul Abel <128620221+pdabelf5@users.noreply.github.com> Date: Thu, 9 Oct 2025 11:44:23 +0100 Subject: [PATCH 240/244] Update golangci lint to v2.5.0 (#570) * Update dependency golangci/golangci-lint to v2.5.0 | datasource | package | from | to | | ----------- | ---------------------- | ------ | ------ | | github-tags | golangci/golangci-lint | v2.4.0 | v2.5.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Address linter issue --------- Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- Makefile | 2 +- client/nginx.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b753570c..6b7916b6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: - name: Lint Go uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: - version: v2.4.0 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v2.5.0 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/Makefile b/Makefile index 39415af4..ae4f7742 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v2.4.0 +GOLANGCI_LINT_VERSION = v2.5.0 test: unit-test test-integration test-integration-no-stream-block clean diff --git a/client/nginx.go b/client/nginx.go index e6c9c0ad..a84f3a53 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -1002,7 +1002,7 @@ func determineUpdates(updatedServers []UpstreamServer, nginxServers []UpstreamSe } } - return + return toAdd, toRemove, toUpdate } func (client *NginxClient) getIDOfHTTPServer(ctx context.Context, upstream string, name string) (int, error) { @@ -1376,7 +1376,7 @@ func determineStreamUpdates(updatedServers []StreamUpstreamServer, nginxServers } } - return + return toAdd, toRemove, toUpdate } // GetStats gets process, slab, connection, request, ssl, zone, stream zone, upstream and stream upstream related stats from the NGINX Plus API. From d8803d3908841d23cdccb7b6d271c34da13ae063 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 9 Oct 2025 10:46:24 +0000 Subject: [PATCH 241/244] Update reviewdog/action-actionlint action to v1.67.0 (#553) | datasource | package | from | to | | ----------- | --------------------------- | ------- | ------- | | github-tags | reviewdog/action-actionlint | v1.66.1 | v1.67.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6b7916b6..ae45a4a6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Lint Actions - uses: reviewdog/action-actionlint@e37e2ca68a70112d21e135229272da28ce2d0d5a # v1.66.1 + uses: reviewdog/action-actionlint@95395aac8c053577d0bc67eb7b74936c660c6f66 # v1.67.0 with: actionlint_flags: -shellcheck "" From 259466320c9ad612492be5547270cde4116fbff8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 9 Oct 2025 10:48:23 +0000 Subject: [PATCH 242/244] Update actions/github-script action to v8 (#554) | datasource | package | from | to | | ----------- | --------------------- | ------ | ------ | | github-tags | actions/github-script | v7.1.0 | v8.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/notifications.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/notifications.yml b/.github/workflows/notifications.yml index eac1aea0..22a891b2 100644 --- a/.github/workflows/notifications.yml +++ b/.github/workflows/notifications.yml @@ -23,7 +23,7 @@ jobs: actions: read # for 8398a7/action-slack steps: - name: Data - uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 continue-on-error: true id: data with: From 95894c0ade832c2dd7e1fb7c2b89d559ad505d65 Mon Sep 17 00:00:00 2001 From: Venktesh Shivam Patel Date: Thu, 9 Oct 2025 11:50:14 +0100 Subject: [PATCH 243/244] use go.mod version (#569) --- .github/workflows/ci.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9afe2503..73fe03f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,10 +32,6 @@ jobs: runs-on: ubuntu-24.04 permissions: contents: read - strategy: - fail-fast: false - matrix: - go-version: ["1.22", "1.23", stable] steps: - name: Checkout Repository uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 @@ -43,7 +39,7 @@ jobs: - name: Setup Golang Environment uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: - go-version: ${{ matrix.go-version }} + go-version-file: go.mod - name: Run Unit Tests run: make unit-test @@ -102,7 +98,7 @@ jobs: - name: Setup Golang Environment uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: - go-version: stable + go-version-file: go.mod if: ${{ github.ref_type == 'tag' }} - name: Run GoReleaser From bb2bf90d93f380b82a7f4fb185dc2e913118c565 Mon Sep 17 00:00:00 2001 From: aphralG <108004222+aphralG@users.noreply.github.com> Date: Thu, 9 Oct 2025 11:55:13 +0100 Subject: [PATCH 244/244] Update Connections to handle negative values (#568) * Update connections to allow negative values * fix test naming --- client/nginx.go | 8 +++--- client/nginx_test.go | 60 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/client/nginx.go b/client/nginx.go index a84f3a53..c6b96b32 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -262,10 +262,10 @@ type ExtendedCacheStats struct { // Connections represents connection related stats. type Connections struct { - Accepted uint64 - Dropped uint64 - Active uint64 - Idle uint64 + Accepted int64 + Dropped int64 + Active int64 + Idle int64 } // Slabs is map of slab stats by zone name. diff --git a/client/nginx_test.go b/client/nginx_test.go index 33e6416c..f4fd569f 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -765,6 +765,66 @@ func TestGetStats_NoStreamEndpoint(t *testing.T) { } } +func TestGetStats_Connections(t *testing.T) { + t.Parallel() + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch { + case r.RequestURI == "/": + _, err := w.Write([]byte(`[4, 5, 6, 7, 8, 9]`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + case r.RequestURI == "/8/": + _, err := w.Write([]byte(`["nginx","processes","connections","slabs","http","resolvers","ssl","workers"]`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + case strings.HasPrefix(r.RequestURI, "/8/connections"): + _, err := w.Write([]byte(`{ + "active": -1, + "idle": 3, + "accepted": 5, + "dropped": 2 + }`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + default: + _, err := w.Write([]byte(`{}`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + } + })) + + defer ts.Close() + + // Test creating a new client with a supported API version on the server + client, err := NewNginxClient(ts.URL, WithAPIVersion(8), WithCheckAPI()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if client == nil { + t.Fatalf("client is nil") + } + + stats, err := client.GetStats(context.Background()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + testStats := Connections{ + Accepted: 5, + Dropped: 2, + Active: -1, + Idle: 3, + } + + if !reflect.DeepEqual(stats.Connections, testStats) { + t.Fatalf("Connection stats: expected %v, actual %v", testStats, stats.Connections) + } +} + func TestGetStats_SSL(t *testing.T) { t.Parallel() ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {