From 0d6ada3d19ede34c6e20993f083d81ec533a5627 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 21:30:12 +0000 Subject: [PATCH 1/5] fix(deps): update all non-major dependencies --- .github/workflows/build.yml | 4 +- .github/workflows/codeql-analysis.yml | 10 +- .github/workflows/integration-test.yml | 8 +- .github/workflows/jsonschema.yml | 6 +- .github/workflows/prerelease.yml | 20 +- .github/workflows/publish.yml | 20 +- .github/workflows/reviewdog.yml | 8 +- .github/workflows/spec.yml | 6 +- .github/workflows/test.yml | 6 +- .github/workflows/validate.yml | 4 +- Dockerfile | 2 +- Dockerfile-alpine | 2 +- go.mod | 149 +++++----- go.sum | 378 ++++++++++++------------- 14 files changed, 313 insertions(+), 310 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 465c59c62..bd77e2035 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,10 +16,10 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 28949e8cb..d80a8f323 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -43,10 +43,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" @@ -55,7 +55,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.11 + uses: github/codeql-action/init@45580472a5bb82c4681c4ac726cfdb60060c2ee1 # v3.32.4 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -66,7 +66,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.11 + uses: github/codeql-action/autobuild@45580472a5bb82c4681c4ac726cfdb60060c2ee1 # v3.32.4 # â„šī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -80,4 +80,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.11 + uses: github/codeql-action/analyze@45580472a5bb82c4681c4ac726cfdb60060c2ee1 # v3.32.4 diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 650a42f50..0cad98a45 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -43,10 +43,10 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" @@ -65,10 +65,10 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" diff --git a/.github/workflows/jsonschema.yml b/.github/workflows/jsonschema.yml index 222349cf9..708d98d5c 100644 --- a/.github/workflows/jsonschema.yml +++ b/.github/workflows/jsonschema.yml @@ -19,10 +19,10 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" @@ -34,7 +34,7 @@ jobs: make jsonschema - name: upload jsonschema - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 with: retries: 3 script: | diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 89c6833b6..506087963 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -17,13 +17,13 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 with: # ensures we fetch tag history for the repository fetch-depth: 0 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" @@ -43,14 +43,14 @@ jobs: make build-static-ci - name: login to dockerhub - uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: extract metadata id: meta - uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0 + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 with: images: target/vela-server tags: | @@ -59,7 +59,7 @@ jobs: - name: build and push image id: push - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 with: context: . file: ./Dockerfile @@ -72,13 +72,13 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 with: # ensures we fetch tag history for the repository fetch-depth: 0 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" @@ -98,14 +98,14 @@ jobs: make build-static-ci - name: login to dockerhub - uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: extract metadata id: meta - uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0 + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 with: images: target/vela-server tags: | @@ -114,7 +114,7 @@ jobs: - name: build and push image id: push - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 with: context: . file: ./Dockerfile-alpine diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 203d478ea..479004db2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,13 +16,13 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 with: # ensures we fetch tag history for the repository fetch-depth: 0 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" @@ -37,14 +37,14 @@ jobs: make build-static-ci - name: login to dockerhub - uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: extract metadata id: meta - uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0 + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 with: images: target/vela-server tags: | @@ -53,7 +53,7 @@ jobs: - name: build and push image id: push - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 with: context: . file: ./Dockerfile @@ -66,13 +66,13 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 with: # ensures we fetch tag history for the repository fetch-depth: 0 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" @@ -87,14 +87,14 @@ jobs: make build-static-ci - name: login to dockerhub - uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: extract metadata id: meta - uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0 + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 with: images: target/vela-server tags: | @@ -103,7 +103,7 @@ jobs: - name: build and push image id: push - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 with: context: . file: ./Dockerfile-alpine diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 1ecdc5d19..f0657271f 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -19,10 +19,10 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" @@ -47,10 +47,10 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index d985dbcea..4140e0ee4 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -19,10 +19,10 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" @@ -39,7 +39,7 @@ jobs: make spec - name: upload api spec - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 with: retries: 3 script: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e770da8ca..95576ceae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,10 +20,10 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" @@ -40,7 +40,7 @@ jobs: make test-jsonschema - name: coverage - uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0 + uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 with: use_oidc: true files: coverage.out diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ec4115456..d132de9b8 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -16,10 +16,10 @@ jobs: steps: - name: clone - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 - name: install go - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: # use version from go.mod file go-version-file: "go.mod" diff --git a/Dockerfile b/Dockerfile index 653791174..89c8a3a14 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -FROM alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 as certs +FROM alpine:3.23.3@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659 as certs RUN apk add --update --no-cache ca-certificates diff --git a/Dockerfile-alpine b/Dockerfile-alpine index 20de10c33..a563942c4 100644 --- a/Dockerfile-alpine +++ b/Dockerfile-alpine @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -FROM alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 +FROM alpine:3.23.3@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659 RUN apk add --update --no-cache ca-certificates diff --git a/go.mod b/go.mod index 5582ddb07..e2592c1cc 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/go-vela/server -go 1.24.4 +go 1.25.0 require ( github.com/Bose/minisentinel v0.0.0-20200130220412-917c5a9223bb @@ -8,17 +8,17 @@ require ( github.com/Masterminds/semver/v3 v3.4.0 github.com/Masterminds/sprig/v3 v3.3.0 github.com/adhocore/gronx v1.19.6 - github.com/alicebob/miniredis/v2 v2.35.0 - github.com/aws/aws-sdk-go-v2 v1.39.6 - github.com/aws/aws-sdk-go-v2/config v1.31.17 - github.com/aws/aws-sdk-go-v2/service/sts v1.39.1 + github.com/alicebob/miniredis/v2 v2.36.1 + github.com/aws/aws-sdk-go-v2 v1.41.2 + github.com/aws/aws-sdk-go-v2/config v1.32.10 + github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 github.com/distribution/reference v0.6.0 github.com/drone/envsubst v1.0.3 - github.com/expr-lang/expr v1.17.7 + github.com/expr-lang/expr v1.17.8 github.com/ghodss/yaml v1.0.0 - github.com/gin-gonic/gin v1.10.1 + github.com/gin-gonic/gin v1.11.0 github.com/go-playground/assert/v2 v2.2.0 - github.com/golang-jwt/jwt/v5 v5.3.0 + github.com/golang-jwt/jwt/v5 v5.3.1 github.com/google/go-cmp v0.7.0 github.com/google/go-github/v81 v81.0.0 github.com/google/uuid v1.6.0 @@ -26,84 +26,86 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-retryablehttp v0.7.8 - github.com/hashicorp/vault/api v1.20.0 + github.com/hashicorp/vault/api v1.22.0 github.com/invopop/jsonschema v0.13.0 github.com/joho/godotenv v1.5.1 - github.com/lestrrat-go/jwx/v3 v3.0.10 - github.com/lib/pq v1.10.9 + github.com/lestrrat-go/jwx/v3 v3.0.13 + github.com/lib/pq v1.11.2 github.com/microcosm-cc/bluemonday v1.0.27 - github.com/minio/minio-go/v7 v7.0.83 - github.com/prometheus/client_golang v1.23.0 - github.com/redis/go-redis/v9 v9.12.1 - github.com/sirupsen/logrus v1.9.3 - github.com/spf13/afero v1.14.0 + github.com/minio/minio-go/v7 v7.0.98 + github.com/prometheus/client_golang v1.23.2 + github.com/redis/go-redis/v9 v9.18.0 + github.com/sirupsen/logrus v1.9.4 + github.com/spf13/afero v1.15.0 github.com/uptrace/opentelemetry-go-extra/otelgorm v0.3.2 - github.com/urfave/cli/v3 v3.4.1 - go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.62.0 - go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.62.0 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 - go.opentelemetry.io/otel v1.37.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 - go.opentelemetry.io/otel/sdk v1.37.0 - go.opentelemetry.io/otel/trace v1.37.0 - go.starlark.net v0.0.0-20250826212936-2a4f36945129 + github.com/urfave/cli/v3 v3.6.2 + go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.65.0 + go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.65.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 + go.opentelemetry.io/otel v1.40.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 + go.opentelemetry.io/otel/sdk v1.40.0 + go.opentelemetry.io/otel/trace v1.40.0 + go.starlark.net v0.0.0-20260210143700-b62fd896b91b go.yaml.in/yaml/v3 v3.0.4 - golang.org/x/crypto v0.45.0 - golang.org/x/oauth2 v0.30.0 - golang.org/x/sync v0.18.0 - golang.org/x/time v0.12.0 + golang.org/x/crypto v0.48.0 + golang.org/x/oauth2 v0.35.0 + golang.org/x/sync v0.19.0 + golang.org/x/time v0.14.0 gorm.io/driver/postgres v1.6.0 gorm.io/driver/sqlite v1.6.0 - gorm.io/gorm v1.30.2 - k8s.io/apimachinery v0.34.0 + gorm.io/gorm v1.31.1 + k8s.io/apimachinery v0.35.1 ) require ( dario.cat/mergo v1.0.1 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/PuerkitoBio/purell v1.2.1 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.18.21 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.19.10 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.30.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.5 // indirect - github.com/aws/smithy-go v1.23.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 // indirect + github.com/aws/smithy-go v1.24.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect - github.com/bytedance/sonic v1.13.3 // indirect - github.com/bytedance/sonic/loader v0.2.4 // indirect + github.com/bytedance/gopkg v0.1.3 // indirect + github.com/bytedance/sonic v1.15.0 // indirect + github.com/bytedance/sonic/loader v0.5.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect - github.com/cenkalti/backoff/v5 v5.0.2 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cloudwego/base64x v0.1.5 // indirect + github.com/cloudwego/base64x v0.1.6 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.9 // indirect + github.com/gabriel-vasile/mimetype v1.4.13 // indirect github.com/gin-contrib/sse v1.1.0 // indirect github.com/go-ini/ini v1.67.0 // indirect - github.com/go-jose/go-jose/v4 v4.1.0 // indirect + github.com/go-jose/go-jose/v4 v4.1.3 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.26.0 // indirect + github.com/go-playground/validator/v10 v10.30.1 // indirect github.com/goccy/go-json v0.10.5 // indirect - github.com/gogo/protobuf v1.3.2 // indirect + github.com/goccy/go-yaml v1.19.2 // indirect github.com/gomodule/redigo v2.0.0+incompatible // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/gorilla/css v1.0.1 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0 // indirect @@ -118,17 +120,18 @@ require ( github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.18.0 // indirect - github.com/klauspost/cpuid/v2 v2.2.11 // indirect + github.com/klauspost/compress v1.18.2 // indirect + github.com/klauspost/cpuid/v2 v2.3.0 // indirect + github.com/klauspost/crc32 v1.3.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/lestrrat-go/blackmagic v1.0.4 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect - github.com/lestrrat-go/httprc/v3 v3.0.0 // indirect - github.com/lestrrat-go/option v1.0.1 // indirect + github.com/lestrrat-go/httprc/v3 v3.0.2 // indirect github.com/lestrrat-go/option/v2 v2.0.0 // indirect github.com/mailru/easyjson v0.9.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.28 // indirect + github.com/minio/crc64nvme v1.1.1 // indirect github.com/minio/md5-simd v1.1.2 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -139,36 +142,42 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect + github.com/philhofer/fwd v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.65.0 // indirect + github.com/prometheus/common v0.66.1 // indirect github.com/prometheus/procfs v0.16.1 // indirect + github.com/quic-go/qpack v0.6.0 // indirect + github.com/quic-go/quic-go v0.59.0 // indirect github.com/rs/xid v1.6.0 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect - github.com/segmentio/asm v1.2.0 // indirect + github.com/segmentio/asm v1.2.1 // indirect github.com/shopspring/decimal v1.4.0 // indirect github.com/spf13/cast v1.8.0 // indirect + github.com/tinylib/msgp v1.6.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.3.0 // indirect + github.com/ugorji/go/codec v1.3.1 // indirect github.com/uptrace/opentelemetry-go-extra/otelsql v0.3.2 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/yuin/gopher-lua v1.1.1 // indirect - go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/proto/otlp v1.7.0 // indirect - golang.org/x/arch v0.18.0 // indirect - golang.org/x/net v0.47.0 // indirect - golang.org/x/sys v0.38.0 // indirect - golang.org/x/text v0.31.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect - google.golang.org/grpc v1.73.0 // indirect - google.golang.org/protobuf v1.36.6 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/otel/metric v1.40.0 // indirect + go.opentelemetry.io/proto/otlp v1.9.0 // indirect + go.uber.org/atomic v1.11.0 // indirect + go.yaml.in/yaml/v2 v2.4.3 // indirect + golang.org/x/arch v0.23.0 // indirect + golang.org/x/net v0.49.0 // indirect + golang.org/x/sys v0.41.0 // indirect + golang.org/x/text v0.34.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect + google.golang.org/grpc v1.78.0 // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect - sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect + k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect + sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/randfill v1.0.0 // indirect ) diff --git a/go.sum b/go.sum index b7981a5a9..133cfd31c 100644 --- a/go.sum +++ b/go.sum @@ -20,34 +20,36 @@ github.com/adhocore/gronx v1.19.6 h1:5KNVcoR9ACgL9HhEqCm5QXsab/gI4QDIybTAWcXDKDc github.com/adhocore/gronx v1.19.6/go.mod h1:7oUY1WAU8rEJWmAxXR2DN0JaO4gi9khSgKjiRypqteg= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis/v2 v2.11.1/go.mod h1:UA48pmi7aSazcGAvcdKcBB49z521IC9VjTTRz2nIaJE= -github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI= -github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM= -github.com/aws/aws-sdk-go-v2 v1.39.6 h1:2JrPCVgWJm7bm83BDwY5z8ietmeJUbh3O2ACnn+Xsqk= -github.com/aws/aws-sdk-go-v2 v1.39.6/go.mod h1:c9pm7VwuW0UPxAEYGyTmyurVcNrbF6Rt/wixFqDhcjE= -github.com/aws/aws-sdk-go-v2/config v1.31.17 h1:QFl8lL6RgakNK86vusim14P2k8BFSxjvUkcWLDjgz9Y= -github.com/aws/aws-sdk-go-v2/config v1.31.17/go.mod h1:V8P7ILjp/Uef/aX8TjGk6OHZN6IKPM5YW6S78QnRD5c= -github.com/aws/aws-sdk-go-v2/credentials v1.18.21 h1:56HGpsgnmD+2/KpG0ikvvR8+3v3COCwaF4r+oWwOeNA= -github.com/aws/aws-sdk-go-v2/credentials v1.18.21/go.mod h1:3YELwedmQbw7cXNaII2Wywd+YY58AmLPwX4LzARgmmA= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13 h1:T1brd5dR3/fzNFAQch/iBKeX07/ffu/cLu+q+RuzEWk= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13/go.mod h1:Peg/GBAQ6JDt+RoBf4meB1wylmAipb7Kg2ZFakZTlwk= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 h1:a+8/MLcWlIxo1lF9xaGt3J/u3yOZx+CdSveSNwjhD40= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13/go.mod h1:oGnKwIYZ4XttyU2JWxFrwvhF6YKiK/9/wmE3v3Iu9K8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 h1:HBSI2kDkMdWz4ZM7FjwE7e/pWDEZ+nR95x8Ztet1ooY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13/go.mod h1:YE94ZoDArI7awZqJzBAZ3PDD2zSfuP7w6P2knOzIn8M= +github.com/alicebob/miniredis/v2 v2.36.1 h1:Dvc5oAnNOr7BIfPn7tF269U8DvRW1dBG2D5n0WrfYMI= +github.com/alicebob/miniredis/v2 v2.36.1/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM= +github.com/aws/aws-sdk-go-v2 v1.41.2 h1:LuT2rzqNQsauaGkPK/7813XxcZ3o3yePY0Iy891T2ls= +github.com/aws/aws-sdk-go-v2 v1.41.2/go.mod h1:IvvlAZQXvTXznUPfRVfryiG1fbzE2NGK6m9u39YQ+S4= +github.com/aws/aws-sdk-go-v2/config v1.32.10 h1:9DMthfO6XWZYLfzZglAgW5Fyou2nRI5CuV44sTedKBI= +github.com/aws/aws-sdk-go-v2/config v1.32.10/go.mod h1:2rUIOnA2JaiqYmSKYmRJlcMWy6qTj1vuRFscppSBMcw= +github.com/aws/aws-sdk-go-v2/credentials v1.19.10 h1:EEhmEUFCE1Yhl7vDhNOI5OCL/iKMdkkYFTRpZXNw7m8= +github.com/aws/aws-sdk-go-v2/credentials v1.19.10/go.mod h1:RnnlFCAlxQCkN2Q379B67USkBMu1PipEEiibzYN5UTE= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 h1:Ii4s+Sq3yDfaMLpjrJsqD6SmG/Wq/P5L/hw2qa78UAY= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18/go.mod h1:6x81qnY++ovptLE6nWQeWrpXxbnlIex+4H4eYYGcqfc= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 h1:F43zk1vemYIqPAwhjTjYIz0irU2EY7sOb/F5eJ3HuyM= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18/go.mod h1:w1jdlZXrGKaJcNoL+Nnrj+k5wlpGXqnNrKoP22HvAug= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 h1:xCeWVjj0ki0l3nruoyP2slHsGArMxeiiaoPN5QZH6YQ= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18/go.mod h1:r/eLGuGCBw6l36ZRWiw6PaZwPXb6YOj+i/7MizNl5/k= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 h1:x2Ibm/Af8Fi+BH+Hsn9TXGdT+hKbDd5XOTZxTMxDk7o= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3/go.mod h1:IW1jwyrQgMdhisceG8fQLmQIydcT/jWY21rFhzgaKwo= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13 h1:kDqdFvMY4AtKoACfzIGD8A0+hbT41KTKF//gq7jITfM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13/go.mod h1:lmKuogqSU3HzQCwZ9ZtcqOc5XGMqtDK7OIc2+DxiUEg= -github.com/aws/aws-sdk-go-v2/service/sso v1.30.1 h1:0JPwLz1J+5lEOfy/g0SURC9cxhbQ1lIMHMa+AHZSzz0= -github.com/aws/aws-sdk-go-v2/service/sso v1.30.1/go.mod h1:fKvyjJcz63iL/ftA6RaM8sRCtN4r4zl4tjL3qw5ec7k= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.5 h1:OWs0/j2UYR5LOGi88sD5/lhN6TDLG6SfA7CqsQO9zF0= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.5/go.mod h1:klO+ejMvYsB4QATfEOIXk8WAEwN4N0aBfJpvC+5SZBo= -github.com/aws/aws-sdk-go-v2/service/sts v1.39.1 h1:mLlUgHn02ue8whiR4BmxxGJLR2gwU6s6ZzJ5wDamBUs= -github.com/aws/aws-sdk-go-v2/service/sts v1.39.1/go.mod h1:E19xDjpzPZC7LS2knI9E6BaRFDK43Eul7vd6rSq2HWk= -github.com/aws/smithy-go v1.23.2 h1:Crv0eatJUQhaManss33hS5r40CG3ZFH+21XSkqMrIUM= -github.com/aws/smithy-go v1.23.2/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 h1:CeY9LUdur+Dxoeldqoun6y4WtJ3RQtzk0JMP2gfUay0= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5/go.mod h1:AZLZf2fMaahW5s/wMRciu1sYbdsikT/UHwbUjOdEVTc= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 h1:LTRCYFlnnKFlKsyIQxKhJuDuA3ZkrDQMRYm6rXiHlLY= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18/go.mod h1:XhwkgGG6bHSd00nO/mexWTcTjgd6PjuvWQMqSn2UaEk= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 h1:MzORe+J94I+hYu2a6XmV5yC9huoTv8NRcCrUNedDypQ= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.6/go.mod h1:hXzcHLARD7GeWnifd8j9RWqtfIgxj4/cAtIVIK7hg8g= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 h1:7oGD8KPfBOJGXiCoRKrrrQkbvCp8N++u36hrLMPey6o= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.11/go.mod h1:0DO9B5EUJQlIDif+XJRWCljZRKsAFKh3gpFz7UnDtOo= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 h1:edCcNp9eGIUDUCrzoCu1jWAXLGFIizeqkdkKgRlJwWc= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15/go.mod h1:lyRQKED9xWfgkYC/wmmYfv7iVIM68Z5OQ88ZdcV1QbU= +github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 h1:NITQpgo9A5NrDZ57uOWj+abvXSb83BbyggcUBVksN7c= +github.com/aws/aws-sdk-go-v2/service/sts v1.41.7/go.mod h1:sks5UWBhEuWYDPdwlnRFn1w7xWdH29Jcpe+/PJQefEs= +github.com/aws/smithy-go v1.24.1 h1:VbyeNfmYkWoxMVpGUAbQumkODcYmfMRfZ8yQiH30SK0= +github.com/aws/smithy-go v1.24.1/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= @@ -60,23 +62,23 @@ github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= -github.com/bytedance/sonic v1.13.3 h1:MS8gmaH16Gtirygw7jV91pDCN33NyMrPbN7qiYhEsF0= -github.com/bytedance/sonic v1.13.3/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= -github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY= -github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= +github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M= +github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM= +github.com/bytedance/sonic v1.15.0 h1:/PXeWFaR5ElNcVE84U0dOHjiMHQOwNIx3K4ymzh/uSE= +github.com/bytedance/sonic v1.15.0/go.mod h1:tFkWrPz0/CUCLEF4ri4UkHekCIcdnkqXw9VduqpJh0k= +github.com/bytedance/sonic/loader v0.5.0 h1:gXH3KVnatgY7loH5/TkeVyXPfESoqSBSBEiDd5VjlgE= +github.com/bytedance/sonic/loader v0.5.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8= -github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= -github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= -github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= +github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -91,28 +93,28 @@ github.com/drone/envsubst v1.0.3 h1:PCIBwNDYjs50AsLZPYdfhSATKaRg/FJmDc2D6+C2x8g= github.com/drone/envsubst v1.0.3/go.mod h1:N2jZmlMufstn1KEqvbHjw40h1KyTmnVzHcSc9bFiJ2g= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/expr-lang/expr v1.17.7 h1:Q0xY/e/2aCIp8g9s/LGvMDCC5PxYlvHgDZRQ4y16JX8= -github.com/expr-lang/expr v1.17.7/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/expr-lang/expr v1.17.8 h1:W1loDTT+0PQf5YteHSTpju2qfUfNoBt4yw9+wOEU9VM= +github.com/expr-lang/expr v1.17.8/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= -github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= -github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok= +github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM= +github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= -github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ= -github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk= +github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= -github.com/go-jose/go-jose/v4 v4.1.0 h1:cYSYxd3pw5zd2FSXk2vGdn9igQU2PS8MuxrCOCl0FdY= -github.com/go-jose/go-jose/v4 v4.1.0/go.mod h1:GG/vqmYm3Von2nYiB2vGTXzdoNKE5tix5tuc6iAd+sw= +github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs= +github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -124,16 +126,16 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= -github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= -github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= -github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-playground/validator/v10 v10.30.1 h1:f3zDSN/zOma+w6+1Wswgd9fLkdwy06ntQJp0BBvFG0w= +github.com/go-playground/validator/v10 v10.30.1/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM= +github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= +github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= -github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= +github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/gomodule/redigo v1.7.1-0.20190322064113-39e2c31b7ca3/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= @@ -155,8 +157,8 @@ github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= github.com/goware/urlx v0.3.2 h1:gdoo4kBHlkqZNaf6XlQ12LGtQOmpKJrR04Rc3RnpJEo= github.com/goware/urlx v0.3.2/go.mod h1:h8uwbJy68o+tQXCGZNa9D73WN8n0r9OBae5bUnLcgjw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 h1:X+2YciYSxvMQK0UZ7sg45ZVabVZBeBuvMkmuI2V3Fak= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7/go.mod h1:lW34nIZuQ8UDPdkon5fmfp2l3+ZkQ2me/+oecHYLOII= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -178,8 +180,8 @@ github.com/hashicorp/go-sockaddr v1.0.7 h1:G+pTkSO01HpR5qCxg7lxfsFEZaG+C0VssTy/9 github.com/hashicorp/go-sockaddr v1.0.7/go.mod h1:FZQbEYa1pxkQ7WLpyXJ6cbjpT8q0YgQaK/JakXqGyWw= github.com/hashicorp/hcl v1.0.1-vault-7 h1:ag5OxFVy3QYTFTJODRzTKVZ6xvdfLLCA1cy/Y6xGI0I= github.com/hashicorp/hcl v1.0.1-vault-7/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= -github.com/hashicorp/vault/api v1.20.0 h1:KQMHElgudOsr+IbJgmbjHnCTxEpKs9LnozA1D3nozU4= -github.com/hashicorp/vault/api v1.20.0/go.mod h1:GZ4pcjfzoOWpkJ3ijHNpEoAxKEsBJnVljyTe3jM2Sms= +github.com/hashicorp/vault/api v1.22.0 h1:+HYFquE35/B74fHoIeXlZIP2YADVboaPjaSicHEZiH0= +github.com/hashicorp/vault/api v1.22.0/go.mod h1:IUZA2cDvr4Ok3+NtK2Oq/r+lJeXkeCrHRmqdyWfpmGM= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E= @@ -200,16 +202,14 @@ github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE= -github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= -github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk= +github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU= -github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= -github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= +github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/klauspost/crc32 v1.3.0 h1:sSmTt3gUt81RP655XGZPElI0PelVTZ6YwCRnPSupoFM= +github.com/klauspost/crc32 v1.3.0/go.mod h1:D7kQaZhnkX/Y0tstFGf8VUzv2UofNGqCjnC3zdHB0Hw= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -220,34 +220,38 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lestrrat-go/blackmagic v1.0.4 h1:IwQibdnf8l2KoO+qC3uT4OaTWsW7tuRQXy9TRN9QanA= github.com/lestrrat-go/blackmagic v1.0.4/go.mod h1:6AWFyKNNj0zEXQYfTMPfZrAXUWUfTIZ5ECEUEJaijtw= +github.com/lestrrat-go/dsig v1.0.0 h1:OE09s2r9Z81kxzJYRn07TFM9XA4akrUdoMwr0L8xj38= +github.com/lestrrat-go/dsig v1.0.0/go.mod h1:dEgoOYYEJvW6XGbLasr8TFcAxoWrKlbQvmJgCR0qkDo= +github.com/lestrrat-go/dsig-secp256k1 v1.0.0 h1:JpDe4Aybfl0soBvoVwjqDbp+9S1Y2OM7gcrVVMFPOzY= +github.com/lestrrat-go/dsig-secp256k1 v1.0.0/go.mod h1:CxUgAhssb8FToqbL8NjSPoGQlnO4w3LG1P0qPWQm/NU= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= -github.com/lestrrat-go/httprc/v3 v3.0.0 h1:nZUx/zFg5uc2rhlu1L1DidGr5Sj02JbXvGSpnY4LMrc= -github.com/lestrrat-go/httprc/v3 v3.0.0/go.mod h1:k2U1QIiyVqAKtkffbg+cUmsyiPGQsb9aAfNQiNFuQ9Q= -github.com/lestrrat-go/jwx/v3 v3.0.10 h1:XuoCBhZBncRIjMQ32HdEc76rH0xK/Qv2wq5TBouYJDw= -github.com/lestrrat-go/jwx/v3 v3.0.10/go.mod h1:kNMedLgTpHvPJkK5EMVa1JFz+UVyY2dMmZKu3qjl/Pk= -github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= -github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= +github.com/lestrrat-go/httprc/v3 v3.0.2 h1:7u4HUaD0NQbf2/n5+fyp+T10hNCsAnwKfqn4A4Baif0= +github.com/lestrrat-go/httprc/v3 v3.0.2/go.mod h1:mSMtkZW92Z98M5YoNNztbRGxbXHql7tSitCvaxvo9l0= +github.com/lestrrat-go/jwx/v3 v3.0.13 h1:AdHKiPIYeCSnOJtvdpipPg/0SuFh9rdkN+HF3O0VdSk= +github.com/lestrrat-go/jwx/v3 v3.0.13/go.mod h1:2m0PV1A9tM4b/jVLMx8rh6rBl7F6WGb3EG2hufN9OQU= github.com/lestrrat-go/option/v2 v2.0.0 h1:XxrcaJESE1fokHy3FpaQ/cXW8ZsIdWcdFzzLOcID3Ss= github.com/lestrrat-go/option/v2 v2.0.0/go.mod h1:oSySsmzMoR0iRzCDCaUfsCzxQHUEuhOViQObyy7S6Vg= -github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= -github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.11.2 h1:x6gxUeu39V0BHZiugWe8LXZYZ+Utk7hSJGThs8sdzfs= +github.com/lib/pq v1.11.2/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A= github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= +github.com/minio/crc64nvme v1.1.1 h1:8dwx/Pz49suywbO+auHCBpCtlW1OfpcLN7wYgVR6wAI= +github.com/minio/crc64nvme v1.1.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= -github.com/minio/minio-go/v7 v7.0.83 h1:W4Kokksvlz3OKf3OqIlzDNKd4MERlC2oN8YptwJ0+GA= -github.com/minio/minio-go/v7 v7.0.83/go.mod h1:57YXpvc5l3rjPdhqNrDsvVlY0qPI6UTk1bflAe+9doY= +github.com/minio/minio-go/v7 v7.0.98 h1:MeAVKjLVz+XJ28zFcuYyImNSAh8Mq725uNW4beRisi0= +github.com/minio/minio-go/v7 v7.0.98/go.mod h1:cY0Y+W7yozf0mdIclrttzo1Iiu7mEf9y7nk2uXqMOvM= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -268,157 +272,148 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= +github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.23.0 h1:ust4zpdl9r4trLY/gSjlm07PuiBq2ynaXXlptpfy8Uc= -github.com/prometheus/client_golang v1.23.0/go.mod h1:i/o0R9ByOnHX0McrTMTyhYvKE4haaf2mW08I+jGAjEE= +github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= +github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2VzE= -github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= +github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= +github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= -github.com/redis/go-redis/v9 v9.12.1 h1:k5iquqv27aBtnTm2tIkROUDp8JBXhXZIVu1InSgvovg= -github.com/redis/go-redis/v9 v9.12.1/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw= -github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= -github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8= +github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII= +github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SAw= +github.com/quic-go/quic-go v0.59.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU= +github.com/redis/go-redis/v9 v9.18.0 h1:pMkxYPkEbMPwRdenAzUNyFNrDgHx9U+DrBabWNfSRQs= +github.com/redis/go-redis/v9 v9.18.0/go.mod h1:k3ufPphLU5YXwNTUcCRXGxUoF1fqxnhFQmscfkCoDA0= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= -github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= -github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= +github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0= +github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA= -github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo= +github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w= +github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g= +github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= +github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= github.com/spf13/cast v1.8.0 h1:gEN9K4b8Xws4EX0+a0reLmhq8moKn7ntRlQYgjPeCDk= github.com/spf13/cast v1.8.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/tinylib/msgp v1.6.1 h1:ESRv8eL3u+DNHUoSAAQRE50Hm162zqAnBoGv9PzScPY= +github.com/tinylib/msgp v1.6.1/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA= -github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= +github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY= +github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= github.com/uptrace/opentelemetry-go-extra/otelgorm v0.3.2 h1:Jjn3zoRz13f8b1bR6LrXWglx93Sbh4kYfwgmPju3E2k= github.com/uptrace/opentelemetry-go-extra/otelgorm v0.3.2/go.mod h1:wocb5pNrj/sjhWB9J5jctnC0K2eisSdz/nJJBNFHo+A= github.com/uptrace/opentelemetry-go-extra/otelsql v0.3.2 h1:ZjUj9BLYf9PEqBn8W/OapxhPjVRdC6CsXTdULHsyk5c= github.com/uptrace/opentelemetry-go-extra/otelsql v0.3.2/go.mod h1:O8bHQfyinKwTXKkiKNGmLQS7vRsqRxIQTFZpYpHK3IQ= -github.com/urfave/cli/v3 v3.4.1 h1:1M9UOCy5bLmGnuu1yn3t3CB4rG79Rtoxuv1sPhnm6qM= -github.com/urfave/cli/v3 v3.4.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo= -github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ= -github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= +github.com/urfave/cli/v3 v3.6.2 h1:lQuqiPrZ1cIz8hz+HcrG0TNZFxU70dPZ3Yl+pSrH9A8= +github.com/urfave/cli/v3 v3.6.2/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= +github.com/valyala/fastjson v1.6.7 h1:ZE4tRy0CIkh+qDc5McjatheGX2czdn8slQjomexVpBM= +github.com/valyala/fastjson v1.6.7/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/gopher-lua v0.0.0-20190206043414-8bfc7677f583/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= github.com/yuin/gopher-lua v0.0.0-20191213034115-f46add6fdb5c/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= -go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= -go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.62.0 h1:fZNpsQuTwFFSGC96aJexNOBrCD7PjD9Tm/HyHtXhmnk= -go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.62.0/go.mod h1:+NFxPSeYg0SoiRUO4k0ceJYMCY9FiRbYFmByUpm7GJY= -go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.62.0 h1:wCeciVlAfb5DC8MQl/DlmAv/FVPNpQgFvI/71+hatuc= -go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.62.0/go.mod h1:WfEApdZDMlLUAev/0QQpr8EJ/z0VWDKYZ5tF5RH5T1U= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 h1:Hf9xI/XLML9ElpiHVDNwvqI0hIFlzV8dgIr35kV1kRU= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0/go.mod h1:NfchwuyNoMcZ5MLHwPrODwUF1HWCXWrL31s8gSAdIKY= -go.opentelemetry.io/contrib/propagators/b3 v1.37.0 h1:0aGKdIuVhy5l4GClAjl72ntkZJhijf2wg1S7b5oLoYA= -go.opentelemetry.io/contrib/propagators/b3 v1.37.0/go.mod h1:nhyrxEJEOQdwR15zXrCKI6+cJK60PXAkJ/jRyfhr2mg= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 h1:Ahq7pZmv87yiyn3jeFz/LekZmPLLdKejuO3NcK9MssM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0/go.mod h1:MJTqhM0im3mRLw1i8uGHnCvUEeS7VwRyxlLC78PA18M= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 h1:bDMKF3RUSxshZ5OjOTi8rsHGaPKsAt76FaqgvIUySLc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0/go.mod h1:dDT67G/IkA46Mr2l9Uj7HsQVwsjASyV9SjGofsiUZDA= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0 h1:SNhVp/9q4Go/XHBkQ1/d5u9P/U+L1yaGPoi0x+mStaI= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0/go.mod h1:tx8OOlGH6R4kLV67YaYO44GFXloEjGPZuMjEkaaqIp4= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc= -go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= -go.opentelemetry.io/proto/otlp v1.7.0 h1:jX1VolD6nHuFzOYso2E73H85i92Mv8JQYk0K9vz09os= -go.opentelemetry.io/proto/otlp v1.7.0/go.mod h1:fSKjH6YJ7HDlwzltzyMj036AJ3ejJLCgCSHGj4efDDo= -go.starlark.net v0.0.0-20250826212936-2a4f36945129 h1:YZ5gQdgswYWAsZfzXQOzH7l8guQQd7yyIzLZ19LIFrQ= -go.starlark.net v0.0.0-20250826212936-2a4f36945129/go.mod h1:YKMCv9b1WrfWmeqdV5MAuEHWsu5iC+fe6kYl2sQjdI8= +github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= +github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.65.0 h1:LSJsvNqhj2sBNFb5NWHbyDK4QJ/skQ2ydjeOZ9OYNZ4= +go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.65.0/go.mod h1:0Q5ocj6h/+C6KYq8cnl4tDFVd4I1HBdsJ440aeagHos= +go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.65.0 h1:ab5U7DpTjjN8pNgwqlA/s0Csb+N2Raqo9eTSDhfg4Z8= +go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.65.0/go.mod h1:nwFJC46Dxhqz5R9k7IV8To/Z46JPvW+GNKhTxQQlUzg= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 h1:7iP2uCb7sGddAr30RRS6xjKy7AZ2JtTOPA3oolgVSw8= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0/go.mod h1:c7hN3ddxs/z6q9xwvfLPk+UHlWRQyaeR1LdgfL/66l0= +go.opentelemetry.io/contrib/propagators/b3 v1.40.0 h1:xariChe8OOVF3rNlfzGFgQc61npQmXhzZj/i82mxMfg= +go.opentelemetry.io/contrib/propagators/b3 v1.40.0/go.mod h1:72WvbdxbOfXaELEQfonFfOL6osvcVjI7uJEE8C2nkrs= +go.opentelemetry.io/otel v1.40.0 h1:oA5YeOcpRTXq6NN7frwmwFR0Cn3RhTVZvXsP4duvCms= +go.opentelemetry.io/otel v1.40.0/go.mod h1:IMb+uXZUKkMXdPddhwAHm6UfOwJyh4ct1ybIlV14J0g= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 h1:QKdN8ly8zEMrByybbQgv8cWBcdAarwmIPZ6FThrWXJs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0/go.mod h1:bTdK1nhqF76qiPoCCdyFIV+N/sRHYXYCTQc+3VCi3MI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 h1:wVZXIWjQSeSmMoxF74LzAnpVQOAFDo3pPji9Y4SOFKc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0/go.mod h1:khvBS2IggMFNwZK/6lEeHg/W57h/IX6J4URh57fuI40= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.40.0 h1:MzfofMZN8ulNqobCmCAVbqVL5syHw+eB2qPRkCMA/fQ= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.40.0/go.mod h1:E73G9UFtKRXrxhBsHtG00TB5WxX57lpsQzogDkqBTz8= +go.opentelemetry.io/otel/metric v1.40.0 h1:rcZe317KPftE2rstWIBitCdVp89A2HqjkxR3c11+p9g= +go.opentelemetry.io/otel/metric v1.40.0/go.mod h1:ib/crwQH7N3r5kfiBZQbwrTge743UDc7DTFVZrrXnqc= +go.opentelemetry.io/otel/sdk v1.40.0 h1:KHW/jUzgo6wsPh9At46+h4upjtccTmuZCFAc9OJ71f8= +go.opentelemetry.io/otel/sdk v1.40.0/go.mod h1:Ph7EFdYvxq72Y8Li9q8KebuYUr2KoeyHx0DRMKrYBUE= +go.opentelemetry.io/otel/sdk/metric v1.40.0 h1:mtmdVqgQkeRxHgRv4qhyJduP3fYJRMX4AtAlbuWdCYw= +go.opentelemetry.io/otel/sdk/metric v1.40.0/go.mod h1:4Z2bGMf0KSK3uRjlczMOeMhKU2rhUqdWNoKcYrtcBPg= +go.opentelemetry.io/otel/trace v1.40.0 h1:WA4etStDttCSYuhwvEa8OP8I5EWu24lkOzp+ZYblVjw= +go.opentelemetry.io/otel/trace v1.40.0/go.mod h1:zeAhriXecNGP/s2SEG3+Y8X9ujcJOTqQ5RgdEJcawiA= +go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= +go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= +go.starlark.net v0.0.0-20260210143700-b62fd896b91b h1:mDO9/2PuBcapqFbhiCmFcEQZvlQnk3ILEZR+a8NL1z4= +go.starlark.net v0.0.0-20260210143700-b62fd896b91b/go.mod h1:YKMCv9b1WrfWmeqdV5MAuEHWsu5iC+fe6kYl2sQjdI8= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= -go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= +go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= +go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= +go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/arch v0.18.0 h1:WN9poc33zL4AzGxqf8VtpKUnGvMi8O9lhNyBMF/85qc= -golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= -golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/arch v0.23.0 h1:lKF64A2jF6Zd8L0knGltUnegD62JMFBiCPBmQpToHhg= +golang.org/x/arch v0.23.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A= +golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= +golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= -golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= -golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= -golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= +golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= +golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ= +golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= +golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= -golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= +golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= -golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= -golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= -golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= +golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= +golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= +golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 h1:oWVWY3NzT7KJppx2UKhKmzPq4SRe0LdCijVRwvGeikY= -google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822/go.mod h1:h3c4v36UTKzUiuaOKQ6gr3S+0hovBtUrXzTG/i3+XEc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1:fc6jSaCT0vBduLYZHYrBBNY4dsWuvgyff9noRNDdBeE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= -google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok= -google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc= -google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= -google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 h1:merA0rdPeUV3YIIfHHcH4qBkiQAc1nfCKSI7lB4cV2M= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409/go.mod h1:fl8J1IvUjCilwZzQowmw2b7HQB2eAuYBabMXzWurF+I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= +google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc= +google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -431,17 +426,16 @@ gorm.io/driver/postgres v1.6.0 h1:2dxzU8xJ+ivvqTRph34QX+WrRaJlmfyPqXmoGVjMBa4= gorm.io/driver/postgres v1.6.0/go.mod h1:vUw0mrGgrTK+uPHEhAdV4sfFELrByKVGnaVRkXDhtWo= gorm.io/driver/sqlite v1.6.0 h1:WHRRrIiulaPiPFmDcod6prc4l2VGVWHz80KspNsxSfQ= gorm.io/driver/sqlite v1.6.0/go.mod h1:AO9V1qIQddBESngQUKWL9yoH93HIeA1X6V633rBwyT8= -gorm.io/gorm v1.30.2 h1:f7bevlVoVe4Byu3pmbWPVHnPsLoWaMjEb7/clyr9Ivs= -gorm.io/gorm v1.30.2/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE= -k8s.io/apimachinery v0.34.0 h1:eR1WO5fo0HyoQZt1wdISpFDffnWOvFLOOeJ7MgIv4z0= -k8s.io/apimachinery v0.34.0/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= +gorm.io/gorm v1.31.1 h1:7CA8FTFz/gRfgqgpeKIBcervUn3xSyPUmr6B2WXJ7kg= +gorm.io/gorm v1.31.1/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs= +k8s.io/apimachinery v0.35.1 h1:yxO6gV555P1YV0SANtnTjXYfiivaTPvCTKX6w6qdDsU= +k8s.io/apimachinery v0.35.1/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y= -k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= -sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= -sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= +k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= +k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= +sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= From 6c2e2f4834e08d4e4b7f6ab4f2d1cdb810924923 Mon Sep 17 00:00:00 2001 From: ecrupper Date: Tue, 24 Feb 2026 15:51:43 -0600 Subject: [PATCH 2/5] chore(deps): upgrade deps and apply fix changes to codebase --- api/build/compile_publish.go | 2 +- api/build/list_repo.go | 2 +- api/build/update.go | 4 +- api/pipeline/output.go | 2 +- api/repo/list.go | 2 +- api/repo/list_org.go | 2 +- api/schedule/create.go | 2 +- api/scm/sync_org.go | 4 +- api/service/list.go | 2 +- api/step/list.go | 2 +- api/types/secret.go | 2 +- api/types/storage.go | 6 +-- api/types/storage_sts.go | 2 +- api/types/string.go | 8 ++-- api/types/string_test.go | 8 ++-- cache/context_test.go | 2 +- cache/redis/redis.go | 2 +- compiler/context_test.go | 2 +- compiler/engine.go | 8 ++-- compiler/native/compile.go | 11 +++-- compiler/native/compile_test.go | 8 ++-- compiler/native/environment.go | 41 +++++-------------- compiler/native/environment_test.go | 4 +- compiler/native/expand.go | 4 +- compiler/native/expand_test.go | 24 +++++------ compiler/native/parse.go | 4 +- compiler/native/parse_test.go | 16 ++++---- compiler/native/substitute_test.go | 4 +- compiler/native/validate_test.go | 2 +- compiler/template/native/convert.go | 6 +-- compiler/template/native/render.go | 8 ++-- compiler/template/native/render_test.go | 2 +- compiler/template/starlark/convert.go | 6 +-- compiler/template/starlark/convert_test.go | 8 ++-- compiler/template/starlark/render.go | 4 +- compiler/template/starlark/render_test.go | 2 +- compiler/template/starlark/starlark.go | 6 +-- compiler/template/starlark/starlark_test.go | 2 +- compiler/types/pipeline/build.go | 6 +-- compiler/types/pipeline/container.go | 11 +++-- compiler/types/pipeline/ruleset.go | 4 +- compiler/types/pipeline/stage.go | 7 ++-- compiler/types/raw/map.go | 17 ++++---- compiler/types/raw/map_test.go | 2 +- compiler/types/raw/slice.go | 2 +- compiler/types/yaml/build.go | 10 ++--- compiler/types/yaml/build_test.go | 10 ++--- compiler/types/yaml/deployment.go | 2 +- compiler/types/yaml/git.go | 2 +- compiler/types/yaml/metadata.go | 10 ++--- compiler/types/yaml/ruleset.go | 8 ++-- compiler/types/yaml/secret.go | 29 +++++++------ compiler/types/yaml/secret_test.go | 14 +++---- compiler/types/yaml/service.go | 11 +++-- compiler/types/yaml/stage.go | 16 ++++---- compiler/types/yaml/step.go | 45 ++++++++++----------- compiler/types/yaml/step_test.go | 8 ++-- compiler/types/yaml/template.go | 16 ++++---- compiler/types/yaml/ulimit.go | 2 +- compiler/types/yaml/volume.go | 2 +- database/build/clean.go | 2 +- database/build/count_deployment.go | 2 +- database/build/count_deployment_test.go | 2 +- database/build/count_org.go | 2 +- database/build/count_org_test.go | 10 ++--- database/build/count_repo.go | 2 +- database/build/count_repo_test.go | 2 +- database/build/count_status.go | 2 +- database/build/count_status_test.go | 2 +- database/build/interface.go | 10 ++--- database/build/list_repo.go | 2 +- database/build/list_repo_test.go | 2 +- database/context.go | 2 +- database/integration_test.go | 32 +++++++-------- database/logger.go | 6 +-- database/ping.go | 2 +- database/repo/count_org.go | 2 +- database/repo/count_org_test.go | 2 +- database/repo/count_user.go | 2 +- database/repo/count_user_test.go | 2 +- database/repo/interface.go | 8 ++-- database/repo/list_org.go | 2 +- database/repo/list_org_test.go | 2 +- database/repo/list_user.go | 2 +- database/repo/list_user_test.go | 2 +- database/secret/count_org.go | 2 +- database/secret/count_org_test.go | 2 +- database/secret/count_repo.go | 2 +- database/secret/count_repo_test.go | 2 +- database/secret/count_team.go | 4 +- database/secret/count_team_test.go | 4 +- database/secret/interface.go | 16 ++++---- database/secret/list_org.go | 2 +- database/secret/list_org_test.go | 2 +- database/secret/list_repo.go | 2 +- database/secret/list_repo_test.go | 2 +- database/secret/list_team.go | 4 +- database/secret/list_team_test.go | 4 +- database/service/count_build.go | 2 +- database/service/count_build_test.go | 2 +- database/service/interface.go | 4 +- database/service/list_build.go | 2 +- database/service/list_build_test.go | 2 +- database/step/count_build.go | 2 +- database/step/count_build_test.go | 2 +- database/step/interface.go | 4 +- database/step/list_build.go | 2 +- database/step/list_build_test.go | 2 +- database/testutils/mock_args.go | 4 +- database/types/dashboard.go | 4 +- database/types/deployment_test.go | 2 +- database/types/settings.go | 6 +-- database/types/user_test.go | 2 +- database/types/worker_test.go | 2 +- go.sum | 1 - internal/token/parse.go | 2 +- internal/yaml_test.go | 2 +- mock/server/build.go | 7 ++-- mock/server/build_test.go | 2 +- mock/server/dashboard_test.go | 6 +-- mock/server/deployment_test.go | 2 +- mock/server/hook_test.go | 2 +- mock/server/log_test.go | 2 +- mock/server/pipeline.go | 2 +- mock/server/pipeline_test.go | 2 +- mock/server/repo_test.go | 2 +- mock/server/schedule_test.go | 2 +- mock/server/secret_test.go | 2 +- mock/server/service_test.go | 2 +- mock/server/settings_test.go | 6 +-- mock/server/step_test.go | 2 +- mock/server/user_test.go | 2 +- mock/server/worker_test.go | 4 +- queue/context_test.go | 2 +- queue/redis/redis.go | 2 +- router/middleware/build/context.go | 2 +- router/middleware/claims/context.go | 2 +- router/middleware/cli/context.go | 2 +- router/middleware/dashboard/context.go | 2 +- router/middleware/hook/context.go | 2 +- router/middleware/logger.go | 4 +- router/middleware/logger_test.go | 2 +- router/middleware/org/context.go | 2 +- router/middleware/payload.go | 2 +- router/middleware/payload_test.go | 2 +- router/middleware/pipeline/context.go | 2 +- router/middleware/repo/context.go | 2 +- router/middleware/schedule/context.go | 2 +- router/middleware/service/context.go | 2 +- router/middleware/settings/context.go | 2 +- router/middleware/step/context.go | 2 +- router/middleware/tracing/context.go | 2 +- router/middleware/user/context.go | 2 +- router/middleware/worker/context.go | 2 +- scm/context.go | 2 +- scm/github/app_transport.go | 4 +- scm/github/deployment.go | 2 +- scm/github/repo.go | 2 +- scm/github/status_test.go | 6 +-- scm/github/webhook.go | 8 ++-- secret/context.go | 2 +- secret/vault/count.go | 2 +- secret/vault/create.go | 10 ++--- secret/vault/list.go | 6 +-- secret/vault/refresh.go | 4 +- secret/vault/update.go | 10 ++--- secret/vault/vault.go | 10 ++--- secret/vault/vault_test.go | 22 +++++----- storage/context.go | 2 +- storage/context_test.go | 2 +- version/version.go | 2 +- 171 files changed, 406 insertions(+), 444 deletions(-) diff --git a/api/build/compile_publish.go b/api/build/compile_publish.go index 33f2358a6..7a33a6c60 100644 --- a/api/build/compile_publish.go +++ b/api/build/compile_publish.go @@ -116,7 +116,7 @@ func CompileAndPublish( } // create SQL filters for querying pending and running builds for repo - filters := map[string]interface{}{ + filters := map[string]any{ "status": []string{constants.StatusPending, constants.StatusRunning}, } diff --git a/api/build/list_repo.go b/api/build/list_repo.go index 1d06fff45..7bc725601 100644 --- a/api/build/list_repo.go +++ b/api/build/list_repo.go @@ -127,7 +127,7 @@ import ( func ListBuildsForRepo(c *gin.Context) { // variables that will hold the build list, build list filters and total count var ( - filters = map[string]interface{}{} + filters = map[string]any{} b []*types.Build ) diff --git a/api/build/update.go b/api/build/update.go index aaaf81c2c..a87211cd1 100644 --- a/api/build/update.go +++ b/api/build/update.go @@ -230,7 +230,7 @@ func UpdateComponentStatuses(c *gin.Context, b *types.Build, status, scmToken st for page > 0 { // retrieve build steps (per page) from the database - stepsPart, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]interface{}{}, page, perPage) + stepsPart, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]any{}, page, perPage) if err != nil { return err } @@ -285,7 +285,7 @@ func UpdateComponentStatuses(c *gin.Context, b *types.Build, status, scmToken st for page > 0 { // retrieve build services (per page) from the database - servicesPart, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]interface{}{}, page, perPage) + servicesPart, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]any{}, page, perPage) if err != nil { return err } diff --git a/api/pipeline/output.go b/api/pipeline/output.go index 5a0f22440..e851c58e9 100644 --- a/api/pipeline/output.go +++ b/api/pipeline/output.go @@ -21,7 +21,7 @@ const ( // writeOutput is a helper function to return the provided value to the // request based off the output query parameter provided. If no output // query parameter is provided, then YAML is used by default. -func writeOutput(c *gin.Context, value interface{}) { +func writeOutput(c *gin.Context, value any) { output := util.QueryParameter(c, "output", outputYAML) // format response body based off output query parameter diff --git a/api/repo/list.go b/api/repo/list.go index cc99e7ba2..f72ccf89a 100644 --- a/api/repo/list.go +++ b/api/repo/list.go @@ -103,7 +103,7 @@ func ListRepos(c *gin.Context) { // capture the query parameters if present: // // * active - filters := map[string]interface{}{ + filters := map[string]any{ "active": util.QueryParameter(c, "active", "true"), } diff --git a/api/repo/list_org.go b/api/repo/list_org.go index b3ed1461c..0c4d07a9c 100644 --- a/api/repo/list_org.go +++ b/api/repo/list_org.go @@ -123,7 +123,7 @@ func ListReposForOrg(c *gin.Context) { sortBy := util.QueryParameter(c, "sort_by", "name") // prep filters - filters := make(map[string]interface{}) + filters := make(map[string]any) // capture the query parameters if present: // diff --git a/api/schedule/create.go b/api/schedule/create.go index 36741832b..1dc2bc75b 100644 --- a/api/schedule/create.go +++ b/api/schedule/create.go @@ -231,7 +231,7 @@ func validateEntry(minimum time.Duration, entry string) error { // start with now t := time.Now().UTC() - for i := 0; i < tickForward; i++ { + for range tickForward { // check the previous occurrence of the entry prevTime, err := gronx.PrevTickBefore(entry, t, true) if err != nil { diff --git a/api/scm/sync_org.go b/api/scm/sync_org.go index 6b92e517e..634361b28 100644 --- a/api/scm/sync_org.go +++ b/api/scm/sync_org.go @@ -93,7 +93,7 @@ func SyncReposForOrg(c *gin.Context) { } // send API call to capture the total number of repos for the org - t, err := database.FromContext(c).CountReposForOrg(ctx, o, map[string]interface{}{}) + t, err := database.FromContext(c).CountReposForOrg(ctx, o, map[string]any{}) if err != nil { retErr := fmt.Errorf("unable to get repo count for org %s: %w", o, err) @@ -106,7 +106,7 @@ func SyncReposForOrg(c *gin.Context) { page := 0 // capture all repos belonging to a certain org in database for orgRepos := int64(0); orgRepos < t; orgRepos += 100 { - r, err := database.FromContext(c).ListReposForOrg(ctx, o, "name", map[string]interface{}{}, page, 100) + r, err := database.FromContext(c).ListReposForOrg(ctx, o, "name", map[string]any{}, page, 100) if err != nil { retErr := fmt.Errorf("unable to get repo count for org %s: %w", o, err) diff --git a/api/service/list.go b/api/service/list.go index 373d16794..8a8423ca2 100644 --- a/api/service/list.go +++ b/api/service/list.go @@ -120,7 +120,7 @@ func ListServices(c *gin.Context) { perPage = max(1, min(100, perPage)) // send API call to capture the list of services for the build - s, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]interface{}{}, page, perPage) + s, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]any{}, page, perPage) if err != nil { retErr := fmt.Errorf("unable to get services for build %s: %w", entry, err) diff --git a/api/step/list.go b/api/step/list.go index fb29dc7c2..4b4e0ffd1 100644 --- a/api/step/list.go +++ b/api/step/list.go @@ -120,7 +120,7 @@ func ListSteps(c *gin.Context) { perPage = max(1, min(100, perPage)) // send API call to capture the list of steps for the build - s, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]interface{}{}, page, perPage) + s, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]any{}, page, perPage) if err != nil { retErr := fmt.Errorf("unable to list steps for build %s: %w", entry, err) diff --git a/api/types/secret.go b/api/types/secret.go index bcf4a6e90..49635a04a 100644 --- a/api/types/secret.go +++ b/api/types/secret.go @@ -34,7 +34,7 @@ type Secret struct { // UnmarshalYAML implements the Unmarshaler interface for the Secret type. // This allows custom fields in the Secret type to be read from a YAML file, like AllowEvents. -func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *Secret) UnmarshalYAML(unmarshal func(any) error) error { // create an alias to perform a normal unmarshal and avoid an infinite loop type jsonSecret Secret diff --git a/api/types/storage.go b/api/types/storage.go index 0c6913282..efd7b429c 100644 --- a/api/types/storage.go +++ b/api/types/storage.go @@ -11,13 +11,13 @@ import ( // swagger:model CreateBucket type Bucket struct { BucketName string `json:"bucket_name,omitempty"` - MakeBucketOptions minio.MakeBucketOptions `json:"make_bucket_options,omitempty"` - ListObjectsOptions minio.ListObjectsOptions `json:"list_objects_options,omitempty"` + MakeBucketOptions minio.MakeBucketOptions `json:"make_bucket_options"` + ListObjectsOptions minio.ListObjectsOptions `json:"list_objects_options"` Recursive bool `json:"recursive"` } type Object struct { ObjectName string `json:"object_name,omitempty"` - Bucket Bucket `json:"bucket,omitempty"` + Bucket Bucket `json:"bucket"` FilePath string `json:"file_path,omitempty"` } diff --git a/api/types/storage_sts.go b/api/types/storage_sts.go index 40e560751..4e0d243a2 100644 --- a/api/types/storage_sts.go +++ b/api/types/storage_sts.go @@ -18,5 +18,5 @@ type STSCreds struct { Prefix string `json:"prefix,omitempty"` Secure bool `json:"secure,omitempty"` - ExpiresAt time.Time `json:"expires_at,omitempty"` + ExpiresAt time.Time `json:"expires_at"` } diff --git a/api/types/string.go b/api/types/string.go index f86367ba6..25f573499 100644 --- a/api/types/string.go +++ b/api/types/string.go @@ -13,7 +13,7 @@ import ( // ToString is a helper function to convert // the provided interface value to a string. -func ToString(v interface{}) string { +func ToString(v any) string { switch v := v.(type) { case string: return v @@ -45,7 +45,7 @@ func ToString(v interface{}) string { return strconv.FormatUint(uint64(v), 10) case uint64: return strconv.FormatUint(v, 10) - case []interface{}: + case []any: return unmarshalSlice(v) default: return unmarshalMap(v) @@ -53,7 +53,7 @@ func ToString(v interface{}) string { } // helper function to unmarshal a parameter in map format. -func unmarshalMap(v interface{}) string { +func unmarshalMap(v any) string { yml, err := yaml.Marshal(v) if err != nil { return err.Error() @@ -68,7 +68,7 @@ func unmarshalMap(v interface{}) string { } // helper function to unmarshal a parameter in slice format. -func unmarshalSlice(v interface{}) string { +func unmarshalSlice(v any) string { out, err := yaml.Marshal(v) if err != nil { return err.Error() diff --git a/api/types/string_test.go b/api/types/string_test.go index e362f0766..d2cff807b 100644 --- a/api/types/string_test.go +++ b/api/types/string_test.go @@ -10,8 +10,8 @@ import ( func TestTypes_ToString(t *testing.T) { // setup tests tests := []struct { - parameter interface{} - want interface{} + parameter any + want any }{ {parameter: "string", want: "string"}, // string {parameter: true, want: "true"}, // bool @@ -33,11 +33,11 @@ func TestTypes_ToString(t *testing.T) { want: "{\"hello\":\"world\"}", }, { // slice - parameter: []interface{}{1, 2, 3}, + parameter: []any{1, 2, 3}, want: "1,2,3", }, { // slice complex - parameter: []interface{}{struct{ Foo string }{Foo: "bar"}}, + parameter: []any{struct{ Foo string }{Foo: "bar"}}, want: "[{\"foo\":\"bar\"}]", }, { // complex diff --git a/cache/context_test.go b/cache/context_test.go index c7e1b0f4d..af79948cb 100644 --- a/cache/context_test.go +++ b/cache/context_test.go @@ -52,7 +52,7 @@ func TestCache_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value interface{} + value any want Service }{ { diff --git a/cache/redis/redis.go b/cache/redis/redis.go index 96e61efa5..a3bf5fd10 100644 --- a/cache/redis/redis.go +++ b/cache/redis/redis.go @@ -125,7 +125,7 @@ func failoverFromOptions(source *redis.Options) *redis.FailoverOptions { // the first host from the csv list is set as // the master node all subsequent hosts get // added as sentinel nodes - for _, host := range strings.Split(hosts, ",") { + for host := range strings.SplitSeq(hosts, ",") { if len(target.MasterName) == 0 { target.MasterName = host continue diff --git a/compiler/context_test.go b/compiler/context_test.go index 5a31cc911..4ef2dcb55 100644 --- a/compiler/context_test.go +++ b/compiler/context_test.go @@ -52,7 +52,7 @@ func TestCompiler_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value interface{} + value any want Engine }{ { diff --git a/compiler/engine.go b/compiler/engine.go index ac02cd8fe..520e962e3 100644 --- a/compiler/engine.go +++ b/compiler/engine.go @@ -24,12 +24,12 @@ type Engine interface { // Compile defines a function that produces an executable // representation of a pipeline from an object. This calls // Parse internally to convert the object to a yaml configuration. - Compile(context.Context, interface{}) (*pipeline.Build, *api.Pipeline, error) + Compile(context.Context, any) (*pipeline.Build, *api.Pipeline, error) // CompileLite defines a function that produces an light executable // representation of a pipeline from an object. This calls // Parse internally to convert the object to a yaml configuration. - CompileLite(context.Context, interface{}, *pipeline.RuleData, bool) (*yaml.Build, *api.Pipeline, error) + CompileLite(context.Context, any, *pipeline.RuleData, bool) (*yaml.Build, *api.Pipeline, error) // Duplicate defines a function that // creates a clone of the Engine. @@ -37,11 +37,11 @@ type Engine interface { // Parse defines a function that converts // an object to a yaml configuration. - Parse(interface{}, string, *yaml.Template) (*yaml.Build, []byte, []string, error) + Parse(any, string, *yaml.Template) (*yaml.Build, []byte, []string, error) // ParseRaw defines a function that converts // an object to a string. - ParseRaw(interface{}) (string, error) + ParseRaw(any) (string, error) // ValidateYAML defines a function that verifies // the yaml configuration is accurate. diff --git a/compiler/native/compile.go b/compiler/native/compile.go index 9d2753487..db50486cf 100644 --- a/compiler/native/compile.go +++ b/compiler/native/compile.go @@ -8,6 +8,7 @@ import ( "encoding/json" "fmt" "io" + "maps" "net/http" "strings" "time" @@ -38,7 +39,7 @@ type ModifyResponse struct { } // Compile produces an executable pipeline from a yaml configuration. -func (c *Client) Compile(ctx context.Context, v interface{}) (*pipeline.Build, *api.Pipeline, error) { +func (c *Client) Compile(ctx context.Context, v any) (*pipeline.Build, *api.Pipeline, error) { p, data, warnings, err := c.Parse(v, c.repo.GetPipelineType(), new(yaml.Template)) if err != nil { return nil, nil, err @@ -120,7 +121,7 @@ func (c *Client) Compile(ctx context.Context, v interface{}) (*pipeline.Build, * } // CompileLite produces a partial of an executable pipeline from a yaml configuration. -func (c *Client) CompileLite(ctx context.Context, v interface{}, ruleData *pipeline.RuleData, substitute bool) (*yaml.Build, *api.Pipeline, error) { +func (c *Client) CompileLite(ctx context.Context, v any, ruleData *pipeline.RuleData, substitute bool) (*yaml.Build, *api.Pipeline, error) { p, data, warnings, err := c.Parse(v, c.repo.GetPipelineType(), new(yaml.Template)) if err != nil { return nil, nil, err @@ -256,7 +257,7 @@ func (c *Client) compileInline(ctx context.Context, p *yaml.Build, depth int) (* // initialize variable map if not parsed from config if len(template.Variables) == 0 { - template.Variables = make(map[string]interface{}) + template.Variables = make(map[string]any) } // inject template name into variables @@ -279,9 +280,7 @@ func (c *Client) compileInline(ctx context.Context, p *yaml.Build, depth int) (* switch { case len(parsed.Environment) > 0: - for key, value := range parsed.Environment { - newPipeline.Environment[key] = value - } + maps.Copy(newPipeline.Environment, parsed.Environment) fallthrough case len(parsed.Stages) > 0: diff --git a/compiler/native/compile_test.go b/compiler/native/compile_test.go index 6611dc87d..a22f82c3c 100644 --- a/compiler/native/compile_test.go +++ b/compiler/native/compile_test.go @@ -2288,8 +2288,8 @@ func Test_client_modifyConfig(t *testing.T) { Environment: nil, Name: "docker", Pull: "always", - Parameters: map[string]interface{}{ - "init_options": map[string]interface{}{ + Parameters: map[string]any{ + "init_options": map[string]any{ "get_plugins": "true", }, }, @@ -2321,8 +2321,8 @@ func Test_client_modifyConfig(t *testing.T) { Environment: nil, Name: "docker", Pull: "always", - Parameters: map[string]interface{}{ - "init_options": map[string]interface{}{ + Parameters: map[string]any{ + "init_options": map[string]any{ "get_plugins": "true", }, }, diff --git a/compiler/native/environment.go b/compiler/native/environment.go index 0a5c96958..4f8620749 100644 --- a/compiler/native/environment.go +++ b/compiler/native/environment.go @@ -4,6 +4,7 @@ package native import ( "fmt" + "maps" "os" "strconv" "strings" @@ -44,17 +45,13 @@ func (c *Client) EnvironmentStage(s *yaml.Stage, globalEnv raw.StringSliceMap) ( // inject the declared environment // variables to the build stage - for k, v := range s.Environment { - env[k] = v - } + maps.Copy(env, s.Environment) // inject the default environment // variables to the build stage // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - for k, v := range defaultEnv { - env[k] = v - } + maps.Copy(env, defaultEnv) // overwrite existing build stage environment s.Environment = env @@ -99,17 +96,13 @@ func (c *Client) EnvironmentStep(s *yaml.Step, stageEnv raw.StringSliceMap) (*ya // inject the declared environment // variables to the build step - for k, v := range s.Environment { - env[k] = v - } + maps.Copy(env, s.Environment) // inject the default environment // variables to the build step // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - for k, v := range defaultEnv { - env[k] = v - } + maps.Copy(env, defaultEnv) // check if the compiler is setup for a local pipeline if c.local && !s.Detach { @@ -161,17 +154,13 @@ func (c *Client) EnvironmentServices(s yaml.ServiceSlice, globalEnv raw.StringSl // inject the declared environment // variables to the build service - for k, v := range service.Environment { - env[k] = v - } + maps.Copy(env, service.Environment) // inject the default environment // variables to the build service // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - for k, v := range defaultEnv { - env[k] = v - } + maps.Copy(env, defaultEnv) // overwrite existing build service environment service.Environment = env @@ -202,17 +191,13 @@ func (c *Client) EnvironmentSecrets(s yaml.SecretSlice, globalEnv raw.StringSlic // inject the declared environment // variables to the build secret - for k, v := range secret.Origin.Environment { - env[k] = v - } + maps.Copy(env, secret.Origin.Environment) // inject the default environment // variables to the build secret // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - for k, v := range defaultEnv { - env[k] = v - } + maps.Copy(env, defaultEnv) // check if the compiler is setup for a local pipeline if c.local { @@ -261,9 +246,7 @@ func (c *Client) EnvironmentBuild() map[string]string { // variables to the build // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - for k, v := range defaultEnv { - env[k] = v - } + maps.Copy(env, defaultEnv) // check if the compiler is setup for a local pipeline if c.local { @@ -281,9 +264,7 @@ func (c *Client) EnvironmentBuild() map[string]string { // helper function to merge two maps together. func appendMap(originalMap, otherMap map[string]string) map[string]string { - for key, value := range otherMap { - originalMap[key] = value - } + maps.Copy(originalMap, otherMap) return originalMap } diff --git a/compiler/native/environment_test.go b/compiler/native/environment_test.go index 833ad7532..873385896 100644 --- a/compiler/native/environment_test.go +++ b/compiler/native/environment_test.go @@ -395,7 +395,7 @@ func TestNative_EnvironmentSecrets(t *testing.T) { Image: "vault", Name: str, Pull: "always", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "foo": "bar", }, Environment: raw.StringSliceMap{ @@ -412,7 +412,7 @@ func TestNative_EnvironmentSecrets(t *testing.T) { Image: "vault", Name: str, Pull: "always", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "foo": "bar", }, Environment: raw.StringSliceMap{ diff --git a/compiler/native/expand.go b/compiler/native/expand.go index d6eb97b9e..6ac18960a 100644 --- a/compiler/native/expand.go +++ b/compiler/native/expand.go @@ -137,7 +137,7 @@ func (c *Client) ExpandSteps(ctx context.Context, s *yaml.Build, tmpls map[strin // initialize variable map if not parsed from config if len(step.Template.Variables) == 0 { - step.Template.Variables = make(map[string]interface{}) + step.Template.Variables = make(map[string]any) } // inject template name into variables @@ -259,7 +259,7 @@ func (c *Client) ExpandDeployment(ctx context.Context, b *yaml.Build, tmpls map[ // initialize variable map if not parsed from config if len(b.Deployment.Template.Variables) == 0 { - b.Deployment.Template.Variables = make(map[string]interface{}) + b.Deployment.Template.Variables = make(map[string]any) } tmplBuild, _, err := c.mergeDeployTemplate(bytes, tmpl, &b.Deployment) diff --git a/compiler/native/expand_test.go b/compiler/native/expand_test.go index 7552df75a..ee8c7784b 100644 --- a/compiler/native/expand_test.go +++ b/compiler/native/expand_test.go @@ -55,7 +55,7 @@ func TestNative_ExpandStages(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -255,7 +255,7 @@ func TestNative_ExpandSteps(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -515,7 +515,7 @@ func TestNative_ExpandDeployment(t *testing.T) { deployCfg := yaml.Deployment{ Template: yaml.StepTemplate{ Name: "deploy", - Variables: map[string]interface{}{ + Variables: map[string]any{ "regions": []string{"us-east-1", "us-west-1"}, }, }, @@ -611,7 +611,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -622,7 +622,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "maven", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -639,7 +639,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "npm", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -753,12 +753,12 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Target: "VAULT_TOKEN", }, }, - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.example.com", "auth_method": "token", "username": "octocat", - "items": []interface{}{ - map[string]interface{}{"path": "docker", "source": "secret/docker"}, + "items": []any{ + map[string]any{"path": "docker", "source": "secret/docker"}, }, }, }, @@ -847,7 +847,7 @@ func TestNative_ExpandStepsStarlark(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "go", - Variables: map[string]interface{}{}, + Variables: map[string]any{}, }, }, } @@ -1150,7 +1150,7 @@ func TestNative_ExpandStepsDuplicateCalls(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -1161,7 +1161,7 @@ func TestNative_ExpandStepsDuplicateCalls(t *testing.T) { Name: "sample-dup", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", diff --git a/compiler/native/parse.go b/compiler/native/parse.go index f1993639f..229172f77 100644 --- a/compiler/native/parse.go +++ b/compiler/native/parse.go @@ -16,7 +16,7 @@ import ( ) // ParseRaw converts an object to a string. -func (c *Client) ParseRaw(v interface{}) (string, error) { +func (c *Client) ParseRaw(v any) (string, error) { switch v := v.(type) { case []byte: return string(v), nil @@ -40,7 +40,7 @@ func (c *Client) ParseRaw(v interface{}) (string, error) { } // Parse converts an object to a yaml configuration. -func (c *Client) Parse(v interface{}, pipelineType string, template *yaml.Template) (*yaml.Build, []byte, []string, error) { +func (c *Client) Parse(v any, pipelineType string, template *yaml.Template) (*yaml.Build, []byte, []string, error) { var ( p *yaml.Build warnings []string diff --git a/compiler/native/parse_test.go b/compiler/native/parse_test.go index 2dd82edd1..811d01623 100644 --- a/compiler/native/parse_test.go +++ b/compiler/native/parse_test.go @@ -187,10 +187,10 @@ func TestNative_Parse_Parameters(t *testing.T) { Steps: yaml.StepSlice{ &yaml.Step{ Image: "plugins/docker:18.09", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, Name: "docker", Pull: "always", @@ -297,10 +297,10 @@ func TestNative_Parse_StagesPipeline(t *testing.T) { Steps: yaml.StepSlice{ &yaml.Step{ Image: "plugins/docker:18.09", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, Name: "publish", Pull: "always", @@ -409,10 +409,10 @@ func TestNative_Parse_StepsPipeline(t *testing.T) { }, &yaml.Step{ Image: "plugins/docker:18.09", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, Name: "publish", Pull: "always", @@ -884,7 +884,7 @@ func Test_client_Parse(t *testing.T) { Name: "foo", Image: "alpine", Pull: "not_present", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "foo", }, }, @@ -968,7 +968,7 @@ func Test_client_ParseRaw(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var ( - content interface{} + content any err error ) diff --git a/compiler/native/substitute_test.go b/compiler/native/substitute_test.go index 735063feb..fb7cf540d 100644 --- a/compiler/native/substitute_test.go +++ b/compiler/native/substitute_test.go @@ -196,7 +196,7 @@ func Test_client_SubstituteSteps(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "go", - Variables: map[string]interface{}{ + Variables: map[string]any{ "build_author": "${BUILD_AUTHOR}", "unknown": "${DEPLOYMENT_PARAMETER_API_IMAGE}", }, @@ -212,7 +212,7 @@ func Test_client_SubstituteSteps(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "go", - Variables: map[string]interface{}{ + Variables: map[string]any{ "build_author": "testauthor", "unknown": "${DEPLOYMENT_PARAMETER_API_IMAGE}", }, diff --git a/compiler/native/validate_test.go b/compiler/native/validate_test.go index 29ed8747b..f782d2e2b 100644 --- a/compiler/native/validate_test.go +++ b/compiler/native/validate_test.go @@ -648,7 +648,7 @@ func TestNative_Validate_Steps_ExceedReportAs(t *testing.T) { reportSteps := pipeline.ContainerSlice{} - for i := 0; i < 12; i++ { + for i := range 12 { reportStep := &pipeline.Container{ Commands: raw.StringSlice{"echo hello"}, Image: "alpine", diff --git a/compiler/template/native/convert.go b/compiler/template/native/convert.go index 51382c9a7..a2d3916bb 100644 --- a/compiler/template/native/convert.go +++ b/compiler/template/native/convert.go @@ -30,9 +30,9 @@ func convertPlatformVars(slice raw.StringSliceMap, name string) raw.StringSliceM } // check if the key has a 'vela_*' prefix - if strings.HasPrefix(key, "vela_") { + if after, ok := strings.CutPrefix(key, "vela_"); ok { // add the key/value pair without the 'vela_` prefix - envs[strings.TrimPrefix(key, "vela_")] = value + envs[after] = value } } @@ -49,7 +49,7 @@ func convertPlatformVars(slice raw.StringSliceMap, name string) raw.StringSliceM // https://github.com/helm/helm/blob/a499b4b179307c267bdf3ec49b880e3dbd2a5591/pkg/engine/funcs.go#L83 // // This is designed to be called from a template. -func toYAML(v interface{}) string { +func toYAML(v any) string { data, err := yaml.Marshal(v) if err != nil { // Swallow errors inside of a template. diff --git a/compiler/template/native/render.go b/compiler/template/native/render.go index c9836f8f9..69cecfaa4 100644 --- a/compiler/template/native/render.go +++ b/compiler/template/native/render.go @@ -15,11 +15,11 @@ import ( ) // Render combines the template with the step in the yaml pipeline. -func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]interface{}) (*types.Build, []string, error) { +func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]any) (*types.Build, []string, error) { buffer := new(bytes.Buffer) velaFuncs := funcHandler{envs: convertPlatformVars(environment, name)} - templateFuncMap := map[string]interface{}{ + templateFuncMap := map[string]any{ "vela": velaFuncs.returnPlatformVar, "toYaml": toYAML, } @@ -69,11 +69,11 @@ func Render(tmpl string, name string, tName string, environment raw.StringSliceM } // RenderBuild renders the templated build. -func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]interface{}) (*types.Build, []string, error) { +func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]any) (*types.Build, []string, error) { buffer := new(bytes.Buffer) velaFuncs := funcHandler{envs: convertPlatformVars(envs, tmpl)} - templateFuncMap := map[string]interface{}{ + templateFuncMap := map[string]any{ "vela": velaFuncs.returnPlatformVar, "toYaml": toYAML, } diff --git a/compiler/template/native/render_test.go b/compiler/template/native/render_test.go index a7b93c8cf..4510950b1 100644 --- a/compiler/template/native/render_test.go +++ b/compiler/template/native/render_test.go @@ -133,7 +133,7 @@ func TestNative_RenderBuild(t *testing.T) { got, _, err := RenderBuild("build", string(sFile), map[string]string{ "VELA_REPO_FULL_NAME": "octocat/hello-world", "VELA_BUILD_BRANCH": "main", - }, map[string]interface{}{}) + }, map[string]any{}) if (err != nil) != tt.wantErr { t.Errorf("RenderBuild() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/compiler/template/starlark/convert.go b/compiler/template/starlark/convert.go index 8a519db4f..3f1671217 100644 --- a/compiler/template/starlark/convert.go +++ b/compiler/template/starlark/convert.go @@ -17,7 +17,7 @@ import ( // // Explanation of type "starlark.StringDict": // https://pkg.go.dev/go.starlark.net/starlark#StringDict -func convertTemplateVars(m map[string]interface{}) (*starlark.Dict, error) { +func convertTemplateVars(m map[string]any) (*starlark.Dict, error) { dict := starlark.NewDict(0) // loop through user vars converting provided types to starlark primitives @@ -90,9 +90,9 @@ func convertPlatformVars(slice raw.StringSliceMap, name string) (*starlark.Dict, // iterate through the list of possible prefixes to look for for _, prefix := range []string{"deployment_parameter_", "vela_"} { // check if the key has the prefix - if strings.HasPrefix(key, prefix) { + if after, ok := strings.CutPrefix(key, prefix); ok { // trim the prefix from the input key - key = strings.TrimPrefix(key, prefix) + key = after // check if the prefix is from 'vela_*' if strings.EqualFold(prefix, "vela_") { diff --git a/compiler/template/starlark/convert_test.go b/compiler/template/starlark/convert_test.go index 7175da779..b1024506f 100644 --- a/compiler/template/starlark/convert_test.go +++ b/compiler/template/starlark/convert_test.go @@ -48,22 +48,22 @@ func TestStarlark_Render_convertTemplateVars(t *testing.T) { tests := []struct { name string - args map[string]interface{} + args map[string]any want *starlark.Dict }{ { name: "test for a user passed string", - args: map[string]interface{}{"pull": "always"}, + args: map[string]any{"pull": "always"}, want: strWant, }, { name: "test for a user passed array", - args: map[string]interface{}{"tags": []string{"latest", "1.14", "1.15"}}, + args: map[string]any{"tags": []string{"latest", "1.14", "1.15"}}, want: arrayWant, }, { name: "test for a user passed map", - args: map[string]interface{}{"commands": map[string]string{"test": "go test ./..."}}, + args: map[string]any{"commands": map[string]string{"test": "go test ./..."}}, want: mapWant, }} diff --git a/compiler/template/starlark/render.go b/compiler/template/starlark/render.go index 1460b6de4..25ea2f2e5 100644 --- a/compiler/template/starlark/render.go +++ b/compiler/template/starlark/render.go @@ -31,7 +31,7 @@ var ( ) // Render combines the template with the step in the yaml pipeline. -func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]interface{}, limit int64) (*types.Build, []string, error) { +func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]any, limit int64) (*types.Build, []string, error) { thread := &starlark.Thread{Name: name} if limit < 0 { @@ -145,7 +145,7 @@ func Render(tmpl string, name string, tName string, environment raw.StringSliceM // RenderBuild renders the templated build. // //nolint:lll // ignore function length due to input args -func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]interface{}, limit int64) (*types.Build, []string, error) { +func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]any, limit int64) (*types.Build, []string, error) { thread := &starlark.Thread{Name: "templated-base"} if limit < 0 { diff --git a/compiler/template/starlark/render_test.go b/compiler/template/starlark/render_test.go index 5c070510c..70b501112 100644 --- a/compiler/template/starlark/render_test.go +++ b/compiler/template/starlark/render_test.go @@ -220,7 +220,7 @@ func TestNative_RenderBuild(t *testing.T) { "VELA_REPO_FULL_NAME": "octocat/hello-world", "VELA_BUILD_BRANCH": "main", "VELA_REPO_ORG": "octocat", - }, map[string]interface{}{}, tt.execLimit) + }, map[string]any{}, tt.execLimit) if (err != nil) != tt.wantErr { t.Errorf("RenderBuild() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/compiler/template/starlark/starlark.go b/compiler/template/starlark/starlark.go index 02db098aa..7ffcd95f9 100644 --- a/compiler/template/starlark/starlark.go +++ b/compiler/template/starlark/starlark.go @@ -32,7 +32,7 @@ var ( // https://github.com/wonderix/shalm/blob/899b8f7787883d40619eefcc39bd12f42a09b5e7/pkg/shalm/convert.go#L14-L85 // //nolint:gocyclo // ignore complexity -func toStarlark(value interface{}) (starlark.Value, error) { +func toStarlark(value any) (starlark.Value, error) { logrus.Tracef("converting %v to starlark type", value) if value == nil { @@ -81,7 +81,7 @@ func toStarlark(value interface{}) (starlark.Value, error) { } return starlark.Tuple(a), nil - case reflect.Ptr: + case reflect.Pointer: val, err := toStarlark(v.Elem().Interface()) if err != nil { return nil, err @@ -126,7 +126,7 @@ func toStarlark(value interface{}) (starlark.Value, error) { return nil, err } - var m map[string]interface{} + var m map[string]any err = json.Unmarshal(data, &m) if err != nil { diff --git a/compiler/template/starlark/starlark_test.go b/compiler/template/starlark/starlark_test.go index d85900f33..017add4db 100644 --- a/compiler/template/starlark/starlark_test.go +++ b/compiler/template/starlark/starlark_test.go @@ -22,7 +22,7 @@ func TestStarlark_toStarlark(t *testing.T) { a = append(a, starlark.Value(starlark.String("bar"))) type args struct { - value interface{} + value any } tests := []struct { diff --git a/compiler/types/pipeline/build.go b/compiler/types/pipeline/build.go index ccfe1bcbb..f931d3cd2 100644 --- a/compiler/types/pipeline/build.go +++ b/compiler/types/pipeline/build.go @@ -19,10 +19,10 @@ type Build struct { Token string `json:"token,omitempty" yaml:"token,omitempty"` TokenExp int64 `json:"token_exp,omitempty" yaml:"token_exp,omitempty"` Version string `json:"version,omitempty" yaml:"version,omitempty"` - Metadata Metadata `json:"metadata,omitempty" yaml:"metadata,omitempty"` + Metadata Metadata `json:"metadata" yaml:"metadata,omitempty"` Environment raw.StringSliceMap `json:"environment,omitempty" yaml:"environment,omitempty"` - Worker Worker `json:"worker,omitempty" yaml:"worker,omitempty"` - Deployment Deployment `json:"deployment,omitempty" yaml:"deployment,omitempty"` + Worker Worker `json:"worker" yaml:"worker,omitempty"` + Deployment Deployment `json:"deployment" yaml:"deployment,omitempty"` Secrets SecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"` Services ContainerSlice `json:"services,omitempty" yaml:"services,omitempty"` Stages StageSlice `json:"stages,omitempty" yaml:"stages,omitempty"` diff --git a/compiler/types/pipeline/container.go b/compiler/types/pipeline/container.go index e83b17c95..f2f609fc6 100644 --- a/compiler/types/pipeline/container.go +++ b/compiler/types/pipeline/container.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "maps" "math/rand" "reflect" "strings" @@ -46,9 +47,9 @@ type ( Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"` Pull string `json:"pull,omitempty" yaml:"pull,omitempty"` - Ruleset Ruleset `json:"ruleset,omitempty" yaml:"ruleset,omitempty"` + Ruleset Ruleset `json:"ruleset" yaml:"ruleset,omitempty"` Secrets StepSecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"` - Artifacts Artifacts `json:"artifacts,omitempty" yaml:"artifacts,omitempty"` + Artifacts Artifacts `json:"artifacts" yaml:"artifacts,omitempty"` Ulimits UlimitSlice `json:"ulimits,omitempty" yaml:"ulimits,omitempty"` Volumes VolumeSlice `json:"volumes,omitempty" yaml:"volumes,omitempty"` User string `json:"user,omitempty" yaml:"user,omitempty"` @@ -200,10 +201,8 @@ func (c *Container) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the container environment variable - c.Environment[key] = value - } + // set or update the container environment variable + maps.Copy(c.Environment, environment) return nil } diff --git a/compiler/types/pipeline/ruleset.go b/compiler/types/pipeline/ruleset.go index e18072773..34a1b772f 100644 --- a/compiler/types/pipeline/ruleset.go +++ b/compiler/types/pipeline/ruleset.go @@ -20,8 +20,8 @@ type ( // // swagger:model PipelineRuleset Ruleset struct { - If Rules `json:"if,omitempty" yaml:"if,omitempty"` - Unless Rules `json:"unless,omitempty" yaml:"unless,omitempty"` + If Rules `json:"if" yaml:"if,omitempty"` + Unless Rules `json:"unless" yaml:"unless,omitempty"` Matcher string `json:"matcher,omitempty" yaml:"matcher,omitempty"` Operator string `json:"operator,omitempty" yaml:"operator,omitempty"` Continue bool `json:"continue,omitempty" yaml:"continue,omitempty"` diff --git a/compiler/types/pipeline/stage.go b/compiler/types/pipeline/stage.go index 27c10c232..a3df1338e 100644 --- a/compiler/types/pipeline/stage.go +++ b/compiler/types/pipeline/stage.go @@ -4,6 +4,7 @@ package pipeline import ( "fmt" + "maps" "github.com/go-vela/server/constants" ) @@ -156,10 +157,8 @@ func (s *Stage) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the stage environment variable - s.Environment[key] = value - } + // set or update the stage environment variable + maps.Copy(s.Environment, environment) return nil } diff --git a/compiler/types/raw/map.go b/compiler/types/raw/map.go index deb1c81d0..15ed2b795 100644 --- a/compiler/types/raw/map.go +++ b/compiler/types/raw/map.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "maps" "strings" "github.com/invopop/jsonschema" @@ -26,7 +27,7 @@ func (s StringSliceMap) Value() (driver.Value, error) { } // Scan decodes the JSON string into map[string]string. -func (s *StringSliceMap) Scan(value interface{}) error { +func (s *StringSliceMap) Scan(value any) error { b, ok := value.(string) if !ok { return errors.New("type assertion to string failed") @@ -77,10 +78,8 @@ func (s *StringSliceMap) UnmarshalJSON(b []byte) error { err = json.Unmarshal(b, &jsonMap) if err == nil { // iterate through each item in the json map - for k, v := range jsonMap { - // append each key/value pair to our target map - targetMap[k] = v - } + // append each key/value pair to our target map + maps.Copy(targetMap, jsonMap) // overwrite existing StringSliceMap *s = targetMap @@ -92,7 +91,7 @@ func (s *StringSliceMap) UnmarshalJSON(b []byte) error { } // UnmarshalYAML implements the Unmarshaler interface for the StringSliceMap type. -func (s *StringSliceMap) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *StringSliceMap) UnmarshalYAML(unmarshal func(any) error) error { // target map we want to return targetMap := map[string]string{} @@ -128,10 +127,8 @@ func (s *StringSliceMap) UnmarshalYAML(unmarshal func(interface{}) error) error err = unmarshal(&yamlMap) if err == nil { // iterate through each item in the yaml map - for k, v := range yamlMap { - // append each key/value pair to our target map - targetMap[k] = v - } + // append each key/value pair to our target map + maps.Copy(targetMap, yamlMap) // overwrite existing StringSliceMap *s = targetMap diff --git a/compiler/types/raw/map_test.go b/compiler/types/raw/map_test.go index e8b280161..435957885 100644 --- a/compiler/types/raw/map_test.go +++ b/compiler/types/raw/map_test.go @@ -175,7 +175,7 @@ func TestStringSliceMap_Value(t *testing.T) { func TestStringSliceMap_Scan(t *testing.T) { type args struct { - value interface{} + value any } tests := []struct { diff --git a/compiler/types/raw/slice.go b/compiler/types/raw/slice.go index fb6ac59b2..4d8f926d2 100644 --- a/compiler/types/raw/slice.go +++ b/compiler/types/raw/slice.go @@ -47,7 +47,7 @@ func (s *StringSlice) UnmarshalJSON(b []byte) error { } // UnmarshalYAML implements the Unmarshaler interface for the StringSlice type. -func (s *StringSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *StringSlice) UnmarshalYAML(unmarshal func(any) error) error { // yaml string we try unmarshalling to yamlString := "" diff --git a/compiler/types/yaml/build.go b/compiler/types/yaml/build.go index a4b7494f7..ee80045e0 100644 --- a/compiler/types/yaml/build.go +++ b/compiler/types/yaml/build.go @@ -10,16 +10,16 @@ import ( // Build is the yaml representation of a build for a pipeline. type Build struct { Version string `yaml:"version,omitempty" json:"version,omitempty" jsonschema:"required,minLength=1,description=Provide syntax version used to evaluate the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/version/"` - Metadata Metadata `yaml:"metadata,omitempty" json:"metadata,omitempty" jsonschema:"description=Pass extra information.\nReference: https://go-vela.github.io/docs/reference/yaml/metadata/"` + Metadata Metadata `yaml:"metadata,omitempty" json:"metadata" jsonschema:"description=Pass extra information.\nReference: https://go-vela.github.io/docs/reference/yaml/metadata/"` Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Provide global environment variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` - Worker Worker `yaml:"worker,omitempty" json:"worker,omitempty" jsonschema:"description=Limit the pipeline to certain types of workers.\nReference: https://go-vela.github.io/docs/reference/yaml/worker/"` + Worker Worker `yaml:"worker,omitempty" json:"worker" jsonschema:"description=Limit the pipeline to certain types of workers.\nReference: https://go-vela.github.io/docs/reference/yaml/worker/"` Secrets SecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Provide sensitive information.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/"` Services ServiceSlice `yaml:"services,omitempty" json:"services,omitempty" jsonschema:"description=Provide detached (headless) execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/services/"` Stages StageSlice `yaml:"stages,omitempty" json:"stages,omitempty" jsonschema:"oneof_required=stages,description=Provide parallel execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/stages/"` Steps StepSlice `yaml:"steps,omitempty" json:"steps,omitempty" jsonschema:"oneof_required=steps,description=Provide sequential execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/"` Templates TemplateSlice `yaml:"templates,omitempty" json:"templates,omitempty" jsonschema:"description=Provide the name of templates to expand.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/"` - Deployment Deployment `yaml:"deployment,omitempty" json:"deployment,omitempty" jsonschema:"description=Provide deployment configuration.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/"` - Git Git `yaml:"git,omitempty" json:"git,omitempty" jsonschema:"description=Provide the git access specifications.\nReference: https://go-vela.github.io/docs/reference/yaml/git/"` + Deployment Deployment `yaml:"deployment,omitempty" json:"deployment" jsonschema:"description=Provide deployment configuration.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/"` + Git Git `yaml:"git,omitempty" json:"git" jsonschema:"description=Provide the git access specifications.\nReference: https://go-vela.github.io/docs/reference/yaml/git/"` } // ToPipelineAPI converts the Build type to an API Pipeline type. @@ -86,7 +86,7 @@ func (b *Build) hasArtifacts() bool { } // UnmarshalYAML implements the Unmarshaler interface for the Build type. -func (b *Build) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (b *Build) UnmarshalYAML(unmarshal func(any) error) error { // build we try unmarshalling to build := new(struct { Version string diff --git a/compiler/types/yaml/build_test.go b/compiler/types/yaml/build_test.go index 84353473e..1ecd877ff 100644 --- a/compiler/types/yaml/build_test.go +++ b/compiler/types/yaml/build_test.go @@ -242,11 +242,11 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) { }, { Name: "docker_build", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "dry_run": true, "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, Image: "plugins/docker:18.09", Pull: "always", @@ -260,10 +260,10 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) { }, { Name: "docker_publish", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, Image: "plugins/docker:18.09", Pull: "always", @@ -332,7 +332,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) { { Origin: Origin{ Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.example.com", }, Pull: "always", diff --git a/compiler/types/yaml/deployment.go b/compiler/types/yaml/deployment.go index 6cd3db4e6..c68063017 100644 --- a/compiler/types/yaml/deployment.go +++ b/compiler/types/yaml/deployment.go @@ -13,7 +13,7 @@ type ( Deployment struct { Targets raw.StringSlice `yaml:"targets,omitempty" json:"targets,omitempty" jsonschema:"description=List of deployment targets for the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-targets-key"` Parameters ParameterMap `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=List of parameters for the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"` - Template StepTemplate `yaml:"template,omitempty" json:"template,omitempty" jsonschema:"description=Name of template to expand in the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-template-key"` + Template StepTemplate `yaml:"template,omitempty" json:"template" jsonschema:"description=Name of template to expand in the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-template-key"` } // ParameterMap is the yaml representation diff --git a/compiler/types/yaml/git.go b/compiler/types/yaml/git.go index fc740d86e..403c9da67 100644 --- a/compiler/types/yaml/git.go +++ b/compiler/types/yaml/git.go @@ -10,7 +10,7 @@ import ( // Git is the yaml representation of git configurations for a pipeline. type Git struct { - Token `yaml:"token,omitempty" json:"token,omitempty" jsonschema:"description=Provide the git token specifications, primarily used for cloning.\nReference: https://go-vela.github.io/docs/reference/yaml/git/#token"` + Token `yaml:"token,omitempty" json:"token" jsonschema:"description=Provide the git token specifications, primarily used for cloning.\nReference: https://go-vela.github.io/docs/reference/yaml/git/#token"` } // Token is the yaml representation of the git token. diff --git a/compiler/types/yaml/metadata.go b/compiler/types/yaml/metadata.go index 89d21c369..5d5912bcd 100644 --- a/compiler/types/yaml/metadata.go +++ b/compiler/types/yaml/metadata.go @@ -3,6 +3,8 @@ package yaml import ( + "slices" + "github.com/go-vela/server/compiler/types/pipeline" ) @@ -71,11 +73,5 @@ func (m *Metadata) ToPipeline() *pipeline.Metadata { // HasEnvironment checks if the container type // is contained within the environment list. func (m *Metadata) HasEnvironment(container string) bool { - for _, e := range m.Environment { - if e == container { - return true - } - } - - return false + return slices.Contains(m.Environment, container) } diff --git a/compiler/types/yaml/ruleset.go b/compiler/types/yaml/ruleset.go index 0b8ae8f00..75f269a01 100644 --- a/compiler/types/yaml/ruleset.go +++ b/compiler/types/yaml/ruleset.go @@ -14,8 +14,8 @@ type ( // Ruleset is the yaml representation of a // ruleset block for a step in a pipeline. Ruleset struct { - If Rules `yaml:"if,omitempty" json:"if,omitempty" jsonschema:"description=Limit execution to when all rules match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` - Unless Rules `yaml:"unless,omitempty" json:"unless,omitempty" jsonschema:"description=Limit execution to when all rules do not match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + If Rules `yaml:"if,omitempty" json:"if" jsonschema:"description=Limit execution to when all rules match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + Unless Rules `yaml:"unless,omitempty" json:"unless" jsonschema:"description=Limit execution to when all rules do not match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` Matcher string `yaml:"matcher,omitempty" json:"matcher,omitempty" jsonschema:"enum=filepath,enum=regexp,default=filepath,description=Use the defined matching method.\nReference: coming soon"` Operator string `yaml:"operator,omitempty" json:"operator,omitempty" jsonschema:"enum=or,enum=and,default=and,description=Whether all rule conditions must be met or just any one of them.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` Continue bool `yaml:"continue,omitempty" json:"continue,omitempty" jsonschema:"default=false,description=Limits the execution of a step to continuing on any failure.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` @@ -54,7 +54,7 @@ func (r *Ruleset) ToPipeline() *pipeline.Ruleset { } // UnmarshalYAML implements the Unmarshaler interface for the Ruleset type. -func (r *Ruleset) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (r *Ruleset) UnmarshalYAML(unmarshal func(any) error) error { // simple struct we try unmarshalling to simple := new(Rules) @@ -163,7 +163,7 @@ func (r *Rules) ToPipeline() *pipeline.Rules { } // UnmarshalYAML implements the Unmarshaler interface for the Rules type. -func (r *Rules) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (r *Rules) UnmarshalYAML(unmarshal func(any) error) error { // rules struct we try unmarshalling to rules := new(struct { Branch raw.StringSlice diff --git a/compiler/types/yaml/secret.go b/compiler/types/yaml/secret.go index 37f408fb7..5cf803de7 100644 --- a/compiler/types/yaml/secret.go +++ b/compiler/types/yaml/secret.go @@ -5,6 +5,7 @@ package yaml import ( "errors" "fmt" + "maps" "strings" "github.com/invopop/jsonschema" @@ -26,21 +27,21 @@ type ( Key string `yaml:"key,omitempty" json:"key,omitempty" jsonschema:"minLength=1,description=Path to secret to fetch from storage backend.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-key-key"` Engine string `yaml:"engine,omitempty" json:"engine,omitempty" jsonschema:"enum=native,enum=vault,default=native,description=Name of storage backend to fetch secret from.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-engine-key"` Type string `yaml:"type,omitempty" json:"type,omitempty" jsonschema:"enum=repo,enum=org,enum=shared,default=repo,description=Type of secret to fetch from storage backend.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-type-key"` - Origin Origin `yaml:"origin,omitempty" json:"origin,omitempty" jsonschema:"description=Declaration to pull secrets from non-internal secret providers.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-origin-key"` + Origin Origin `yaml:"origin,omitempty" json:"origin" jsonschema:"description=Declaration to pull secrets from non-internal secret providers.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-origin-key"` Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=step_start,enum=build_start,default=build_start,description=When to pull in secrets from storage backend.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-pull-key"` } // Origin is the yaml representation of a method // for looking up secrets with a secret plugin. Origin struct { - Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Variables to inject into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` - Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"required,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` - Parameters map[string]interface{} `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for the secret plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` - Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Secrets to inject that are necessary to retrieve the secrets.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` - Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` - Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset,omitempty" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` - IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` + Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Variables to inject into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` + Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"required,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` + Parameters map[string]any `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for the secret plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` + Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Secrets to inject that are necessary to retrieve the secrets.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` + Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` + Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` } ) @@ -67,7 +68,7 @@ func (s *SecretSlice) ToPipeline() *pipeline.SecretSlice { } // UnmarshalYAML implements the Unmarshaler interface for the SecretSlice type. -func (s *SecretSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *SecretSlice) UnmarshalYAML(unmarshal func(any) error) error { // secret slice we try unmarshalling to secretSlice := new([]*Secret) @@ -177,10 +178,8 @@ func (o *Origin) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the secret environment variable - o.Environment[key] = value - } + // set or update the secret environment variable + maps.Copy(o.Environment, environment) return nil } @@ -231,7 +230,7 @@ func (s *StepSecretSlice) ToPipeline() *pipeline.StepSecretSlice { } // UnmarshalYAML implements the Unmarshaler interface for the StepSecretSlice type. -func (s *StepSecretSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *StepSecretSlice) UnmarshalYAML(unmarshal func(any) error) error { // string slice we try unmarshalling to stringSlice := new(raw.StringSlice) diff --git a/compiler/types/yaml/secret_test.go b/compiler/types/yaml/secret_test.go index 34037fc7d..6e9f2b9b2 100644 --- a/compiler/types/yaml/secret_test.go +++ b/compiler/types/yaml/secret_test.go @@ -24,10 +24,10 @@ func TestYaml_Origin_MergeEnv(t *testing.T) { Name: "vault", Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.example.com", "auth_method": "token", - "items": []interface{}{ + "items": []any{ map[string]string{"source": "secret/docker", "path": "docker"}, }, }, @@ -57,10 +57,10 @@ func TestYaml_Origin_MergeEnv(t *testing.T) { Name: "vault", Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.example.com", "auth_method": "token", - "items": []interface{}{ + "items": []any{ map[string]string{"source": "secret/docker", "path": "docker"}, }, }, @@ -120,7 +120,7 @@ func TestYaml_SecretSlice_ToPipeline(t *testing.T) { Name: "vault", Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.company.com", }, Pull: "always", @@ -252,7 +252,7 @@ func TestYaml_SecretSlice_UnmarshalYAML(t *testing.T) { Origin: Origin{ Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.company.com", }, Pull: "always", @@ -284,7 +284,7 @@ func TestYaml_SecretSlice_UnmarshalYAML(t *testing.T) { Origin: Origin{ Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.company.com", }, Pull: "always", diff --git a/compiler/types/yaml/service.go b/compiler/types/yaml/service.go index 6a2dc75b1..5c81ddbdc 100644 --- a/compiler/types/yaml/service.go +++ b/compiler/types/yaml/service.go @@ -4,6 +4,7 @@ package yaml import ( "fmt" + "maps" "strings" "github.com/go-vela/server/compiler/types/pipeline" @@ -27,7 +28,7 @@ type ( Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/services/#the-pul-key"` Ulimits UlimitSlice `yaml:"ulimits,omitempty" json:"ulimits,omitempty" jsonschema:"description=Set the user limits for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/services/#the-ulimits-key"` User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-key"` - Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset,omitempty" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` } ) @@ -58,7 +59,7 @@ func (s *ServiceSlice) ToPipeline() *pipeline.ContainerSlice { } // UnmarshalYAML implements the Unmarshaler interface for the ServiceSlice type. -func (s *ServiceSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *ServiceSlice) UnmarshalYAML(unmarshal func(any) error) error { // service slice we try unmarshalling to serviceSlice := new([]*Service) @@ -126,10 +127,8 @@ func (s *Service) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the service environment variable - s.Environment[key] = value - } + // set or update the service environment variable + maps.Copy(s.Environment, environment) return nil } diff --git a/compiler/types/yaml/stage.go b/compiler/types/yaml/stage.go index 2fd485d73..62a19c15a 100644 --- a/compiler/types/yaml/stage.go +++ b/compiler/types/yaml/stage.go @@ -4,6 +4,8 @@ package yaml import ( "fmt" + "maps" + "slices" "github.com/invopop/jsonschema" "go.yaml.in/yaml/v3" @@ -79,10 +81,8 @@ func (s *StageSlice) UnmarshalYAML(v *yaml.Node) error { if stage.Name != constants.CloneName && stage.Name != constants.InitName { // add clone if not present stage.Needs = func(needs []string) []string { - for _, s := range needs { - if s == constants.CloneName { - return needs - } + if slices.Contains(needs, constants.CloneName) { + return needs } return append(needs, constants.CloneName) @@ -96,7 +96,7 @@ func (s *StageSlice) UnmarshalYAML(v *yaml.Node) error { } // MarshalYAML implements the marshaler interface for the StageSlice type. -func (s StageSlice) MarshalYAML() (interface{}, error) { +func (s StageSlice) MarshalYAML() (any, error) { output := new(yaml.Node) output.Kind = yaml.MappingNode @@ -161,10 +161,8 @@ func (s *Stage) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the stage environment variable - s.Environment[key] = value - } + // set or update the stage environment variable + maps.Copy(s.Environment, environment) return nil } diff --git a/compiler/types/yaml/step.go b/compiler/types/yaml/step.go index d588222d7..fde7272a1 100644 --- a/compiler/types/yaml/step.go +++ b/compiler/types/yaml/step.go @@ -4,6 +4,7 @@ package yaml import ( "fmt" + "maps" "strings" "github.com/go-vela/server/compiler/types/pipeline" @@ -19,24 +20,24 @@ type ( // Step is the yaml representation of a step // from the steps block for a pipeline. Step struct { - Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset,omitempty" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` - Commands raw.StringSlice `yaml:"commands,omitempty" json:"commands,omitempty" jsonschema:"description=Execution instructions to run inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-commands-key"` - Entrypoint raw.StringSlice `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty" jsonschema:"description=Command to execute inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-entrypoint-key"` - Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Sensitive variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` - Template StepTemplate `yaml:"template,omitempty" json:"template,omitempty" jsonschema:"oneof_required=template,description=Name of template to expand in the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` - Artifacts Artifacts `yaml:"artifacts,omitempty" json:"artifacts,omitempty" jsonschema:"description=Artifacts configuration for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-artifacts-key"` - Ulimits UlimitSlice `yaml:"ulimits,omitempty" json:"ulimits,omitempty" jsonschema:"description=Set the user limits for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ulimits-key"` - Volumes VolumeSlice `yaml:"volumes,omitempty" json:"volumes,omitempty" jsonschema:"description=Mount volumes for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-volume-key"` - Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"oneof_required=image,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` - Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` - Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Provide environment variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` - Parameters map[string]interface{} `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for a plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` - Detach bool `yaml:"detach,omitempty" json:"detach,omitempty" jsonschema:"description=Run the container in a detached (headless) state.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-detach-key"` - Privileged bool `yaml:"privileged,omitempty" json:"privileged,omitempty" jsonschema:"description=Run the container with extra privileges.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-privileged-key"` - User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-key"` - ReportAs string `yaml:"report_as,omitempty" json:"report_as,omitempty" jsonschema:"description=Set the name of the step to report as.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-report_as-key"` - IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` + Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + Commands raw.StringSlice `yaml:"commands,omitempty" json:"commands,omitempty" jsonschema:"description=Execution instructions to run inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-commands-key"` + Entrypoint raw.StringSlice `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty" jsonschema:"description=Command to execute inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-entrypoint-key"` + Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Sensitive variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` + Template StepTemplate `yaml:"template,omitempty" json:"template" jsonschema:"oneof_required=template,description=Name of template to expand in the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` + Artifacts Artifacts `yaml:"artifacts,omitempty" json:"artifacts" jsonschema:"description=Artifacts configuration for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-artifacts-key"` + Ulimits UlimitSlice `yaml:"ulimits,omitempty" json:"ulimits,omitempty" jsonschema:"description=Set the user limits for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ulimits-key"` + Volumes VolumeSlice `yaml:"volumes,omitempty" json:"volumes,omitempty" jsonschema:"description=Mount volumes for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-volume-key"` + Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"oneof_required=image,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` + Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` + Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Provide environment variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` + Parameters map[string]any `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for a plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` + Detach bool `yaml:"detach,omitempty" json:"detach,omitempty" jsonschema:"description=Run the container in a detached (headless) state.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-detach-key"` + Privileged bool `yaml:"privileged,omitempty" json:"privileged,omitempty" jsonschema:"description=Run the container with extra privileges.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-privileged-key"` + User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-key"` + ReportAs string `yaml:"report_as,omitempty" json:"report_as,omitempty" jsonschema:"description=Set the name of the step to report as.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-report_as-key"` + IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` } ) @@ -73,7 +74,7 @@ func (s *StepSlice) ToPipeline() *pipeline.ContainerSlice { } // UnmarshalYAML implements the Unmarshaler interface for the StepSlice type. -func (s *StepSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *StepSlice) UnmarshalYAML(unmarshal func(any) error) error { // step slice we try unmarshalling to stepSlice := new([]*Step) @@ -141,10 +142,8 @@ func (s *Step) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the step environment variable - s.Environment[key] = value - } + // set or update the step environment variable + maps.Copy(s.Environment, environment) return nil } diff --git a/compiler/types/yaml/step_test.go b/compiler/types/yaml/step_test.go index e4c1901a6..f018c116e 100644 --- a/compiler/types/yaml/step_test.go +++ b/compiler/types/yaml/step_test.go @@ -203,10 +203,10 @@ func TestYaml_StepSlice_UnmarshalYAML(t *testing.T) { Image: "plugins/docker:18.09", Pull: "always", ReportAs: "docker", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, }, { @@ -214,10 +214,10 @@ func TestYaml_StepSlice_UnmarshalYAML(t *testing.T) { Pull: "not_present", Template: StepTemplate{ Name: "docker_publish", - Variables: map[string]interface{}{ + Variables: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, }, }, diff --git a/compiler/types/yaml/template.go b/compiler/types/yaml/template.go index 4055fc9dc..1a540b219 100644 --- a/compiler/types/yaml/template.go +++ b/compiler/types/yaml/template.go @@ -14,23 +14,23 @@ type ( // Template is the yaml representation of a template // from the templates block for a pipeline. Template struct { - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-name-key"` - Source string `yaml:"source,omitempty" json:"source,omitempty" jsonschema:"required,minLength=1,description=Path to template in remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-source-key"` - Format string `yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=starlark,enum=golang,enum=go,default=go,minLength=1,description=language used within the template file \nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-format-key"` - Type string `yaml:"type,omitempty" json:"type,omitempty" jsonschema:"minLength=1,enum=github,enum=file,example=github,description=Type of template provided from the remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-type-key"` - Variables map[string]interface{} `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-variables-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-name-key"` + Source string `yaml:"source,omitempty" json:"source,omitempty" jsonschema:"required,minLength=1,description=Path to template in remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-source-key"` + Format string `yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=starlark,enum=golang,enum=go,default=go,minLength=1,description=language used within the template file \nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-format-key"` + Type string `yaml:"type,omitempty" json:"type,omitempty" jsonschema:"minLength=1,enum=github,enum=file,example=github,description=Type of template provided from the remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-type-key"` + Variables map[string]any `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-variables-key"` } // StepTemplate is the yaml representation of the // template block for a step in a pipeline. StepTemplate struct { - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` - Variables map[string]interface{} `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` + Variables map[string]any `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` } ) // UnmarshalYAML implements the Unmarshaler interface for the TemplateSlice type. -func (t *TemplateSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (t *TemplateSlice) UnmarshalYAML(unmarshal func(any) error) error { // template slice we try unmarshalling to templateSlice := new([]*Template) diff --git a/compiler/types/yaml/ulimit.go b/compiler/types/yaml/ulimit.go index af0fa544b..1ed2bf0d1 100644 --- a/compiler/types/yaml/ulimit.go +++ b/compiler/types/yaml/ulimit.go @@ -47,7 +47,7 @@ func (u *UlimitSlice) ToPipeline() *pipeline.UlimitSlice { } // UnmarshalYAML implements the Unmarshaler interface for the UlimitSlice type. -func (u *UlimitSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (u *UlimitSlice) UnmarshalYAML(unmarshal func(any) error) error { // string slice we try unmarshalling to stringSlice := new(raw.StringSlice) diff --git a/compiler/types/yaml/volume.go b/compiler/types/yaml/volume.go index 58740f652..3d6172f32 100644 --- a/compiler/types/yaml/volume.go +++ b/compiler/types/yaml/volume.go @@ -46,7 +46,7 @@ func (v *VolumeSlice) ToPipeline() *pipeline.VolumeSlice { } // UnmarshalYAML implements the Unmarshaler interface for the VolumeSlice type. -func (v *VolumeSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (v *VolumeSlice) UnmarshalYAML(unmarshal func(any) error) error { // string slice we try unmarshalling to stringSlice := new(raw.StringSlice) diff --git a/database/build/clean.go b/database/build/clean.go index ca0970d0f..d7b48bb40 100644 --- a/database/build/clean.go +++ b/database/build/clean.go @@ -21,7 +21,7 @@ func (e *Engine) CleanBuilds(ctx context.Context, msg string, before int64) (int Table(constants.TableBuild). Where("created < ?", before). Where("status = 'running' OR status = 'pending'"). - Updates(map[string]interface{}{ + Updates(map[string]any{ "status": constants.StatusError, "error": msg, "finished": time.Now().UTC().Unix(), diff --git a/database/build/count_deployment.go b/database/build/count_deployment.go index e36b882f2..595cb2b7f 100644 --- a/database/build/count_deployment.go +++ b/database/build/count_deployment.go @@ -12,7 +12,7 @@ import ( ) // CountBuildsForDeployment gets the count of builds by deployment URL from the database. -func (e *Engine) CountBuildsForDeployment(ctx context.Context, d *api.Deployment, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountBuildsForDeployment(ctx context.Context, d *api.Deployment, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "deployment": d.GetURL(), }).Tracef("getting count of builds for deployment %s", d.GetURL()) diff --git a/database/build/count_deployment_test.go b/database/build/count_deployment_test.go index 6b424c716..750c397cd 100644 --- a/database/build/count_deployment_test.go +++ b/database/build/count_deployment_test.go @@ -97,7 +97,7 @@ func TestBuild_Engine_CountBuildsForDeployment(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/build/count_org.go b/database/build/count_org.go index 156eaae2a..128d5973b 100644 --- a/database/build/count_org.go +++ b/database/build/count_org.go @@ -11,7 +11,7 @@ import ( ) // CountBuildsForOrg gets the count of builds by org name from the database. -func (e *Engine) CountBuildsForOrg(ctx context.Context, org string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountBuildsForOrg(ctx context.Context, org string, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, }).Tracef("getting count of builds for org %s", org) diff --git a/database/build/count_org_test.go b/database/build/count_org_test.go index 4256da23b..a44e1e4bf 100644 --- a/database/build/count_org_test.go +++ b/database/build/count_org_test.go @@ -105,21 +105,21 @@ func TestBuild_Engine_CountBuildsForOrg(t *testing.T) { failure bool name string database *Engine - filters map[string]interface{} + filters map[string]any want int64 }{ { failure: false, name: "postgres without filters", database: _postgres, - filters: map[string]interface{}{}, + filters: map[string]any{}, want: 2, }, { failure: false, name: "postgres with event filter", database: _postgres, - filters: map[string]interface{}{ + filters: map[string]any{ "event": "push", }, want: 2, @@ -128,14 +128,14 @@ func TestBuild_Engine_CountBuildsForOrg(t *testing.T) { failure: false, name: "sqlite3 without filters", database: _sqlite, - filters: map[string]interface{}{}, + filters: map[string]any{}, want: 2, }, { failure: false, name: "sqlite3 with event filter", database: _sqlite, - filters: map[string]interface{}{ + filters: map[string]any{ "event": "push", }, want: 2, diff --git a/database/build/count_repo.go b/database/build/count_repo.go index cdcdb7d62..387a61c81 100644 --- a/database/build/count_repo.go +++ b/database/build/count_repo.go @@ -12,7 +12,7 @@ import ( ) // CountBuildsForRepo gets the count of builds by repo ID from the database. -func (e *Engine) CountBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}, before, after int64) (int64, error) { +func (e *Engine) CountBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]any, before, after int64) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/build/count_repo_test.go b/database/build/count_repo_test.go index 21553af73..272838d5c 100644 --- a/database/build/count_repo_test.go +++ b/database/build/count_repo_test.go @@ -88,7 +88,7 @@ func TestBuild_Engine_CountBuildsForRepo(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/build/count_status.go b/database/build/count_status.go index 0ecbae4d4..cbd708813 100644 --- a/database/build/count_status.go +++ b/database/build/count_status.go @@ -9,7 +9,7 @@ import ( ) // CountBuildsForStatus gets the count of builds by status from the database. -func (e *Engine) CountBuildsForStatus(ctx context.Context, status string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountBuildsForStatus(ctx context.Context, status string, filters map[string]any) (int64, error) { e.logger.Tracef("getting count of builds for status %s", status) // variable to store query results diff --git a/database/build/count_status_test.go b/database/build/count_status_test.go index 9323cac39..a7e666aed 100644 --- a/database/build/count_status_test.go +++ b/database/build/count_status_test.go @@ -87,7 +87,7 @@ func TestBuild_Engine_CountBuildsForStatus(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/build/interface.go b/database/build/interface.go index f2d22d92b..b376d1de9 100644 --- a/database/build/interface.go +++ b/database/build/interface.go @@ -31,13 +31,13 @@ type BuildInterface interface { // CountBuilds defines a function that gets the count of all builds. CountBuilds(context.Context) (int64, error) // CountBuildsForDeployment defines a function that gets the count of builds by deployment url. - CountBuildsForDeployment(context.Context, *api.Deployment, map[string]interface{}) (int64, error) + CountBuildsForDeployment(context.Context, *api.Deployment, map[string]any) (int64, error) // CountBuildsForOrg defines a function that gets the count of builds by org name. - CountBuildsForOrg(context.Context, string, map[string]interface{}) (int64, error) + CountBuildsForOrg(context.Context, string, map[string]any) (int64, error) // CountBuildsForRepo defines a function that gets the count of builds by repo ID. - CountBuildsForRepo(context.Context, *api.Repo, map[string]interface{}, int64, int64) (int64, error) + CountBuildsForRepo(context.Context, *api.Repo, map[string]any, int64, int64) (int64, error) // CountBuildsForStatus defines a function that gets the count of builds by status. - CountBuildsForStatus(context.Context, string, map[string]interface{}) (int64, error) + CountBuildsForStatus(context.Context, string, map[string]any) (int64, error) // CreateBuild defines a function that creates a new build. CreateBuild(context.Context, *api.Build) (*api.Build, error) // DeleteBuild defines a function that deletes an existing build. @@ -55,7 +55,7 @@ type BuildInterface interface { // ListBuildsForDashboardRepo defines a function that gets a list of builds based on dashboard filters. ListBuildsForDashboardRepo(context.Context, *api.Repo, []string, []string) ([]*api.Build, error) // ListBuildsForRepo defines a function that gets a list of builds by repo ID. - ListBuildsForRepo(context.Context, *api.Repo, map[string]interface{}, int64, int64, int, int) ([]*api.Build, error) + ListBuildsForRepo(context.Context, *api.Repo, map[string]any, int64, int64, int, int) ([]*api.Build, error) // ListPendingAndRunningBuilds defines a function that gets a list of pending and running builds. ListPendingAndRunningBuilds(context.Context, string) ([]*api.QueueBuild, error) // ListPendingAndRunningBuildsForRepo defines a function that gets a list of pending and running builds for a repo. diff --git a/database/build/list_repo.go b/database/build/list_repo.go index 95b0c6a94..71bc53895 100644 --- a/database/build/list_repo.go +++ b/database/build/list_repo.go @@ -15,7 +15,7 @@ import ( // ListBuildsForRepo gets a list of builds by repo ID from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}, before, after int64, page, perPage int) ([]*api.Build, error) { +func (e *Engine) ListBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]any, before, after int64, page, perPage int) ([]*api.Build, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/build/list_repo_test.go b/database/build/list_repo_test.go index 0909be480..380a3e7c7 100644 --- a/database/build/list_repo_test.go +++ b/database/build/list_repo_test.go @@ -92,7 +92,7 @@ func TestBuild_Engine_ListBuildsForRepo(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/context.go b/database/context.go index a09637e33..196acbe1d 100644 --- a/database/context.go +++ b/database/context.go @@ -15,7 +15,7 @@ const key = "database" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the database Interface associated with this context. diff --git a/database/integration_test.go b/database/integration_test.go index 5367517fd..ad549c431 100644 --- a/database/integration_test.go +++ b/database/integration_test.go @@ -176,7 +176,7 @@ func testBuilds(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for builds methods := make(map[string]bool) // capture the element type of the build interface - element := reflect.TypeOf(new(build.BuildInterface)).Elem() + element := reflect.TypeFor[build.BuildInterface]() // iterate through all methods found in the build interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for builds @@ -483,7 +483,7 @@ func testDashboards(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for schedules methods := make(map[string]bool) // capture the element type of the schedule interface - element := reflect.TypeOf(new(dashboard.DashboardInterface)).Elem() + element := reflect.TypeFor[dashboard.DashboardInterface]() // iterate through all methods found in the schedule interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for schedules @@ -575,7 +575,7 @@ func testExecutables(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for pipelines methods := make(map[string]bool) // capture the element type of the pipeline interface - element := reflect.TypeOf(new(executable.BuildExecutableInterface)).Elem() + element := reflect.TypeFor[executable.BuildExecutableInterface]() // iterate through all methods found in the pipeline interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for pipelines @@ -664,7 +664,7 @@ func testDeployments(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for deployments methods := make(map[string]bool) // capture the element type of the deployment interface - element := reflect.TypeOf(new(deployment.DeploymentInterface)).Elem() + element := reflect.TypeFor[deployment.DeploymentInterface]() // iterate through all methods found in the deployment interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for deployments @@ -844,7 +844,7 @@ func testHooks(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for hooks methods := make(map[string]bool) // capture the element type of the hook interface - element := reflect.TypeOf(new(hook.HookInterface)).Elem() + element := reflect.TypeFor[hook.HookInterface]() // iterate through all methods found in the hook interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for hooks @@ -1032,7 +1032,7 @@ func testJWKs(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for jwks methods := make(map[string]bool) // capture the element type of the jwk interface - element := reflect.TypeOf(new(dbJWK.JWKInterface)).Elem() + element := reflect.TypeFor[dbJWK.JWKInterface]() // iterate through all methods found in the jwk interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for jwks @@ -1131,7 +1131,7 @@ func testLogs(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for logs methods := make(map[string]bool) // capture the element type of the log interface - element := reflect.TypeOf(new(log.LogInterface)).Elem() + element := reflect.TypeFor[log.LogInterface]() // iterate through all methods found in the log interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for logs @@ -1288,7 +1288,7 @@ func testPipelines(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for pipelines methods := make(map[string]bool) // capture the element type of the pipeline interface - element := reflect.TypeOf(new(pipeline.PipelineInterface)).Elem() + element := reflect.TypeFor[pipeline.PipelineInterface]() // iterate through all methods found in the pipeline interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for pipelines @@ -1479,7 +1479,7 @@ func testRepos(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for repos methods := make(map[string]bool) // capture the element type of the repo interface - element := reflect.TypeOf(new(repo.RepoInterface)).Elem() + element := reflect.TypeFor[repo.RepoInterface]() // iterate through all methods found in the repo interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for repos @@ -1695,7 +1695,7 @@ func testSchedules(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for schedules methods := make(map[string]bool) // capture the element type of the schedule interface - element := reflect.TypeOf(new(schedule.ScheduleInterface)).Elem() + element := reflect.TypeFor[schedule.ScheduleInterface]() // iterate through all methods found in the schedule interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for schedules @@ -1878,7 +1878,7 @@ func testSecrets(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for secrets methods := make(map[string]bool) // capture the element type of the secret interface - element := reflect.TypeOf(new(secret.SecretInterface)).Elem() + element := reflect.TypeFor[secret.SecretInterface]() // iterate through all methods found in the secret interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for secrets @@ -2149,7 +2149,7 @@ func testServices(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for services methods := make(map[string]bool) // capture the element type of the service interface - element := reflect.TypeOf(new(service.ServiceInterface)).Elem() + element := reflect.TypeFor[service.ServiceInterface]() // iterate through all methods found in the service interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for services @@ -2323,7 +2323,7 @@ func testSteps(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for steps methods := make(map[string]bool) // capture the element type of the step interface - element := reflect.TypeOf(new(step.StepInterface)).Elem() + element := reflect.TypeFor[step.StepInterface]() // iterate through all methods found in the step interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for steps @@ -2499,7 +2499,7 @@ func testUsers(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for users methods := make(map[string]bool) // capture the element type of the user interface - element := reflect.TypeOf(new(user.UserInterface)).Elem() + element := reflect.TypeFor[user.UserInterface]() // iterate through all methods found in the user interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for users @@ -2634,7 +2634,7 @@ func testWorkers(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for workers methods := make(map[string]bool) // capture the element type of the worker interface - element := reflect.TypeOf(new(worker.WorkerInterface)).Elem() + element := reflect.TypeFor[worker.WorkerInterface]() // iterate through all methods found in the worker interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for workers @@ -2735,7 +2735,7 @@ func testSettings(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for settings methods := make(map[string]bool) // capture the element type of the settings interface - element := reflect.TypeOf(new(dbSettings.SettingsInterface)).Elem() + element := reflect.TypeFor[dbSettings.SettingsInterface]() // iterate through all methods found in the settings interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for settings diff --git a/database/logger.go b/database/logger.go index 819574704..1ff93c2cf 100644 --- a/database/logger.go +++ b/database/logger.go @@ -37,17 +37,17 @@ func (l *GormLogger) LogMode(logger.LogLevel) logger.Interface { } // Info implements the logger.Interface. -func (l *GormLogger) Info(ctx context.Context, msg string, args ...interface{}) { +func (l *GormLogger) Info(ctx context.Context, msg string, args ...any) { l.entry.WithContext(ctx).Info(msg, args) } // Warn implements the logger.Interface. -func (l *GormLogger) Warn(ctx context.Context, msg string, args ...interface{}) { +func (l *GormLogger) Warn(ctx context.Context, msg string, args ...any) { l.entry.WithContext(ctx).Warn(msg, args) } // Error implements the logger.Interface. -func (l *GormLogger) Error(ctx context.Context, msg string, args ...interface{}) { +func (l *GormLogger) Error(ctx context.Context, msg string, args ...any) { l.entry.WithContext(ctx).Error(msg, args) } diff --git a/database/ping.go b/database/ping.go index 51c502a80..9d294fca5 100644 --- a/database/ping.go +++ b/database/ping.go @@ -12,7 +12,7 @@ func (e *engine) Ping() error { e.logger.Tracef("sending ping request to the %s database", e.Driver()) // create a loop to attempt ping requests 5 times - for i := 0; i < 5; i++ { + for i := range 5 { // capture database/sql database from gorm.io/gorm database _sql, err := e.client.DB() if err != nil { diff --git a/database/repo/count_org.go b/database/repo/count_org.go index 8f4417625..8a6125e16 100644 --- a/database/repo/count_org.go +++ b/database/repo/count_org.go @@ -11,7 +11,7 @@ import ( ) // CountReposForOrg gets the count of repos by org name from the database. -func (e *Engine) CountReposForOrg(ctx context.Context, org string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountReposForOrg(ctx context.Context, org string, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, }).Tracef("getting count of repos for org %s", org) diff --git a/database/repo/count_org_test.go b/database/repo/count_org_test.go index 9444cf0a9..c3bf17c68 100644 --- a/database/repo/count_org_test.go +++ b/database/repo/count_org_test.go @@ -77,7 +77,7 @@ func TestRepo_Engine_CountReposForOrg(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/repo/count_user.go b/database/repo/count_user.go index 2cd366e65..63e622641 100644 --- a/database/repo/count_user.go +++ b/database/repo/count_user.go @@ -12,7 +12,7 @@ import ( ) // CountReposForUser gets the count of repos by user ID from the database. -func (e *Engine) CountReposForUser(ctx context.Context, u *api.User, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountReposForUser(ctx context.Context, u *api.User, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "user": u.GetName(), }).Tracef("getting count of repos for user %s", u.GetName()) diff --git a/database/repo/count_user_test.go b/database/repo/count_user_test.go index de04d0c5f..e897a88eb 100644 --- a/database/repo/count_user_test.go +++ b/database/repo/count_user_test.go @@ -81,7 +81,7 @@ func TestRepo_Engine_CountReposForUser(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/repo/interface.go b/database/repo/interface.go index 56641467d..113d5e5b2 100644 --- a/database/repo/interface.go +++ b/database/repo/interface.go @@ -29,9 +29,9 @@ type RepoInterface interface { // CountRepos defines a function that gets the count of all repos. CountRepos(context.Context) (int64, error) // CountReposForOrg defines a function that gets the count of repos by org name. - CountReposForOrg(context.Context, string, map[string]interface{}) (int64, error) + CountReposForOrg(context.Context, string, map[string]any) (int64, error) // CountReposForUser defines a function that gets the count of repos by user ID. - CountReposForUser(context.Context, *api.User, map[string]interface{}) (int64, error) + CountReposForUser(context.Context, *api.User, map[string]any) (int64, error) // CreateRepo defines a function that creates a new repo. CreateRepo(context.Context, *api.Repo) (*api.Repo, error) // DeleteRepo defines a function that deletes an existing repo. @@ -45,9 +45,9 @@ type RepoInterface interface { // ListRepos defines a function that gets a list of all repos. ListRepos(context.Context) ([]*api.Repo, error) // ListReposForOrg defines a function that gets a list of repos by org name. - ListReposForOrg(context.Context, string, string, map[string]interface{}, int, int) ([]*api.Repo, error) + ListReposForOrg(context.Context, string, string, map[string]any, int, int) ([]*api.Repo, error) // ListReposForUser defines a function that gets a list of repos by user ID. - ListReposForUser(context.Context, *api.User, string, map[string]interface{}, int, int) ([]*api.Repo, error) + ListReposForUser(context.Context, *api.User, string, map[string]any, int, int) ([]*api.Repo, error) // UpdateRepo defines a function that updates an existing repo. UpdateRepo(context.Context, *api.Repo) (*api.Repo, error) } diff --git a/database/repo/list_org.go b/database/repo/list_org.go index c0f02fa2c..66ddcaefb 100644 --- a/database/repo/list_org.go +++ b/database/repo/list_org.go @@ -15,7 +15,7 @@ import ( // ListReposForOrg gets a list of repos by org name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListReposForOrg(ctx context.Context, org, sortBy string, filters map[string]interface{}, page, perPage int) ([]*api.Repo, error) { +func (e *Engine) ListReposForOrg(ctx context.Context, org, sortBy string, filters map[string]any, page, perPage int) ([]*api.Repo, error) { e.logger.WithFields(logrus.Fields{ "org": org, }).Tracef("listing repos for org %s", org) diff --git a/database/repo/list_org_test.go b/database/repo/list_org_test.go index 8aff303de..fb671b84f 100644 --- a/database/repo/list_org_test.go +++ b/database/repo/list_org_test.go @@ -157,7 +157,7 @@ func TestRepo_Engine_ListReposForOrg(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/repo/list_user.go b/database/repo/list_user.go index 2e0f52dc9..0d29cf2a0 100644 --- a/database/repo/list_user.go +++ b/database/repo/list_user.go @@ -15,7 +15,7 @@ import ( // ListReposForUser gets a list of repos by user ID from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListReposForUser(ctx context.Context, u *api.User, sortBy string, filters map[string]interface{}, page, perPage int) ([]*api.Repo, error) { +func (e *Engine) ListReposForUser(ctx context.Context, u *api.User, sortBy string, filters map[string]any, page, perPage int) ([]*api.Repo, error) { e.logger.WithFields(logrus.Fields{ "user": u.GetName(), }).Tracef("listing repos for user %s", u.GetName()) diff --git a/database/repo/list_user_test.go b/database/repo/list_user_test.go index 7fea23252..d49eae238 100644 --- a/database/repo/list_user_test.go +++ b/database/repo/list_user_test.go @@ -156,7 +156,7 @@ func TestRepo_Engine_ListReposForUser(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/count_org.go b/database/secret/count_org.go index c84ef3135..75b39a66c 100644 --- a/database/secret/count_org.go +++ b/database/secret/count_org.go @@ -11,7 +11,7 @@ import ( ) // CountSecretsForOrg gets the count of secrets by org name from the database. -func (e *Engine) CountSecretsForOrg(ctx context.Context, org string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountSecretsForOrg(ctx context.Context, org string, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, "type": constants.SecretOrg, diff --git a/database/secret/count_org_test.go b/database/secret/count_org_test.go index 8208be9a0..cf01f3c2c 100644 --- a/database/secret/count_org_test.go +++ b/database/secret/count_org_test.go @@ -85,7 +85,7 @@ func TestSecret_Engine_CountSecretsForOrg(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/count_repo.go b/database/secret/count_repo.go index 84bad6058..1a66f5d59 100644 --- a/database/secret/count_repo.go +++ b/database/secret/count_repo.go @@ -12,7 +12,7 @@ import ( ) // CountSecretsForRepo gets the count of secrets by org and repo name from the database. -func (e *Engine) CountSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/secret/count_repo_test.go b/database/secret/count_repo_test.go index 632840b08..813d0e3e2 100644 --- a/database/secret/count_repo_test.go +++ b/database/secret/count_repo_test.go @@ -95,7 +95,7 @@ func TestSecret_Engine_CountSecretsForRepo(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/count_team.go b/database/secret/count_team.go index 789a85f14..b5437e41c 100644 --- a/database/secret/count_team.go +++ b/database/secret/count_team.go @@ -12,7 +12,7 @@ import ( ) // CountSecretsForTeam gets the count of secrets by org and team name from the database. -func (e *Engine) CountSecretsForTeam(ctx context.Context, org, team string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountSecretsForTeam(ctx context.Context, org, team string, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, "team": team, @@ -37,7 +37,7 @@ func (e *Engine) CountSecretsForTeam(ctx context.Context, org, team string, filt } // CountSecretsForTeams gets the count of secrets by teams within an org from the database. -func (e *Engine) CountSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]any) (int64, error) { // lower case team names for not case-sensitive values from the SCM i.e. GitHub // // iterate through the list of teams provided diff --git a/database/secret/count_team_test.go b/database/secret/count_team_test.go index 6aa0a6aae..57fca797a 100644 --- a/database/secret/count_team_test.go +++ b/database/secret/count_team_test.go @@ -85,7 +85,7 @@ func TestSecret_Engine_CountSecretsForTeam(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { @@ -193,7 +193,7 @@ func TestSecret_Engine_CountSecretsForTeams(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/interface.go b/database/secret/interface.go index fa37ddd47..46f6da43c 100644 --- a/database/secret/interface.go +++ b/database/secret/interface.go @@ -29,13 +29,13 @@ type SecretInterface interface { // CountSecrets defines a function that gets the count of all secrets. CountSecrets(context.Context) (int64, error) // CountSecretsForOrg defines a function that gets the count of secrets by org name. - CountSecretsForOrg(context.Context, string, map[string]interface{}) (int64, error) + CountSecretsForOrg(context.Context, string, map[string]any) (int64, error) // CountSecretsForRepo defines a function that gets the count of secrets by org and repo name. - CountSecretsForRepo(context.Context, *api.Repo, map[string]interface{}) (int64, error) + CountSecretsForRepo(context.Context, *api.Repo, map[string]any) (int64, error) // CountSecretsForTeam defines a function that gets the count of secrets by org and team name. - CountSecretsForTeam(context.Context, string, string, map[string]interface{}) (int64, error) + CountSecretsForTeam(context.Context, string, string, map[string]any) (int64, error) // CountSecretsForTeams defines a function that gets the count of secrets by teams within an org. - CountSecretsForTeams(context.Context, string, []string, map[string]interface{}) (int64, error) + CountSecretsForTeams(context.Context, string, []string, map[string]any) (int64, error) // CreateSecret defines a function that creates a new secret. CreateSecret(context.Context, *api.Secret) (*api.Secret, error) // DeleteSecret defines a function that deletes an existing secret. @@ -55,13 +55,13 @@ type SecretInterface interface { // ListSecrets defines a function that gets a list of all secrets. ListSecrets(context.Context) ([]*api.Secret, error) // ListSecretsForOrg defines a function that gets a list of secrets by org name. - ListSecretsForOrg(context.Context, string, map[string]interface{}, int, int) ([]*api.Secret, error) + ListSecretsForOrg(context.Context, string, map[string]any, int, int) ([]*api.Secret, error) // ListSecretsForRepo defines a function that gets a list of secrets by org and repo name. - ListSecretsForRepo(context.Context, *api.Repo, map[string]interface{}, int, int) ([]*api.Secret, error) + ListSecretsForRepo(context.Context, *api.Repo, map[string]any, int, int) ([]*api.Secret, error) // ListSecretsForTeam defines a function that gets a list of secrets by org and team name. - ListSecretsForTeam(context.Context, string, string, map[string]interface{}, int, int) ([]*api.Secret, error) + ListSecretsForTeam(context.Context, string, string, map[string]any, int, int) ([]*api.Secret, error) // ListSecretsForTeams defines a function that gets a list of secrets by teams within an org. - ListSecretsForTeams(context.Context, string, []string, map[string]interface{}, int, int) ([]*api.Secret, error) + ListSecretsForTeams(context.Context, string, []string, map[string]any, int, int) ([]*api.Secret, error) // MigrateSecrets defines a function that updates the org and name of all repo secrets when there is a name change. MigrateSecrets(context.Context, string, string, string, string) error // UpdateSecret defines a function that updates an existing secret. diff --git a/database/secret/list_org.go b/database/secret/list_org.go index b2fcf1c70..8bcf06e87 100644 --- a/database/secret/list_org.go +++ b/database/secret/list_org.go @@ -15,7 +15,7 @@ import ( // ListSecretsForOrg gets a list of secrets by org name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListSecretsForOrg(ctx context.Context, org string, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForOrg(ctx context.Context, org string, filters map[string]any, page, perPage int) ([]*api.Secret, error) { e.logger.WithFields(logrus.Fields{ "org": org, "type": constants.SecretOrg, diff --git a/database/secret/list_org_test.go b/database/secret/list_org_test.go index 2756b9bf2..87765d89b 100644 --- a/database/secret/list_org_test.go +++ b/database/secret/list_org_test.go @@ -93,7 +93,7 @@ func TestSecret_Engine_ListSecretsForOrg(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/list_repo.go b/database/secret/list_repo.go index b680968d1..ccf6df308 100644 --- a/database/secret/list_repo.go +++ b/database/secret/list_repo.go @@ -15,7 +15,7 @@ import ( // ListSecretsForRepo gets a list of secrets by org name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]any, page, perPage int) ([]*api.Secret, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/secret/list_repo_test.go b/database/secret/list_repo_test.go index c411bbc57..5cefc83fa 100644 --- a/database/secret/list_repo_test.go +++ b/database/secret/list_repo_test.go @@ -103,7 +103,7 @@ func TestSecret_Engine_ListSecretsForRepo(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/list_team.go b/database/secret/list_team.go index f714aa63f..dd28161b0 100644 --- a/database/secret/list_team.go +++ b/database/secret/list_team.go @@ -16,7 +16,7 @@ import ( // ListSecretsForTeam gets a list of secrets by org and team name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListSecretsForTeam(ctx context.Context, org, team string, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForTeam(ctx context.Context, org, team string, filters map[string]any, page, perPage int) ([]*api.Secret, error) { e.logger.WithFields(logrus.Fields{ "org": org, "team": team, @@ -69,7 +69,7 @@ func (e *Engine) ListSecretsForTeam(ctx context.Context, org, team string, filte } // ListSecretsForTeams gets a list of secrets by teams within an org from the database. -func (e *Engine) ListSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]any, page, perPage int) ([]*api.Secret, error) { // iterate through the list of teams provided for index, team := range teams { // ensure the team name is lower case diff --git a/database/secret/list_team_test.go b/database/secret/list_team_test.go index be1e82c24..8e371d8d3 100644 --- a/database/secret/list_team_test.go +++ b/database/secret/list_team_test.go @@ -95,7 +95,7 @@ func TestSecret_Engine_ListSecretsForTeam(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { @@ -210,7 +210,7 @@ func TestSecret_Engine_ListSecretsForTeams(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/service/count_build.go b/database/service/count_build.go index f985f4fc2..ff81bd932 100644 --- a/database/service/count_build.go +++ b/database/service/count_build.go @@ -12,7 +12,7 @@ import ( ) // CountServicesForBuild gets the count of services by build ID from the database. -func (e *Engine) CountServicesForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountServicesForBuild(ctx context.Context, b *api.Build, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("getting count of services for build %d", b.GetNumber()) diff --git a/database/service/count_build_test.go b/database/service/count_build_test.go index b46fe9e6b..e13e6bbae 100644 --- a/database/service/count_build_test.go +++ b/database/service/count_build_test.go @@ -80,7 +80,7 @@ func TestService_Engine_CountServicesForBuild(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/service/interface.go b/database/service/interface.go index dbb2aa6c9..8899637f0 100644 --- a/database/service/interface.go +++ b/database/service/interface.go @@ -29,7 +29,7 @@ type ServiceInterface interface { // CountServices defines a function that gets the count of all services. CountServices(context.Context) (int64, error) // CountServicesForBuild defines a function that gets the count of services by build ID. - CountServicesForBuild(context.Context, *api.Build, map[string]interface{}) (int64, error) + CountServicesForBuild(context.Context, *api.Build, map[string]any) (int64, error) // CreateService defines a function that creates a new service. CreateService(context.Context, *api.Service) (*api.Service, error) // DeleteService defines a function that deletes an existing service. @@ -41,7 +41,7 @@ type ServiceInterface interface { // ListServices defines a function that gets a list of all services. ListServices(context.Context) ([]*api.Service, error) // ListServicesForBuild defines a function that gets a list of services by build ID. - ListServicesForBuild(context.Context, *api.Build, map[string]interface{}, int, int) ([]*api.Service, error) + ListServicesForBuild(context.Context, *api.Build, map[string]any, int, int) ([]*api.Service, error) // ListServiceImageCount defines a function that gets a list of all service images and the count of their occurrence. ListServiceImageCount(context.Context) (map[string]float64, error) // ListServiceStatusCount defines a function that gets a list of all service statuses and the count of their occurrence. diff --git a/database/service/list_build.go b/database/service/list_build.go index f251de4a6..93d5c9d03 100644 --- a/database/service/list_build.go +++ b/database/service/list_build.go @@ -13,7 +13,7 @@ import ( ) // ListServicesForBuild gets a list of all services from the database. -func (e *Engine) ListServicesForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}, page int, perPage int) ([]*api.Service, error) { +func (e *Engine) ListServicesForBuild(ctx context.Context, b *api.Build, filters map[string]any, page int, perPage int) ([]*api.Service, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("listing services for build %d", b.GetNumber()) diff --git a/database/service/list_build_test.go b/database/service/list_build_test.go index af383c3f3..c024e8c53 100644 --- a/database/service/list_build_test.go +++ b/database/service/list_build_test.go @@ -80,7 +80,7 @@ func TestService_Engine_ListServicesForBuild(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/step/count_build.go b/database/step/count_build.go index a25af4008..a828db4b5 100644 --- a/database/step/count_build.go +++ b/database/step/count_build.go @@ -12,7 +12,7 @@ import ( ) // CountStepsForBuild gets the count of steps by build ID from the database. -func (e *Engine) CountStepsForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountStepsForBuild(ctx context.Context, b *api.Build, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("getting count of steps for build %d", b.GetNumber()) diff --git a/database/step/count_build_test.go b/database/step/count_build_test.go index fead13b93..a88d964ec 100644 --- a/database/step/count_build_test.go +++ b/database/step/count_build_test.go @@ -82,7 +82,7 @@ func TestStep_Engine_CountStepsForBuild(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/step/interface.go b/database/step/interface.go index 83fcda729..9c192bf89 100644 --- a/database/step/interface.go +++ b/database/step/interface.go @@ -29,7 +29,7 @@ type StepInterface interface { // CountSteps defines a function that gets the count of all steps. CountSteps(context.Context) (int64, error) // CountStepsForBuild defines a function that gets the count of steps by build ID. - CountStepsForBuild(context.Context, *api.Build, map[string]interface{}) (int64, error) + CountStepsForBuild(context.Context, *api.Build, map[string]any) (int64, error) // CreateStep defines a function that creates a new step. CreateStep(context.Context, *api.Step) (*api.Step, error) // DeleteStep defines a function that deletes an existing step. @@ -41,7 +41,7 @@ type StepInterface interface { // ListSteps defines a function that gets a list of all steps. ListSteps(ctx context.Context) ([]*api.Step, error) // ListStepsForBuild defines a function that gets a list of steps by build ID. - ListStepsForBuild(context.Context, *api.Build, map[string]interface{}, int, int) ([]*api.Step, error) + ListStepsForBuild(context.Context, *api.Build, map[string]any, int, int) ([]*api.Step, error) // ListStepImageCount defines a function that gets a list of all step images and the count of their occurrence. ListStepImageCount(context.Context) (map[string]float64, error) // ListStepStatusCount defines a function that gets a list of all step statuses and the count of their occurrence. diff --git a/database/step/list_build.go b/database/step/list_build.go index e6fcd1862..7d323c6d9 100644 --- a/database/step/list_build.go +++ b/database/step/list_build.go @@ -13,7 +13,7 @@ import ( ) // ListStepsForBuild gets a list of all steps from the database. -func (e *Engine) ListStepsForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}, page int, perPage int) ([]*api.Step, error) { +func (e *Engine) ListStepsForBuild(ctx context.Context, b *api.Build, filters map[string]any, page int, perPage int) ([]*api.Step, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("listing steps for build %d", b.GetNumber()) diff --git a/database/step/list_build_test.go b/database/step/list_build_test.go index e46f59705..50faa1616 100644 --- a/database/step/list_build_test.go +++ b/database/step/list_build_test.go @@ -83,7 +83,7 @@ func TestStep_Engine_ListStepsForBuild(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/testutils/mock_args.go b/database/testutils/mock_args.go index 62d9f07fb..463e1fe33 100644 --- a/database/testutils/mock_args.go +++ b/database/testutils/mock_args.go @@ -39,12 +39,12 @@ func (t NowTimestamp) Match(v driver.Value) bool { } var JwkKeyOpts = cmp.Options{ - cmp.FilterValues(func(x, y interface{}) bool { + cmp.FilterValues(func(x, y any) bool { _, xOk := x.(jwk.RSAPublicKey) _, yOk := y.(jwk.RSAPublicKey) return xOk && yOk - }, cmp.Comparer(func(x, y interface{}) bool { + }, cmp.Comparer(func(x, y any) bool { xJWK := x.(jwk.RSAPublicKey) yJWK := y.(jwk.RSAPublicKey) diff --git a/database/types/dashboard.go b/database/types/dashboard.go index fc90e3818..6d82250c1 100644 --- a/database/types/dashboard.go +++ b/database/types/dashboard.go @@ -49,7 +49,7 @@ func (r DashReposJSON) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for DashReposJSON. -func (r *DashReposJSON) Scan(value interface{}) error { +func (r *DashReposJSON) Scan(value any) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &r) @@ -67,7 +67,7 @@ func (a AdminsJSON) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for AdminsJSON. -func (a *AdminsJSON) Scan(value interface{}) error { +func (a *AdminsJSON) Scan(value any) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &a) diff --git a/database/types/deployment_test.go b/database/types/deployment_test.go index 7f5db4d9f..a93ab9226 100644 --- a/database/types/deployment_test.go +++ b/database/types/deployment_test.go @@ -233,7 +233,7 @@ func generateBuilds(amount int) []string { // initialize empty builds builds := []string{} - for i := 0; i < amount; i++ { + for range amount { builds = append(builds, "123456789") } diff --git a/database/types/settings.go b/database/types/settings.go index c64d4c6a2..209b93735 100644 --- a/database/types/settings.go +++ b/database/types/settings.go @@ -69,7 +69,7 @@ func (r Compiler) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for Compiler. -func (r *Compiler) Scan(value interface{}) error { +func (r *Compiler) Scan(value any) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &r) @@ -87,7 +87,7 @@ func (r Queue) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for Queue. -func (r *Queue) Scan(value interface{}) error { +func (r *Queue) Scan(value any) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &r) @@ -105,7 +105,7 @@ func (s SCM) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for Queue. -func (s *SCM) Scan(value interface{}) error { +func (s *SCM) Scan(value any) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &s) diff --git a/database/types/user_test.go b/database/types/user_test.go index 3d02427e8..d4d1430fb 100644 --- a/database/types/user_test.go +++ b/database/types/user_test.go @@ -280,7 +280,7 @@ func exceededField(indexes int) []string { values := []string{} // add enough strings to exceed the character limit - for i := 0; i < indexes; i++ { + for i := range indexes { // construct field // use i to adhere to unique favorites field := "github/octocat-" + strconv.Itoa(i) diff --git a/database/types/worker_test.go b/database/types/worker_test.go index 89cea1b2c..e748c95e4 100644 --- a/database/types/worker_test.go +++ b/database/types/worker_test.go @@ -200,7 +200,7 @@ func exceededRunningBuildIDs() []string { runningBuildIDs := []string{} // add enough build ids to exceed the character limit - for i := 0; i < 50; i++ { + for i := range 50 { // construct runningBuildID // use i to adhere to unique runningBuildIDs runningBuildID := "1234567890-" + strconv.Itoa(i) diff --git a/go.sum b/go.sum index 4d661f200..90de15586 100644 --- a/go.sum +++ b/go.sum @@ -403,7 +403,6 @@ golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 h1:merA0rdPeUV3YIIfHHcH4qBkiQAc1nfCKSI7lB4cV2M= diff --git a/internal/token/parse.go b/internal/token/parse.go index 74d1a6ee8..c02e381a1 100644 --- a/internal/token/parse.go +++ b/internal/token/parse.go @@ -22,7 +22,7 @@ func (tm *Manager) ParseToken(token string) (*Claims, error) { p := jwt.NewParser(jwt.WithValidMethods([]string{jwt.SigningMethodHS256.Name})) // parse and validate given token - tkn, err := p.ParseWithClaims(token, claims, func(t *jwt.Token) (interface{}, error) { + tkn, err := p.ParseWithClaims(token, claims, func(t *jwt.Token) (any, error) { var err error // extract the claims from the token diff --git a/internal/yaml_test.go b/internal/yaml_test.go index e70c063f8..95f3c921c 100644 --- a/internal/yaml_test.go +++ b/internal/yaml_test.go @@ -23,7 +23,7 @@ func TestInternal_ParseYAML(t *testing.T) { &yaml.Step{ Name: "example", Image: "alpine:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "REGION": "dev", }, Pull: "not_present", diff --git a/mock/server/build.go b/mock/server/build.go index 25b694d6e..cd8ee5889 100644 --- a/mock/server/build.go +++ b/mock/server/build.go @@ -553,12 +553,11 @@ func getInstallToken(c *gin.Context) { var body api.Token - data := []byte( - fmt.Sprintf( + data := + fmt.Appendf(nil, InstallTokenResp, time.Now().Add(1*time.Hour).Unix(), - ), - ) + ) _ = json.Unmarshal(data, &body) diff --git a/mock/server/build_test.go b/mock/server/build_test.go index 0d7c4825a..0836d37b0 100644 --- a/mock/server/build_test.go +++ b/mock/server/build_test.go @@ -18,7 +18,7 @@ func TestBuild_ActiveBuildResp(t *testing.T) { t.Errorf("error unmarshaling build: %v", err) } - tBuild := reflect.TypeOf(testBuild) + tBuild := reflect.TypeFor[api.Build]() for i := 0; i < tBuild.NumField(); i++ { if reflect.ValueOf(testBuild).Field(i).IsNil() { diff --git a/mock/server/dashboard_test.go b/mock/server/dashboard_test.go index 0c4e42187..2787f1e50 100644 --- a/mock/server/dashboard_test.go +++ b/mock/server/dashboard_test.go @@ -18,7 +18,7 @@ func TestDashboard_ActiveDashboardResp(t *testing.T) { t.Errorf("error unmarshaling dashboard: %v", err) } - tDashboard := reflect.TypeOf(testDashboard) + tDashboard := reflect.TypeFor[api.Dashboard]() for i := 0; i < tDashboard.NumField(); i++ { if reflect.ValueOf(testDashboard).Field(i).IsNil() { @@ -33,7 +33,7 @@ func TestDashboard_ActiveDashboardResp(t *testing.T) { t.Errorf("error unmarshaling dash card: %v", err) } - tDashCard := reflect.TypeOf(testDashCard) + tDashCard := reflect.TypeFor[api.DashCard]() for i := 0; i < tDashCard.NumField(); i++ { if reflect.ValueOf(testDashCard).Field(i).IsNil() { @@ -49,7 +49,7 @@ func TestDashboard_ActiveDashboardResp(t *testing.T) { } for _, testDashCard := range testDashCards { - tDashCard := reflect.TypeOf(testDashCard) + tDashCard := reflect.TypeFor[api.DashCard]() for i := 0; i < tDashCard.NumField(); i++ { if reflect.ValueOf(testDashCard).Field(i).IsNil() { diff --git a/mock/server/deployment_test.go b/mock/server/deployment_test.go index fd5862e11..db85d78fb 100644 --- a/mock/server/deployment_test.go +++ b/mock/server/deployment_test.go @@ -18,7 +18,7 @@ func TestDeployment_ActiveDeploymentResp(t *testing.T) { t.Errorf("error unmarshaling deployment: %v", err) } - tDeployment := reflect.TypeOf(testDeployment) + tDeployment := reflect.TypeFor[api.Deployment]() for i := 0; i < tDeployment.NumField(); i++ { if reflect.ValueOf(testDeployment).Field(i).IsNil() { diff --git a/mock/server/hook_test.go b/mock/server/hook_test.go index 8ce8af220..808560eb1 100644 --- a/mock/server/hook_test.go +++ b/mock/server/hook_test.go @@ -18,7 +18,7 @@ func TestHook_ActiveHookResp(t *testing.T) { t.Errorf("error unmarshaling hook: %v", err) } - tHook := reflect.TypeOf(testHook) + tHook := reflect.TypeFor[api.Hook]() for i := 0; i < tHook.NumField(); i++ { if reflect.ValueOf(testHook).Field(i).IsNil() { diff --git a/mock/server/log_test.go b/mock/server/log_test.go index 28fbdc4a9..6feca0e15 100644 --- a/mock/server/log_test.go +++ b/mock/server/log_test.go @@ -18,7 +18,7 @@ func TestLog_ActiveLogResp(t *testing.T) { t.Errorf("error unmarshaling log: %v", err) } - tLog := reflect.TypeOf(testLog) + tLog := reflect.TypeFor[api.Log]() for i := 0; i < tLog.NumField(); i++ { if reflect.ValueOf(testLog).Field(i).IsNil() { diff --git a/mock/server/pipeline.go b/mock/server/pipeline.go index 4544c8041..9b1374140 100644 --- a/mock/server/pipeline.go +++ b/mock/server/pipeline.go @@ -484,7 +484,7 @@ func getTemplates(c *gin.Context) { writeYAML(c, http.StatusOK, body) } -func writeYAML(c *gin.Context, status int, value interface{}) { +func writeYAML(c *gin.Context, status int, value any) { body, err := yml.Marshal(value) if err != nil { msg := fmt.Sprintf("unable to marshal YAML response: %v", err) diff --git a/mock/server/pipeline_test.go b/mock/server/pipeline_test.go index 3f67c6461..715f56f71 100644 --- a/mock/server/pipeline_test.go +++ b/mock/server/pipeline_test.go @@ -18,7 +18,7 @@ func TestPipeline_ActivePipelineResp(t *testing.T) { t.Errorf("error unmarshaling pipeline: %v", err) } - tPipeline := reflect.TypeOf(testPipeline) + tPipeline := reflect.TypeFor[api.Pipeline]() for i := 0; i < tPipeline.NumField(); i++ { if reflect.ValueOf(testPipeline).Field(i).IsNil() { diff --git a/mock/server/repo_test.go b/mock/server/repo_test.go index 19ff8599e..6d473c266 100644 --- a/mock/server/repo_test.go +++ b/mock/server/repo_test.go @@ -18,7 +18,7 @@ func TestRepo_ActiveRepoResp(t *testing.T) { t.Errorf("error unmarshaling repo: %v", err) } - tRepo := reflect.TypeOf(testRepo) + tRepo := reflect.TypeFor[api.Repo]() for i := 0; i < tRepo.NumField(); i++ { if tRepo.Field(i).Name == "Hash" { diff --git a/mock/server/schedule_test.go b/mock/server/schedule_test.go index 293676e02..394bbb7ff 100644 --- a/mock/server/schedule_test.go +++ b/mock/server/schedule_test.go @@ -18,7 +18,7 @@ func TestSchedule_ActiveScheduleResp(t *testing.T) { t.Errorf("error unmarshaling schedule: %v", err) } - tSchedule := reflect.TypeOf(testSchedule) + tSchedule := reflect.TypeFor[api.Schedule]() for i := 0; i < tSchedule.NumField(); i++ { if reflect.ValueOf(testSchedule).Field(i).IsNil() { diff --git a/mock/server/secret_test.go b/mock/server/secret_test.go index 43e7098b1..9db4d96c6 100644 --- a/mock/server/secret_test.go +++ b/mock/server/secret_test.go @@ -18,7 +18,7 @@ func TestSecret_ActiveSecretResp(t *testing.T) { t.Errorf("error unmarshaling secret: %v", err) } - tSecret := reflect.TypeOf(testSecret) + tSecret := reflect.TypeFor[api.Secret]() for i := 0; i < tSecret.NumField(); i++ { if reflect.ValueOf(testSecret).Field(i).IsNil() { diff --git a/mock/server/service_test.go b/mock/server/service_test.go index 70e1da0af..f8b84295c 100644 --- a/mock/server/service_test.go +++ b/mock/server/service_test.go @@ -18,7 +18,7 @@ func TestService_ActiveServiceResp(t *testing.T) { t.Errorf("error unmarshaling service: %v", err) } - tService := reflect.TypeOf(testService) + tService := reflect.TypeFor[api.Service]() for i := 0; i < tService.NumField(); i++ { if reflect.ValueOf(testService).Field(i).IsNil() { diff --git a/mock/server/settings_test.go b/mock/server/settings_test.go index d827cc756..00daecdc9 100644 --- a/mock/server/settings_test.go +++ b/mock/server/settings_test.go @@ -18,7 +18,7 @@ func TestSettings_GetResp(t *testing.T) { t.Errorf("error unmarshaling settings: %v", err) } - tSettings := reflect.TypeOf(testSettings) + tSettings := reflect.TypeFor[settings.Platform]() for i := 0; i < tSettings.NumField(); i++ { f := reflect.ValueOf(testSettings).Field(i) @@ -36,7 +36,7 @@ func TestSettings_UpdateResp(t *testing.T) { t.Errorf("error unmarshaling settings: %v", err) } - tSettings := reflect.TypeOf(testSettings) + tSettings := reflect.TypeFor[settings.Platform]() for i := 0; i < tSettings.NumField(); i++ { f := reflect.ValueOf(testSettings).Field(i) @@ -54,7 +54,7 @@ func TestSettings_RestoreResp(t *testing.T) { t.Errorf("error unmarshaling settings: %v", err) } - tSettings := reflect.TypeOf(testSettings) + tSettings := reflect.TypeFor[settings.Platform]() for i := 0; i < tSettings.NumField(); i++ { f := reflect.ValueOf(testSettings).Field(i) diff --git a/mock/server/step_test.go b/mock/server/step_test.go index 6b1952949..5129a70a3 100644 --- a/mock/server/step_test.go +++ b/mock/server/step_test.go @@ -18,7 +18,7 @@ func TestStep_ActiveStepResp(t *testing.T) { t.Errorf("error unmarshaling step: %v", err) } - tStep := reflect.TypeOf(testStep) + tStep := reflect.TypeFor[api.Step]() for i := 0; i < tStep.NumField(); i++ { if reflect.ValueOf(testStep).Field(i).IsNil() { diff --git a/mock/server/user_test.go b/mock/server/user_test.go index edd4cfc10..60b71941b 100644 --- a/mock/server/user_test.go +++ b/mock/server/user_test.go @@ -18,7 +18,7 @@ func TestUser_ActiveUserResp(t *testing.T) { t.Errorf("error unmarshaling user: %v", err) } - tUser := reflect.TypeOf(testUser) + tUser := reflect.TypeFor[api.User]() for i := 0; i < tUser.NumField(); i++ { if tUser.Field(i).Name == "Token" || tUser.Field(i).Name == "RefreshToken" || tUser.Field(i).Name == "Hash" { diff --git a/mock/server/worker_test.go b/mock/server/worker_test.go index a9a46b810..34d6aa80e 100644 --- a/mock/server/worker_test.go +++ b/mock/server/worker_test.go @@ -18,7 +18,7 @@ func TestWorker_ActiveWorkerResp(t *testing.T) { t.Errorf("error unmarshaling worker: %v", err) } - tWorker := reflect.TypeOf(testWorker) + tWorker := reflect.TypeFor[api.Worker]() for i := 0; i < tWorker.NumField(); i++ { if reflect.ValueOf(testWorker).Field(i).IsNil() { @@ -36,7 +36,7 @@ func TestWorker_ListActiveWorkerResp(t *testing.T) { } for index, worker := range testWorkers { - tWorker := reflect.TypeOf(worker) + tWorker := reflect.TypeFor[api.Worker]() for i := 0; i < tWorker.NumField(); i++ { if reflect.ValueOf(worker).Field(i).IsNil() { diff --git a/queue/context_test.go b/queue/context_test.go index a6f7ab4ee..8cfb568c3 100644 --- a/queue/context_test.go +++ b/queue/context_test.go @@ -52,7 +52,7 @@ func TestExecutor_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value interface{} + value any want Service }{ { diff --git a/queue/redis/redis.go b/queue/redis/redis.go index 4245a7aa5..1df7df826 100644 --- a/queue/redis/redis.go +++ b/queue/redis/redis.go @@ -129,7 +129,7 @@ func failoverFromOptions(source *redis.Options) *redis.FailoverOptions { // the first host from the csv list is set as // the master node all subsequent hosts get // added as sentinel nodes - for _, host := range strings.Split(hosts, ",") { + for host := range strings.SplitSeq(hosts, ",") { if len(target.MasterName) == 0 { target.MasterName = host continue diff --git a/router/middleware/build/context.go b/router/middleware/build/context.go index 6870f5364..38c568c08 100644 --- a/router/middleware/build/context.go +++ b/router/middleware/build/context.go @@ -12,7 +12,7 @@ const key = "build" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Build associated with this context. diff --git a/router/middleware/claims/context.go b/router/middleware/claims/context.go index da800172e..1cd642bcd 100644 --- a/router/middleware/claims/context.go +++ b/router/middleware/claims/context.go @@ -12,7 +12,7 @@ const key = "claims" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Claims associated with this context. diff --git a/router/middleware/cli/context.go b/router/middleware/cli/context.go index f5b098a71..f641e3c2e 100644 --- a/router/middleware/cli/context.go +++ b/router/middleware/cli/context.go @@ -12,7 +12,7 @@ const key = "cli" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the cli command associated with this context. diff --git a/router/middleware/dashboard/context.go b/router/middleware/dashboard/context.go index f0f973015..d2634f69f 100644 --- a/router/middleware/dashboard/context.go +++ b/router/middleware/dashboard/context.go @@ -12,7 +12,7 @@ const key = "dashboard" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Dashboard associated with this context. diff --git a/router/middleware/hook/context.go b/router/middleware/hook/context.go index 640969321..b9fb7fbf5 100644 --- a/router/middleware/hook/context.go +++ b/router/middleware/hook/context.go @@ -12,7 +12,7 @@ const key = "hook" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the hook associated with this context. diff --git a/router/middleware/logger.go b/router/middleware/logger.go index d549b87b4..01e6eacff 100644 --- a/router/middleware/logger.go +++ b/router/middleware/logger.go @@ -176,8 +176,8 @@ func Logger(logger *logrus.Logger, _ string) gin.HandlerFunc { } } -func sanitize(body interface{}) interface{} { - if m, ok := body.(map[string]interface{}); ok { +func sanitize(body any) any { + if m, ok := body.(map[string]any); ok { if _, ok = m["email"]; ok { m["email"] = constants.SecretMask body = m diff --git a/router/middleware/logger_test.go b/router/middleware/logger_test.go index 6eab78282..19fe4a657 100644 --- a/router/middleware/logger_test.go +++ b/router/middleware/logger_test.go @@ -160,7 +160,7 @@ func TestMiddleware_Logger_Error(t *testing.T) { } func TestMiddleware_Logger_Sanitize(t *testing.T) { - var logBody, logWant map[string]interface{} + var logBody, logWant map[string]any r := new(api.Repo) r.SetID(1) diff --git a/router/middleware/org/context.go b/router/middleware/org/context.go index 03f913237..1c141276a 100644 --- a/router/middleware/org/context.go +++ b/router/middleware/org/context.go @@ -10,7 +10,7 @@ const key = "org" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Org associated with this context. diff --git a/router/middleware/payload.go b/router/middleware/payload.go index c362002e7..6de265dca 100644 --- a/router/middleware/payload.go +++ b/router/middleware/payload.go @@ -15,7 +15,7 @@ import ( func Payload() gin.HandlerFunc { return func(c *gin.Context) { // bind JSON payload from request to be added to context - var payload interface{} + var payload any _ = c.BindJSON(&payload) diff --git a/router/middleware/payload_test.go b/router/middleware/payload_test.go index 0ad676fb4..b545682a0 100644 --- a/router/middleware/payload_test.go +++ b/router/middleware/payload_test.go @@ -15,7 +15,7 @@ import ( func TestMiddleware_Payload(t *testing.T) { // setup types - var got interface{} + var got any want := `{"foo": "bar"}` jsonBody, _ := json.Marshal(want) diff --git a/router/middleware/pipeline/context.go b/router/middleware/pipeline/context.go index 8d4ad3563..0a19f809d 100644 --- a/router/middleware/pipeline/context.go +++ b/router/middleware/pipeline/context.go @@ -12,7 +12,7 @@ const key = "pipeline" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Pipeline associated with this context. diff --git a/router/middleware/repo/context.go b/router/middleware/repo/context.go index 73c0db4f1..14b1a1f37 100644 --- a/router/middleware/repo/context.go +++ b/router/middleware/repo/context.go @@ -12,7 +12,7 @@ const key = "repo" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Repo associated with this context. diff --git a/router/middleware/schedule/context.go b/router/middleware/schedule/context.go index 5c8920d01..411ab109b 100644 --- a/router/middleware/schedule/context.go +++ b/router/middleware/schedule/context.go @@ -12,7 +12,7 @@ const key = "schedule" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Schedule associated with this context. diff --git a/router/middleware/service/context.go b/router/middleware/service/context.go index 4098cdea0..9617f1bec 100644 --- a/router/middleware/service/context.go +++ b/router/middleware/service/context.go @@ -12,7 +12,7 @@ const key = "service" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Service associated with this context. diff --git a/router/middleware/settings/context.go b/router/middleware/settings/context.go index f5aa5fb62..cb04ca579 100644 --- a/router/middleware/settings/context.go +++ b/router/middleware/settings/context.go @@ -12,7 +12,7 @@ const key = "settings" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Settings associated with this context. diff --git a/router/middleware/step/context.go b/router/middleware/step/context.go index ae022c6b6..9ef6da785 100644 --- a/router/middleware/step/context.go +++ b/router/middleware/step/context.go @@ -12,7 +12,7 @@ const key = "step" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Step associated with this context. diff --git a/router/middleware/tracing/context.go b/router/middleware/tracing/context.go index ea457bbf1..28b06d55d 100644 --- a/router/middleware/tracing/context.go +++ b/router/middleware/tracing/context.go @@ -12,7 +12,7 @@ const key = "tracing" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the associated value with this context. diff --git a/router/middleware/user/context.go b/router/middleware/user/context.go index 99a4fc3d7..3e6a583c9 100644 --- a/router/middleware/user/context.go +++ b/router/middleware/user/context.go @@ -12,7 +12,7 @@ const key = "user" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the User associated with this context. diff --git a/router/middleware/worker/context.go b/router/middleware/worker/context.go index 2e9772a9e..2fdce7f2d 100644 --- a/router/middleware/worker/context.go +++ b/router/middleware/worker/context.go @@ -12,7 +12,7 @@ const key = "worker" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Worker associated with this context. diff --git a/scm/context.go b/scm/context.go index 25f703db8..f2e1e9d4b 100644 --- a/scm/context.go +++ b/scm/context.go @@ -14,7 +14,7 @@ const key = "scm" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the scm Service diff --git a/scm/github/app_transport.go b/scm/github/app_transport.go index f332d260b..107b1fd99 100644 --- a/scm/github/app_transport.go +++ b/scm/github/app_transport.go @@ -119,7 +119,7 @@ type Transport struct { type accessToken struct { Token string `json:"token"` ExpiresAt time.Time `json:"expires_at"` - Permissions github.InstallationPermissions `json:"permissions,omitempty"` + Permissions github.InstallationPermissions `json:"permissions"` Repositories []github.Repository `json:"repositories,omitempty"` } @@ -242,7 +242,7 @@ func (t *Transport) refreshToken(ctx context.Context) error { } // GetReadWriter converts a body interface into an io.ReadWriter object. -func GetReadWriter(i interface{}) (io.ReadWriter, error) { +func GetReadWriter(i any) (io.ReadWriter, error) { var buf io.ReadWriter if i != nil { diff --git a/scm/github/deployment.go b/scm/github/deployment.go index ccffc87d9..eeba521d1 100644 --- a/scm/github/deployment.go +++ b/scm/github/deployment.go @@ -166,7 +166,7 @@ func (c *Client) CreateDeployment(ctx context.Context, u *api.User, r *api.Repo, // create GitHub OAuth client with user's token client := c.newOAuthTokenClient(ctx, *u.Token) - var payload interface{} + var payload any if d.Payload == nil { payload = make(map[string]string) } else { diff --git a/scm/github/repo.go b/scm/github/repo.go index 890eefb03..eacb166db 100644 --- a/scm/github/repo.go +++ b/scm/github/repo.go @@ -26,7 +26,7 @@ func (c *Client) ConfigBackoff(ctx context.Context, u *api.User, r *api.Repo, re // number of times to retry retryLimit := 5 - for i := 0; i < retryLimit; i++ { + for i := range retryLimit { logrus.Debugf("fetching config file - Attempt %d", i+1) // attempt to fetch the config data, err = c.Config(ctx, u, r, ref) diff --git a/scm/github/status_test.go b/scm/github/status_test.go index 211ec1f0e..686cbcb8b 100644 --- a/scm/github/status_test.go +++ b/scm/github/status_test.go @@ -222,7 +222,7 @@ func TestGithub_Status_PendingApproval_CheckRun_Create(t *testing.T) { resp := httptest.NewRecorder() _, engine := gin.CreateTestContext(resp) - var payload map[string]interface{} + var payload map[string]any // setup mock server engine.POST("/api/v3/repos/:org/:repo/check-runs", func(c *gin.Context) { @@ -282,7 +282,7 @@ func TestGithub_Status_Running_CheckRun_Update(t *testing.T) { resp := httptest.NewRecorder() _, engine := gin.CreateTestContext(resp) - var payload map[string]interface{} + var payload map[string]any // setup mock server engine.PATCH("/api/v3/repos/:org/:repo/check-runs/:id", func(c *gin.Context) { @@ -353,7 +353,7 @@ func TestGithub_StepStatus_Success_CheckRun_Update(t *testing.T) { resp := httptest.NewRecorder() _, engine := gin.CreateTestContext(resp) - var payload map[string]interface{} + var payload map[string]any // setup mock server engine.PATCH("/api/v3/repos/:org/:repo/check-runs/:id", func(c *gin.Context) { diff --git a/scm/github/webhook.go b/scm/github/webhook.go index 630edad70..7d74a2445 100644 --- a/scm/github/webhook.go +++ b/scm/github/webhook.go @@ -205,8 +205,8 @@ func (c *Client) processPushEvent(_ context.Context, h *api.Hook, payload *githu b.SetEvent(constants.EventTag) // set the proper branch from the base ref - if strings.HasPrefix(payload.GetBaseRef(), "refs/heads/") { - b.SetBranch(strings.TrimPrefix(payload.GetBaseRef(), "refs/heads/")) + if after, ok := strings.CutPrefix(payload.GetBaseRef(), "refs/heads/"); ok { + b.SetBranch(after) } } @@ -224,8 +224,8 @@ func (c *Client) processPushEvent(_ context.Context, h *api.Hook, payload *githu // set the proper event for the build b.SetEvent(constants.EventDelete) - if strings.HasPrefix(payload.GetRef(), "refs/tags/") { - b.SetBranch(strings.TrimPrefix(payload.GetRef(), "refs/tags/")) + if after, ok := strings.CutPrefix(payload.GetRef(), "refs/tags/"); ok { + b.SetBranch(after) // set the proper action for the build b.SetEventAction(constants.ActionTag) // set the proper message for the build diff --git a/secret/context.go b/secret/context.go index b1b6eb458..193a69daf 100644 --- a/secret/context.go +++ b/secret/context.go @@ -8,7 +8,7 @@ import ( // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the secret Service diff --git a/secret/vault/count.go b/secret/vault/count.go index e0764ad0c..98ea384b3 100644 --- a/secret/vault/count.go +++ b/secret/vault/count.go @@ -54,7 +54,7 @@ func (c *Client) Count(_ context.Context, sType, org, name string, _ []string) ( } // cast the list of secrets to the expected type - keys, ok := vault.Data["keys"].([]interface{}) + keys, ok := vault.Data["keys"].([]any) if !ok { return 0, fmt.Errorf("not a valid list of secrets from Vault") } diff --git a/secret/vault/create.go b/secret/vault/create.go index f5f520e45..9469aba9e 100644 --- a/secret/vault/create.go +++ b/secret/vault/create.go @@ -61,27 +61,27 @@ func (c *Client) Create(_ context.Context, sType, org, name string, s *api.Secre // createOrg is a helper function to create // the org secret for the provided path. -func (c *Client) createOrg(org, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) createOrg(org, path string, data map[string]any) (*api.Secret, error) { return c.create(fmt.Sprintf("%s/org/%s/%s", c.config.Prefix, org, path), data) } // createRepo is a helper function to create // the repo secret for the provided path. -func (c *Client) createRepo(org, repo, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) createRepo(org, repo, path string, data map[string]any) (*api.Secret, error) { return c.create(fmt.Sprintf("%s/repo/%s/%s/%s", c.config.Prefix, org, repo, path), data) } // createShared is a helper function to create // the shared secret for the provided path. -func (c *Client) createShared(org, team, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) createShared(org, team, path string, data map[string]any) (*api.Secret, error) { return c.create(fmt.Sprintf("%s/shared/%s/%s/%s", c.config.Prefix, org, team, path), data) } // create is a helper function to create // the secret for the provided path. -func (c *Client) create(path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) create(path string, data map[string]any) (*api.Secret, error) { if strings.HasPrefix("secret/data", c.config.Prefix) { - data = map[string]interface{}{ + data = map[string]any{ "data": data, } } diff --git a/secret/vault/list.go b/secret/vault/list.go index 6011ac7c0..e414087db 100644 --- a/secret/vault/list.go +++ b/secret/vault/list.go @@ -62,7 +62,7 @@ func (c *Client) List(ctx context.Context, sType, org, name string, _, _ int, _ } // cast the list of secrets to the expected type - keys, ok := vault.Data["keys"].([]interface{}) + keys, ok := vault.Data["keys"].([]any) if !ok { return nil, fmt.Errorf("not a valid list of secrets from Vault") } @@ -109,9 +109,9 @@ func (c *Client) listShared(org, team string) (*api.Secret, error) { // list of secrets for the provided path. func (c *Client) list(path string) (*api.Secret, error) { // handle k/v v2 - if strings.HasPrefix(path, "secret/data/") { + if after, ok := strings.CutPrefix(path, "secret/data/"); ok { // remove secret/data/ prefix - path = strings.TrimPrefix(path, "secret/data/") + path = after // add secret/metadata/ prefix path = fmt.Sprintf("secret/metadata/%s", path) } diff --git a/secret/vault/refresh.go b/secret/vault/refresh.go index 47678dff2..fdfe64ce5 100644 --- a/secret/vault/refresh.go +++ b/secret/vault/refresh.go @@ -74,7 +74,7 @@ func (c *Client) getAwsToken(ctx context.Context) (string, time.Duration, error) // generateAwsAuthHeader will generate the necessary data // to send to the Vault server for generating a token. -func (c *Client) generateAwsAuthHeader(ctx context.Context) (map[string]interface{}, error) { +func (c *Client) generateAwsAuthHeader(ctx context.Context) (map[string]any, error) { c.Logger.Trace("generating AWS auth headers for vault") if c.AWS.Presigner == nil { @@ -91,7 +91,7 @@ func (c *Client) generateAwsAuthHeader(ctx context.Context) (map[string]interfac return nil, err } - loginData := map[string]interface{}{ + loginData := map[string]any{ "role": c.AWS.Role, "iam_http_request_method": presignedReq.Method, "iam_request_url": base64.StdEncoding.EncodeToString([]byte(presignedReq.URL)), diff --git a/secret/vault/update.go b/secret/vault/update.go index bdbe83551..13b4d0ae5 100644 --- a/secret/vault/update.go +++ b/secret/vault/update.go @@ -92,27 +92,27 @@ func (c *Client) Update(ctx context.Context, sType, org, name string, s *api.Sec // updateOrg is a helper function to update // the org secret for the provided path. -func (c *Client) updateOrg(org, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) updateOrg(org, path string, data map[string]any) (*api.Secret, error) { return c.update(fmt.Sprintf("%s/%s/%s/%s", c.config.Prefix, constants.SecretOrg, org, path), data) } // updateRepo is a helper function to update // the repo secret for the provided path. -func (c *Client) updateRepo(org, repo, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) updateRepo(org, repo, path string, data map[string]any) (*api.Secret, error) { return c.update(fmt.Sprintf("%s/%s/%s/%s/%s", c.config.Prefix, constants.SecretRepo, org, repo, path), data) } // updateShared is a helper function to update // the shared secret for the provided path. -func (c *Client) updateShared(org, team, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) updateShared(org, team, path string, data map[string]any) (*api.Secret, error) { return c.update(fmt.Sprintf("%s/%s/%s/%s/%s", c.config.Prefix, constants.SecretShared, org, team, path), data) } // update is a helper function to update // the secret for the provided path. -func (c *Client) update(path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) update(path string, data map[string]any) (*api.Secret, error) { if strings.HasPrefix("secret/data", c.config.Prefix) { - data = map[string]interface{}{ + data = map[string]any{ "data": data, } } diff --git a/secret/vault/vault.go b/secret/vault/vault.go index 770e4f000..a9e20b08d 100644 --- a/secret/vault/vault.go +++ b/secret/vault/vault.go @@ -148,10 +148,10 @@ func NewWithContext(ctx context.Context, opts ...ClientOpt) (*Client, error) { func secretFromVault(vault *api.Secret) *velaAPI.Secret { s := new(velaAPI.Secret) - var data map[string]interface{} + var data map[string]any // handle k/v v2 if _, ok := vault.Data["data"]; ok { - data = vault.Data["data"].(map[string]interface{}) + data = vault.Data["data"].(map[string]any) } else { data = vault.Data } @@ -173,7 +173,7 @@ func secretFromVault(vault *api.Secret) *velaAPI.Secret { if ok { allowEventsMask := int64(0) - for _, element := range events.([]interface{}) { + for _, element := range events.([]any) { event, ok := element.(string) if ok { switch event { @@ -200,7 +200,7 @@ func secretFromVault(vault *api.Secret) *velaAPI.Secret { // set images if found in Vault secret v, ok = data["images"] if ok { - images, ok := v.([]interface{}) + images, ok := v.([]any) if ok { for _, element := range images { image, ok := element.(string) @@ -353,7 +353,7 @@ func secretFromVault(vault *api.Secret) *velaAPI.Secret { // vaultFromSecret is a helper function to convert a Vela secret to a HashiCorp Vault secret. func vaultFromSecret(s *velaAPI.Secret) *api.Secret { - data := make(map[string]interface{}) + data := make(map[string]any) vault := new(api.Secret) vault.Data = data diff --git a/secret/vault/vault_test.go b/secret/vault/vault_test.go index 54718b4cf..15d2949f5 100644 --- a/secret/vault/vault_test.go +++ b/secret/vault/vault_test.go @@ -101,17 +101,17 @@ func TestVault_secretFromVault(t *testing.T) { } inputV2 := &api.Secret{ - Data: map[string]interface{}{ + Data: map[string]any{ "data": testVaultSecretData(), }, } // test vault secret from pre-v0.23 release inputLegacy := &api.Secret{ - Data: map[string]interface{}{ - "data": map[string]interface{}{ - "events": []interface{}{"push", "tag", "deployment"}, - "images": []interface{}{"foo", "bar"}, + Data: map[string]any{ + "data": map[string]any{ + "events": []any{"push", "tag", "deployment"}, + "images": []any{"foo", "bar"}, "name": "bar", "org": "foo", "repo": "*", @@ -189,7 +189,7 @@ func TestVault_vaultFromSecret(t *testing.T) { s.SetUpdatedBy("octocat2") want := &api.Secret{ - Data: map[string]interface{}{ + Data: map[string]any{ "allow_events": int64(1), "images": []string{"foo", "bar"}, "name": "bar", @@ -217,9 +217,7 @@ func TestVault_vaultFromSecret(t *testing.T) { } func TestVault_AccurateSecretFields(t *testing.T) { - testSecret := velaAPI.Secret{} - - tSecret := reflect.TypeOf(testSecret) + tSecret := reflect.TypeFor[velaAPI.Secret]() vaultSecret := testVaultSecretData() @@ -243,10 +241,10 @@ func TestVault_AccurateSecretFields(t *testing.T) { } // helper function to return a test Vault secret data. -func testVaultSecretData() map[string]interface{} { - return map[string]interface{}{ +func testVaultSecretData() map[string]any { + return map[string]any{ "allow_events": json.Number("8195"), - "images": []interface{}{"foo", "bar"}, + "images": []any{"foo", "bar"}, "name": "bar", "org": "foo", "repo": "*", diff --git a/storage/context.go b/storage/context.go index 4f215b192..b63c3a9e8 100644 --- a/storage/context.go +++ b/storage/context.go @@ -13,7 +13,7 @@ const key = "minio" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext retrieves minio service from the context. diff --git a/storage/context_test.go b/storage/context_test.go index 025f35274..071eeae8c 100644 --- a/storage/context_test.go +++ b/storage/context_test.go @@ -52,7 +52,7 @@ func TestExecutor_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value interface{} + value any want Storage }{ { diff --git a/version/version.go b/version/version.go index efc7a68ae..890ad8cab 100644 --- a/version/version.go +++ b/version/version.go @@ -43,7 +43,7 @@ type Version struct { // PreRelease represents unstable changes that might not be compatible. PreRelease string `json:"pre_release,omitempty"` // Metadata represents extra information surrounding the application version. - Metadata Metadata `json:"metadata,omitempty"` + Metadata Metadata `json:"metadata"` } // Meta implements a formatted string containing only metadata for the Version type. From 2ff785a7791576e051854d88f43904c638628cf3 Mon Sep 17 00:00:00 2001 From: ecrupper Date: Tue, 24 Feb 2026 16:13:21 -0600 Subject: [PATCH 3/5] Revert "chore(deps): upgrade deps and apply fix changes to codebase" This reverts commit 6c2e2f4834e08d4e4b7f6ab4f2d1cdb810924923. --- api/build/compile_publish.go | 2 +- api/build/list_repo.go | 2 +- api/build/update.go | 4 +- api/pipeline/output.go | 2 +- api/repo/list.go | 2 +- api/repo/list_org.go | 2 +- api/schedule/create.go | 2 +- api/scm/sync_org.go | 4 +- api/service/list.go | 2 +- api/step/list.go | 2 +- api/types/secret.go | 2 +- api/types/storage.go | 6 +-- api/types/storage_sts.go | 2 +- api/types/string.go | 8 ++-- api/types/string_test.go | 8 ++-- cache/context_test.go | 2 +- cache/redis/redis.go | 2 +- compiler/context_test.go | 2 +- compiler/engine.go | 8 ++-- compiler/native/compile.go | 11 ++--- compiler/native/compile_test.go | 8 ++-- compiler/native/environment.go | 41 ++++++++++++++----- compiler/native/environment_test.go | 4 +- compiler/native/expand.go | 4 +- compiler/native/expand_test.go | 24 +++++------ compiler/native/parse.go | 4 +- compiler/native/parse_test.go | 16 ++++---- compiler/native/substitute_test.go | 4 +- compiler/native/validate_test.go | 2 +- compiler/template/native/convert.go | 6 +-- compiler/template/native/render.go | 8 ++-- compiler/template/native/render_test.go | 2 +- compiler/template/starlark/convert.go | 6 +-- compiler/template/starlark/convert_test.go | 8 ++-- compiler/template/starlark/render.go | 4 +- compiler/template/starlark/render_test.go | 2 +- compiler/template/starlark/starlark.go | 6 +-- compiler/template/starlark/starlark_test.go | 2 +- compiler/types/pipeline/build.go | 6 +-- compiler/types/pipeline/container.go | 11 ++--- compiler/types/pipeline/ruleset.go | 4 +- compiler/types/pipeline/stage.go | 7 ++-- compiler/types/raw/map.go | 17 ++++---- compiler/types/raw/map_test.go | 2 +- compiler/types/raw/slice.go | 2 +- compiler/types/yaml/build.go | 10 ++--- compiler/types/yaml/build_test.go | 10 ++--- compiler/types/yaml/deployment.go | 2 +- compiler/types/yaml/git.go | 2 +- compiler/types/yaml/metadata.go | 10 +++-- compiler/types/yaml/ruleset.go | 8 ++-- compiler/types/yaml/secret.go | 29 ++++++------- compiler/types/yaml/secret_test.go | 14 +++---- compiler/types/yaml/service.go | 11 ++--- compiler/types/yaml/stage.go | 16 ++++---- compiler/types/yaml/step.go | 45 +++++++++++---------- compiler/types/yaml/step_test.go | 8 ++-- compiler/types/yaml/template.go | 16 ++++---- compiler/types/yaml/ulimit.go | 2 +- compiler/types/yaml/volume.go | 2 +- database/build/clean.go | 2 +- database/build/count_deployment.go | 2 +- database/build/count_deployment_test.go | 2 +- database/build/count_org.go | 2 +- database/build/count_org_test.go | 10 ++--- database/build/count_repo.go | 2 +- database/build/count_repo_test.go | 2 +- database/build/count_status.go | 2 +- database/build/count_status_test.go | 2 +- database/build/interface.go | 10 ++--- database/build/list_repo.go | 2 +- database/build/list_repo_test.go | 2 +- database/context.go | 2 +- database/integration_test.go | 32 +++++++-------- database/logger.go | 6 +-- database/ping.go | 2 +- database/repo/count_org.go | 2 +- database/repo/count_org_test.go | 2 +- database/repo/count_user.go | 2 +- database/repo/count_user_test.go | 2 +- database/repo/interface.go | 8 ++-- database/repo/list_org.go | 2 +- database/repo/list_org_test.go | 2 +- database/repo/list_user.go | 2 +- database/repo/list_user_test.go | 2 +- database/secret/count_org.go | 2 +- database/secret/count_org_test.go | 2 +- database/secret/count_repo.go | 2 +- database/secret/count_repo_test.go | 2 +- database/secret/count_team.go | 4 +- database/secret/count_team_test.go | 4 +- database/secret/interface.go | 16 ++++---- database/secret/list_org.go | 2 +- database/secret/list_org_test.go | 2 +- database/secret/list_repo.go | 2 +- database/secret/list_repo_test.go | 2 +- database/secret/list_team.go | 4 +- database/secret/list_team_test.go | 4 +- database/service/count_build.go | 2 +- database/service/count_build_test.go | 2 +- database/service/interface.go | 4 +- database/service/list_build.go | 2 +- database/service/list_build_test.go | 2 +- database/step/count_build.go | 2 +- database/step/count_build_test.go | 2 +- database/step/interface.go | 4 +- database/step/list_build.go | 2 +- database/step/list_build_test.go | 2 +- database/testutils/mock_args.go | 4 +- database/types/dashboard.go | 4 +- database/types/deployment_test.go | 2 +- database/types/settings.go | 6 +-- database/types/user_test.go | 2 +- database/types/worker_test.go | 2 +- go.sum | 1 + internal/token/parse.go | 2 +- internal/yaml_test.go | 2 +- mock/server/build.go | 7 ++-- mock/server/build_test.go | 2 +- mock/server/dashboard_test.go | 6 +-- mock/server/deployment_test.go | 2 +- mock/server/hook_test.go | 2 +- mock/server/log_test.go | 2 +- mock/server/pipeline.go | 2 +- mock/server/pipeline_test.go | 2 +- mock/server/repo_test.go | 2 +- mock/server/schedule_test.go | 2 +- mock/server/secret_test.go | 2 +- mock/server/service_test.go | 2 +- mock/server/settings_test.go | 6 +-- mock/server/step_test.go | 2 +- mock/server/user_test.go | 2 +- mock/server/worker_test.go | 4 +- queue/context_test.go | 2 +- queue/redis/redis.go | 2 +- router/middleware/build/context.go | 2 +- router/middleware/claims/context.go | 2 +- router/middleware/cli/context.go | 2 +- router/middleware/dashboard/context.go | 2 +- router/middleware/hook/context.go | 2 +- router/middleware/logger.go | 4 +- router/middleware/logger_test.go | 2 +- router/middleware/org/context.go | 2 +- router/middleware/payload.go | 2 +- router/middleware/payload_test.go | 2 +- router/middleware/pipeline/context.go | 2 +- router/middleware/repo/context.go | 2 +- router/middleware/schedule/context.go | 2 +- router/middleware/service/context.go | 2 +- router/middleware/settings/context.go | 2 +- router/middleware/step/context.go | 2 +- router/middleware/tracing/context.go | 2 +- router/middleware/user/context.go | 2 +- router/middleware/worker/context.go | 2 +- scm/context.go | 2 +- scm/github/app_transport.go | 4 +- scm/github/deployment.go | 2 +- scm/github/repo.go | 2 +- scm/github/status_test.go | 6 +-- scm/github/webhook.go | 8 ++-- secret/context.go | 2 +- secret/vault/count.go | 2 +- secret/vault/create.go | 10 ++--- secret/vault/list.go | 6 +-- secret/vault/refresh.go | 4 +- secret/vault/update.go | 10 ++--- secret/vault/vault.go | 10 ++--- secret/vault/vault_test.go | 22 +++++----- storage/context.go | 2 +- storage/context_test.go | 2 +- version/version.go | 2 +- 171 files changed, 444 insertions(+), 406 deletions(-) diff --git a/api/build/compile_publish.go b/api/build/compile_publish.go index 7a33a6c60..33f2358a6 100644 --- a/api/build/compile_publish.go +++ b/api/build/compile_publish.go @@ -116,7 +116,7 @@ func CompileAndPublish( } // create SQL filters for querying pending and running builds for repo - filters := map[string]any{ + filters := map[string]interface{}{ "status": []string{constants.StatusPending, constants.StatusRunning}, } diff --git a/api/build/list_repo.go b/api/build/list_repo.go index 7bc725601..1d06fff45 100644 --- a/api/build/list_repo.go +++ b/api/build/list_repo.go @@ -127,7 +127,7 @@ import ( func ListBuildsForRepo(c *gin.Context) { // variables that will hold the build list, build list filters and total count var ( - filters = map[string]any{} + filters = map[string]interface{}{} b []*types.Build ) diff --git a/api/build/update.go b/api/build/update.go index a87211cd1..aaaf81c2c 100644 --- a/api/build/update.go +++ b/api/build/update.go @@ -230,7 +230,7 @@ func UpdateComponentStatuses(c *gin.Context, b *types.Build, status, scmToken st for page > 0 { // retrieve build steps (per page) from the database - stepsPart, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]any{}, page, perPage) + stepsPart, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]interface{}{}, page, perPage) if err != nil { return err } @@ -285,7 +285,7 @@ func UpdateComponentStatuses(c *gin.Context, b *types.Build, status, scmToken st for page > 0 { // retrieve build services (per page) from the database - servicesPart, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]any{}, page, perPage) + servicesPart, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]interface{}{}, page, perPage) if err != nil { return err } diff --git a/api/pipeline/output.go b/api/pipeline/output.go index e851c58e9..5a0f22440 100644 --- a/api/pipeline/output.go +++ b/api/pipeline/output.go @@ -21,7 +21,7 @@ const ( // writeOutput is a helper function to return the provided value to the // request based off the output query parameter provided. If no output // query parameter is provided, then YAML is used by default. -func writeOutput(c *gin.Context, value any) { +func writeOutput(c *gin.Context, value interface{}) { output := util.QueryParameter(c, "output", outputYAML) // format response body based off output query parameter diff --git a/api/repo/list.go b/api/repo/list.go index f72ccf89a..cc99e7ba2 100644 --- a/api/repo/list.go +++ b/api/repo/list.go @@ -103,7 +103,7 @@ func ListRepos(c *gin.Context) { // capture the query parameters if present: // // * active - filters := map[string]any{ + filters := map[string]interface{}{ "active": util.QueryParameter(c, "active", "true"), } diff --git a/api/repo/list_org.go b/api/repo/list_org.go index 0c4d07a9c..b3ed1461c 100644 --- a/api/repo/list_org.go +++ b/api/repo/list_org.go @@ -123,7 +123,7 @@ func ListReposForOrg(c *gin.Context) { sortBy := util.QueryParameter(c, "sort_by", "name") // prep filters - filters := make(map[string]any) + filters := make(map[string]interface{}) // capture the query parameters if present: // diff --git a/api/schedule/create.go b/api/schedule/create.go index 1dc2bc75b..36741832b 100644 --- a/api/schedule/create.go +++ b/api/schedule/create.go @@ -231,7 +231,7 @@ func validateEntry(minimum time.Duration, entry string) error { // start with now t := time.Now().UTC() - for range tickForward { + for i := 0; i < tickForward; i++ { // check the previous occurrence of the entry prevTime, err := gronx.PrevTickBefore(entry, t, true) if err != nil { diff --git a/api/scm/sync_org.go b/api/scm/sync_org.go index 634361b28..6b92e517e 100644 --- a/api/scm/sync_org.go +++ b/api/scm/sync_org.go @@ -93,7 +93,7 @@ func SyncReposForOrg(c *gin.Context) { } // send API call to capture the total number of repos for the org - t, err := database.FromContext(c).CountReposForOrg(ctx, o, map[string]any{}) + t, err := database.FromContext(c).CountReposForOrg(ctx, o, map[string]interface{}{}) if err != nil { retErr := fmt.Errorf("unable to get repo count for org %s: %w", o, err) @@ -106,7 +106,7 @@ func SyncReposForOrg(c *gin.Context) { page := 0 // capture all repos belonging to a certain org in database for orgRepos := int64(0); orgRepos < t; orgRepos += 100 { - r, err := database.FromContext(c).ListReposForOrg(ctx, o, "name", map[string]any{}, page, 100) + r, err := database.FromContext(c).ListReposForOrg(ctx, o, "name", map[string]interface{}{}, page, 100) if err != nil { retErr := fmt.Errorf("unable to get repo count for org %s: %w", o, err) diff --git a/api/service/list.go b/api/service/list.go index 8a8423ca2..373d16794 100644 --- a/api/service/list.go +++ b/api/service/list.go @@ -120,7 +120,7 @@ func ListServices(c *gin.Context) { perPage = max(1, min(100, perPage)) // send API call to capture the list of services for the build - s, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]any{}, page, perPage) + s, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]interface{}{}, page, perPage) if err != nil { retErr := fmt.Errorf("unable to get services for build %s: %w", entry, err) diff --git a/api/step/list.go b/api/step/list.go index 4b4e0ffd1..fb29dc7c2 100644 --- a/api/step/list.go +++ b/api/step/list.go @@ -120,7 +120,7 @@ func ListSteps(c *gin.Context) { perPage = max(1, min(100, perPage)) // send API call to capture the list of steps for the build - s, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]any{}, page, perPage) + s, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]interface{}{}, page, perPage) if err != nil { retErr := fmt.Errorf("unable to list steps for build %s: %w", entry, err) diff --git a/api/types/secret.go b/api/types/secret.go index 49635a04a..bcf4a6e90 100644 --- a/api/types/secret.go +++ b/api/types/secret.go @@ -34,7 +34,7 @@ type Secret struct { // UnmarshalYAML implements the Unmarshaler interface for the Secret type. // This allows custom fields in the Secret type to be read from a YAML file, like AllowEvents. -func (s *Secret) UnmarshalYAML(unmarshal func(any) error) error { +func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error { // create an alias to perform a normal unmarshal and avoid an infinite loop type jsonSecret Secret diff --git a/api/types/storage.go b/api/types/storage.go index efd7b429c..0c6913282 100644 --- a/api/types/storage.go +++ b/api/types/storage.go @@ -11,13 +11,13 @@ import ( // swagger:model CreateBucket type Bucket struct { BucketName string `json:"bucket_name,omitempty"` - MakeBucketOptions minio.MakeBucketOptions `json:"make_bucket_options"` - ListObjectsOptions minio.ListObjectsOptions `json:"list_objects_options"` + MakeBucketOptions minio.MakeBucketOptions `json:"make_bucket_options,omitempty"` + ListObjectsOptions minio.ListObjectsOptions `json:"list_objects_options,omitempty"` Recursive bool `json:"recursive"` } type Object struct { ObjectName string `json:"object_name,omitempty"` - Bucket Bucket `json:"bucket"` + Bucket Bucket `json:"bucket,omitempty"` FilePath string `json:"file_path,omitempty"` } diff --git a/api/types/storage_sts.go b/api/types/storage_sts.go index 4e0d243a2..40e560751 100644 --- a/api/types/storage_sts.go +++ b/api/types/storage_sts.go @@ -18,5 +18,5 @@ type STSCreds struct { Prefix string `json:"prefix,omitempty"` Secure bool `json:"secure,omitempty"` - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt time.Time `json:"expires_at,omitempty"` } diff --git a/api/types/string.go b/api/types/string.go index 25f573499..f86367ba6 100644 --- a/api/types/string.go +++ b/api/types/string.go @@ -13,7 +13,7 @@ import ( // ToString is a helper function to convert // the provided interface value to a string. -func ToString(v any) string { +func ToString(v interface{}) string { switch v := v.(type) { case string: return v @@ -45,7 +45,7 @@ func ToString(v any) string { return strconv.FormatUint(uint64(v), 10) case uint64: return strconv.FormatUint(v, 10) - case []any: + case []interface{}: return unmarshalSlice(v) default: return unmarshalMap(v) @@ -53,7 +53,7 @@ func ToString(v any) string { } // helper function to unmarshal a parameter in map format. -func unmarshalMap(v any) string { +func unmarshalMap(v interface{}) string { yml, err := yaml.Marshal(v) if err != nil { return err.Error() @@ -68,7 +68,7 @@ func unmarshalMap(v any) string { } // helper function to unmarshal a parameter in slice format. -func unmarshalSlice(v any) string { +func unmarshalSlice(v interface{}) string { out, err := yaml.Marshal(v) if err != nil { return err.Error() diff --git a/api/types/string_test.go b/api/types/string_test.go index d2cff807b..e362f0766 100644 --- a/api/types/string_test.go +++ b/api/types/string_test.go @@ -10,8 +10,8 @@ import ( func TestTypes_ToString(t *testing.T) { // setup tests tests := []struct { - parameter any - want any + parameter interface{} + want interface{} }{ {parameter: "string", want: "string"}, // string {parameter: true, want: "true"}, // bool @@ -33,11 +33,11 @@ func TestTypes_ToString(t *testing.T) { want: "{\"hello\":\"world\"}", }, { // slice - parameter: []any{1, 2, 3}, + parameter: []interface{}{1, 2, 3}, want: "1,2,3", }, { // slice complex - parameter: []any{struct{ Foo string }{Foo: "bar"}}, + parameter: []interface{}{struct{ Foo string }{Foo: "bar"}}, want: "[{\"foo\":\"bar\"}]", }, { // complex diff --git a/cache/context_test.go b/cache/context_test.go index af79948cb..c7e1b0f4d 100644 --- a/cache/context_test.go +++ b/cache/context_test.go @@ -52,7 +52,7 @@ func TestCache_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value any + value interface{} want Service }{ { diff --git a/cache/redis/redis.go b/cache/redis/redis.go index a3bf5fd10..96e61efa5 100644 --- a/cache/redis/redis.go +++ b/cache/redis/redis.go @@ -125,7 +125,7 @@ func failoverFromOptions(source *redis.Options) *redis.FailoverOptions { // the first host from the csv list is set as // the master node all subsequent hosts get // added as sentinel nodes - for host := range strings.SplitSeq(hosts, ",") { + for _, host := range strings.Split(hosts, ",") { if len(target.MasterName) == 0 { target.MasterName = host continue diff --git a/compiler/context_test.go b/compiler/context_test.go index 4ef2dcb55..5a31cc911 100644 --- a/compiler/context_test.go +++ b/compiler/context_test.go @@ -52,7 +52,7 @@ func TestCompiler_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value any + value interface{} want Engine }{ { diff --git a/compiler/engine.go b/compiler/engine.go index 520e962e3..ac02cd8fe 100644 --- a/compiler/engine.go +++ b/compiler/engine.go @@ -24,12 +24,12 @@ type Engine interface { // Compile defines a function that produces an executable // representation of a pipeline from an object. This calls // Parse internally to convert the object to a yaml configuration. - Compile(context.Context, any) (*pipeline.Build, *api.Pipeline, error) + Compile(context.Context, interface{}) (*pipeline.Build, *api.Pipeline, error) // CompileLite defines a function that produces an light executable // representation of a pipeline from an object. This calls // Parse internally to convert the object to a yaml configuration. - CompileLite(context.Context, any, *pipeline.RuleData, bool) (*yaml.Build, *api.Pipeline, error) + CompileLite(context.Context, interface{}, *pipeline.RuleData, bool) (*yaml.Build, *api.Pipeline, error) // Duplicate defines a function that // creates a clone of the Engine. @@ -37,11 +37,11 @@ type Engine interface { // Parse defines a function that converts // an object to a yaml configuration. - Parse(any, string, *yaml.Template) (*yaml.Build, []byte, []string, error) + Parse(interface{}, string, *yaml.Template) (*yaml.Build, []byte, []string, error) // ParseRaw defines a function that converts // an object to a string. - ParseRaw(any) (string, error) + ParseRaw(interface{}) (string, error) // ValidateYAML defines a function that verifies // the yaml configuration is accurate. diff --git a/compiler/native/compile.go b/compiler/native/compile.go index db50486cf..9d2753487 100644 --- a/compiler/native/compile.go +++ b/compiler/native/compile.go @@ -8,7 +8,6 @@ import ( "encoding/json" "fmt" "io" - "maps" "net/http" "strings" "time" @@ -39,7 +38,7 @@ type ModifyResponse struct { } // Compile produces an executable pipeline from a yaml configuration. -func (c *Client) Compile(ctx context.Context, v any) (*pipeline.Build, *api.Pipeline, error) { +func (c *Client) Compile(ctx context.Context, v interface{}) (*pipeline.Build, *api.Pipeline, error) { p, data, warnings, err := c.Parse(v, c.repo.GetPipelineType(), new(yaml.Template)) if err != nil { return nil, nil, err @@ -121,7 +120,7 @@ func (c *Client) Compile(ctx context.Context, v any) (*pipeline.Build, *api.Pipe } // CompileLite produces a partial of an executable pipeline from a yaml configuration. -func (c *Client) CompileLite(ctx context.Context, v any, ruleData *pipeline.RuleData, substitute bool) (*yaml.Build, *api.Pipeline, error) { +func (c *Client) CompileLite(ctx context.Context, v interface{}, ruleData *pipeline.RuleData, substitute bool) (*yaml.Build, *api.Pipeline, error) { p, data, warnings, err := c.Parse(v, c.repo.GetPipelineType(), new(yaml.Template)) if err != nil { return nil, nil, err @@ -257,7 +256,7 @@ func (c *Client) compileInline(ctx context.Context, p *yaml.Build, depth int) (* // initialize variable map if not parsed from config if len(template.Variables) == 0 { - template.Variables = make(map[string]any) + template.Variables = make(map[string]interface{}) } // inject template name into variables @@ -280,7 +279,9 @@ func (c *Client) compileInline(ctx context.Context, p *yaml.Build, depth int) (* switch { case len(parsed.Environment) > 0: - maps.Copy(newPipeline.Environment, parsed.Environment) + for key, value := range parsed.Environment { + newPipeline.Environment[key] = value + } fallthrough case len(parsed.Stages) > 0: diff --git a/compiler/native/compile_test.go b/compiler/native/compile_test.go index a22f82c3c..6611dc87d 100644 --- a/compiler/native/compile_test.go +++ b/compiler/native/compile_test.go @@ -2288,8 +2288,8 @@ func Test_client_modifyConfig(t *testing.T) { Environment: nil, Name: "docker", Pull: "always", - Parameters: map[string]any{ - "init_options": map[string]any{ + Parameters: map[string]interface{}{ + "init_options": map[string]interface{}{ "get_plugins": "true", }, }, @@ -2321,8 +2321,8 @@ func Test_client_modifyConfig(t *testing.T) { Environment: nil, Name: "docker", Pull: "always", - Parameters: map[string]any{ - "init_options": map[string]any{ + Parameters: map[string]interface{}{ + "init_options": map[string]interface{}{ "get_plugins": "true", }, }, diff --git a/compiler/native/environment.go b/compiler/native/environment.go index 4f8620749..0a5c96958 100644 --- a/compiler/native/environment.go +++ b/compiler/native/environment.go @@ -4,7 +4,6 @@ package native import ( "fmt" - "maps" "os" "strconv" "strings" @@ -45,13 +44,17 @@ func (c *Client) EnvironmentStage(s *yaml.Stage, globalEnv raw.StringSliceMap) ( // inject the declared environment // variables to the build stage - maps.Copy(env, s.Environment) + for k, v := range s.Environment { + env[k] = v + } // inject the default environment // variables to the build stage // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - maps.Copy(env, defaultEnv) + for k, v := range defaultEnv { + env[k] = v + } // overwrite existing build stage environment s.Environment = env @@ -96,13 +99,17 @@ func (c *Client) EnvironmentStep(s *yaml.Step, stageEnv raw.StringSliceMap) (*ya // inject the declared environment // variables to the build step - maps.Copy(env, s.Environment) + for k, v := range s.Environment { + env[k] = v + } // inject the default environment // variables to the build step // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - maps.Copy(env, defaultEnv) + for k, v := range defaultEnv { + env[k] = v + } // check if the compiler is setup for a local pipeline if c.local && !s.Detach { @@ -154,13 +161,17 @@ func (c *Client) EnvironmentServices(s yaml.ServiceSlice, globalEnv raw.StringSl // inject the declared environment // variables to the build service - maps.Copy(env, service.Environment) + for k, v := range service.Environment { + env[k] = v + } // inject the default environment // variables to the build service // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - maps.Copy(env, defaultEnv) + for k, v := range defaultEnv { + env[k] = v + } // overwrite existing build service environment service.Environment = env @@ -191,13 +202,17 @@ func (c *Client) EnvironmentSecrets(s yaml.SecretSlice, globalEnv raw.StringSlic // inject the declared environment // variables to the build secret - maps.Copy(env, secret.Origin.Environment) + for k, v := range secret.Origin.Environment { + env[k] = v + } // inject the default environment // variables to the build secret // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - maps.Copy(env, defaultEnv) + for k, v := range defaultEnv { + env[k] = v + } // check if the compiler is setup for a local pipeline if c.local { @@ -246,7 +261,9 @@ func (c *Client) EnvironmentBuild() map[string]string { // variables to the build // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - maps.Copy(env, defaultEnv) + for k, v := range defaultEnv { + env[k] = v + } // check if the compiler is setup for a local pipeline if c.local { @@ -264,7 +281,9 @@ func (c *Client) EnvironmentBuild() map[string]string { // helper function to merge two maps together. func appendMap(originalMap, otherMap map[string]string) map[string]string { - maps.Copy(originalMap, otherMap) + for key, value := range otherMap { + originalMap[key] = value + } return originalMap } diff --git a/compiler/native/environment_test.go b/compiler/native/environment_test.go index 873385896..833ad7532 100644 --- a/compiler/native/environment_test.go +++ b/compiler/native/environment_test.go @@ -395,7 +395,7 @@ func TestNative_EnvironmentSecrets(t *testing.T) { Image: "vault", Name: str, Pull: "always", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "foo": "bar", }, Environment: raw.StringSliceMap{ @@ -412,7 +412,7 @@ func TestNative_EnvironmentSecrets(t *testing.T) { Image: "vault", Name: str, Pull: "always", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "foo": "bar", }, Environment: raw.StringSliceMap{ diff --git a/compiler/native/expand.go b/compiler/native/expand.go index 6ac18960a..d6eb97b9e 100644 --- a/compiler/native/expand.go +++ b/compiler/native/expand.go @@ -137,7 +137,7 @@ func (c *Client) ExpandSteps(ctx context.Context, s *yaml.Build, tmpls map[strin // initialize variable map if not parsed from config if len(step.Template.Variables) == 0 { - step.Template.Variables = make(map[string]any) + step.Template.Variables = make(map[string]interface{}) } // inject template name into variables @@ -259,7 +259,7 @@ func (c *Client) ExpandDeployment(ctx context.Context, b *yaml.Build, tmpls map[ // initialize variable map if not parsed from config if len(b.Deployment.Template.Variables) == 0 { - b.Deployment.Template.Variables = make(map[string]any) + b.Deployment.Template.Variables = make(map[string]interface{}) } tmplBuild, _, err := c.mergeDeployTemplate(bytes, tmpl, &b.Deployment) diff --git a/compiler/native/expand_test.go b/compiler/native/expand_test.go index ee8c7784b..7552df75a 100644 --- a/compiler/native/expand_test.go +++ b/compiler/native/expand_test.go @@ -55,7 +55,7 @@ func TestNative_ExpandStages(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]any{ + Variables: map[string]interface{}{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -255,7 +255,7 @@ func TestNative_ExpandSteps(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]any{ + Variables: map[string]interface{}{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -515,7 +515,7 @@ func TestNative_ExpandDeployment(t *testing.T) { deployCfg := yaml.Deployment{ Template: yaml.StepTemplate{ Name: "deploy", - Variables: map[string]any{ + Variables: map[string]interface{}{ "regions": []string{"us-east-1", "us-west-1"}, }, }, @@ -611,7 +611,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]any{ + Variables: map[string]interface{}{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -622,7 +622,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "maven", - Variables: map[string]any{ + Variables: map[string]interface{}{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -639,7 +639,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "npm", - Variables: map[string]any{ + Variables: map[string]interface{}{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -753,12 +753,12 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Target: "VAULT_TOKEN", }, }, - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "addr": "vault.example.com", "auth_method": "token", "username": "octocat", - "items": []any{ - map[string]any{"path": "docker", "source": "secret/docker"}, + "items": []interface{}{ + map[string]interface{}{"path": "docker", "source": "secret/docker"}, }, }, }, @@ -847,7 +847,7 @@ func TestNative_ExpandStepsStarlark(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "go", - Variables: map[string]any{}, + Variables: map[string]interface{}{}, }, }, } @@ -1150,7 +1150,7 @@ func TestNative_ExpandStepsDuplicateCalls(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]any{ + Variables: map[string]interface{}{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -1161,7 +1161,7 @@ func TestNative_ExpandStepsDuplicateCalls(t *testing.T) { Name: "sample-dup", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]any{ + Variables: map[string]interface{}{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", diff --git a/compiler/native/parse.go b/compiler/native/parse.go index 229172f77..f1993639f 100644 --- a/compiler/native/parse.go +++ b/compiler/native/parse.go @@ -16,7 +16,7 @@ import ( ) // ParseRaw converts an object to a string. -func (c *Client) ParseRaw(v any) (string, error) { +func (c *Client) ParseRaw(v interface{}) (string, error) { switch v := v.(type) { case []byte: return string(v), nil @@ -40,7 +40,7 @@ func (c *Client) ParseRaw(v any) (string, error) { } // Parse converts an object to a yaml configuration. -func (c *Client) Parse(v any, pipelineType string, template *yaml.Template) (*yaml.Build, []byte, []string, error) { +func (c *Client) Parse(v interface{}, pipelineType string, template *yaml.Template) (*yaml.Build, []byte, []string, error) { var ( p *yaml.Build warnings []string diff --git a/compiler/native/parse_test.go b/compiler/native/parse_test.go index 811d01623..2dd82edd1 100644 --- a/compiler/native/parse_test.go +++ b/compiler/native/parse_test.go @@ -187,10 +187,10 @@ func TestNative_Parse_Parameters(t *testing.T) { Steps: yaml.StepSlice{ &yaml.Step{ Image: "plugins/docker:18.09", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []any{"latest", "dev"}, + "tags": []interface{}{"latest", "dev"}, }, Name: "docker", Pull: "always", @@ -297,10 +297,10 @@ func TestNative_Parse_StagesPipeline(t *testing.T) { Steps: yaml.StepSlice{ &yaml.Step{ Image: "plugins/docker:18.09", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []any{"latest", "dev"}, + "tags": []interface{}{"latest", "dev"}, }, Name: "publish", Pull: "always", @@ -409,10 +409,10 @@ func TestNative_Parse_StepsPipeline(t *testing.T) { }, &yaml.Step{ Image: "plugins/docker:18.09", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []any{"latest", "dev"}, + "tags": []interface{}{"latest", "dev"}, }, Name: "publish", Pull: "always", @@ -884,7 +884,7 @@ func Test_client_Parse(t *testing.T) { Name: "foo", Image: "alpine", Pull: "not_present", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "registry": "foo", }, }, @@ -968,7 +968,7 @@ func Test_client_ParseRaw(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var ( - content any + content interface{} err error ) diff --git a/compiler/native/substitute_test.go b/compiler/native/substitute_test.go index fb7cf540d..735063feb 100644 --- a/compiler/native/substitute_test.go +++ b/compiler/native/substitute_test.go @@ -196,7 +196,7 @@ func Test_client_SubstituteSteps(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "go", - Variables: map[string]any{ + Variables: map[string]interface{}{ "build_author": "${BUILD_AUTHOR}", "unknown": "${DEPLOYMENT_PARAMETER_API_IMAGE}", }, @@ -212,7 +212,7 @@ func Test_client_SubstituteSteps(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "go", - Variables: map[string]any{ + Variables: map[string]interface{}{ "build_author": "testauthor", "unknown": "${DEPLOYMENT_PARAMETER_API_IMAGE}", }, diff --git a/compiler/native/validate_test.go b/compiler/native/validate_test.go index f782d2e2b..29ed8747b 100644 --- a/compiler/native/validate_test.go +++ b/compiler/native/validate_test.go @@ -648,7 +648,7 @@ func TestNative_Validate_Steps_ExceedReportAs(t *testing.T) { reportSteps := pipeline.ContainerSlice{} - for i := range 12 { + for i := 0; i < 12; i++ { reportStep := &pipeline.Container{ Commands: raw.StringSlice{"echo hello"}, Image: "alpine", diff --git a/compiler/template/native/convert.go b/compiler/template/native/convert.go index a2d3916bb..51382c9a7 100644 --- a/compiler/template/native/convert.go +++ b/compiler/template/native/convert.go @@ -30,9 +30,9 @@ func convertPlatformVars(slice raw.StringSliceMap, name string) raw.StringSliceM } // check if the key has a 'vela_*' prefix - if after, ok := strings.CutPrefix(key, "vela_"); ok { + if strings.HasPrefix(key, "vela_") { // add the key/value pair without the 'vela_` prefix - envs[after] = value + envs[strings.TrimPrefix(key, "vela_")] = value } } @@ -49,7 +49,7 @@ func convertPlatformVars(slice raw.StringSliceMap, name string) raw.StringSliceM // https://github.com/helm/helm/blob/a499b4b179307c267bdf3ec49b880e3dbd2a5591/pkg/engine/funcs.go#L83 // // This is designed to be called from a template. -func toYAML(v any) string { +func toYAML(v interface{}) string { data, err := yaml.Marshal(v) if err != nil { // Swallow errors inside of a template. diff --git a/compiler/template/native/render.go b/compiler/template/native/render.go index 69cecfaa4..c9836f8f9 100644 --- a/compiler/template/native/render.go +++ b/compiler/template/native/render.go @@ -15,11 +15,11 @@ import ( ) // Render combines the template with the step in the yaml pipeline. -func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]any) (*types.Build, []string, error) { +func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]interface{}) (*types.Build, []string, error) { buffer := new(bytes.Buffer) velaFuncs := funcHandler{envs: convertPlatformVars(environment, name)} - templateFuncMap := map[string]any{ + templateFuncMap := map[string]interface{}{ "vela": velaFuncs.returnPlatformVar, "toYaml": toYAML, } @@ -69,11 +69,11 @@ func Render(tmpl string, name string, tName string, environment raw.StringSliceM } // RenderBuild renders the templated build. -func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]any) (*types.Build, []string, error) { +func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]interface{}) (*types.Build, []string, error) { buffer := new(bytes.Buffer) velaFuncs := funcHandler{envs: convertPlatformVars(envs, tmpl)} - templateFuncMap := map[string]any{ + templateFuncMap := map[string]interface{}{ "vela": velaFuncs.returnPlatformVar, "toYaml": toYAML, } diff --git a/compiler/template/native/render_test.go b/compiler/template/native/render_test.go index 4510950b1..a7b93c8cf 100644 --- a/compiler/template/native/render_test.go +++ b/compiler/template/native/render_test.go @@ -133,7 +133,7 @@ func TestNative_RenderBuild(t *testing.T) { got, _, err := RenderBuild("build", string(sFile), map[string]string{ "VELA_REPO_FULL_NAME": "octocat/hello-world", "VELA_BUILD_BRANCH": "main", - }, map[string]any{}) + }, map[string]interface{}{}) if (err != nil) != tt.wantErr { t.Errorf("RenderBuild() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/compiler/template/starlark/convert.go b/compiler/template/starlark/convert.go index 3f1671217..8a519db4f 100644 --- a/compiler/template/starlark/convert.go +++ b/compiler/template/starlark/convert.go @@ -17,7 +17,7 @@ import ( // // Explanation of type "starlark.StringDict": // https://pkg.go.dev/go.starlark.net/starlark#StringDict -func convertTemplateVars(m map[string]any) (*starlark.Dict, error) { +func convertTemplateVars(m map[string]interface{}) (*starlark.Dict, error) { dict := starlark.NewDict(0) // loop through user vars converting provided types to starlark primitives @@ -90,9 +90,9 @@ func convertPlatformVars(slice raw.StringSliceMap, name string) (*starlark.Dict, // iterate through the list of possible prefixes to look for for _, prefix := range []string{"deployment_parameter_", "vela_"} { // check if the key has the prefix - if after, ok := strings.CutPrefix(key, prefix); ok { + if strings.HasPrefix(key, prefix) { // trim the prefix from the input key - key = after + key = strings.TrimPrefix(key, prefix) // check if the prefix is from 'vela_*' if strings.EqualFold(prefix, "vela_") { diff --git a/compiler/template/starlark/convert_test.go b/compiler/template/starlark/convert_test.go index b1024506f..7175da779 100644 --- a/compiler/template/starlark/convert_test.go +++ b/compiler/template/starlark/convert_test.go @@ -48,22 +48,22 @@ func TestStarlark_Render_convertTemplateVars(t *testing.T) { tests := []struct { name string - args map[string]any + args map[string]interface{} want *starlark.Dict }{ { name: "test for a user passed string", - args: map[string]any{"pull": "always"}, + args: map[string]interface{}{"pull": "always"}, want: strWant, }, { name: "test for a user passed array", - args: map[string]any{"tags": []string{"latest", "1.14", "1.15"}}, + args: map[string]interface{}{"tags": []string{"latest", "1.14", "1.15"}}, want: arrayWant, }, { name: "test for a user passed map", - args: map[string]any{"commands": map[string]string{"test": "go test ./..."}}, + args: map[string]interface{}{"commands": map[string]string{"test": "go test ./..."}}, want: mapWant, }} diff --git a/compiler/template/starlark/render.go b/compiler/template/starlark/render.go index 25ea2f2e5..1460b6de4 100644 --- a/compiler/template/starlark/render.go +++ b/compiler/template/starlark/render.go @@ -31,7 +31,7 @@ var ( ) // Render combines the template with the step in the yaml pipeline. -func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]any, limit int64) (*types.Build, []string, error) { +func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]interface{}, limit int64) (*types.Build, []string, error) { thread := &starlark.Thread{Name: name} if limit < 0 { @@ -145,7 +145,7 @@ func Render(tmpl string, name string, tName string, environment raw.StringSliceM // RenderBuild renders the templated build. // //nolint:lll // ignore function length due to input args -func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]any, limit int64) (*types.Build, []string, error) { +func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]interface{}, limit int64) (*types.Build, []string, error) { thread := &starlark.Thread{Name: "templated-base"} if limit < 0 { diff --git a/compiler/template/starlark/render_test.go b/compiler/template/starlark/render_test.go index 70b501112..5c070510c 100644 --- a/compiler/template/starlark/render_test.go +++ b/compiler/template/starlark/render_test.go @@ -220,7 +220,7 @@ func TestNative_RenderBuild(t *testing.T) { "VELA_REPO_FULL_NAME": "octocat/hello-world", "VELA_BUILD_BRANCH": "main", "VELA_REPO_ORG": "octocat", - }, map[string]any{}, tt.execLimit) + }, map[string]interface{}{}, tt.execLimit) if (err != nil) != tt.wantErr { t.Errorf("RenderBuild() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/compiler/template/starlark/starlark.go b/compiler/template/starlark/starlark.go index 7ffcd95f9..02db098aa 100644 --- a/compiler/template/starlark/starlark.go +++ b/compiler/template/starlark/starlark.go @@ -32,7 +32,7 @@ var ( // https://github.com/wonderix/shalm/blob/899b8f7787883d40619eefcc39bd12f42a09b5e7/pkg/shalm/convert.go#L14-L85 // //nolint:gocyclo // ignore complexity -func toStarlark(value any) (starlark.Value, error) { +func toStarlark(value interface{}) (starlark.Value, error) { logrus.Tracef("converting %v to starlark type", value) if value == nil { @@ -81,7 +81,7 @@ func toStarlark(value any) (starlark.Value, error) { } return starlark.Tuple(a), nil - case reflect.Pointer: + case reflect.Ptr: val, err := toStarlark(v.Elem().Interface()) if err != nil { return nil, err @@ -126,7 +126,7 @@ func toStarlark(value any) (starlark.Value, error) { return nil, err } - var m map[string]any + var m map[string]interface{} err = json.Unmarshal(data, &m) if err != nil { diff --git a/compiler/template/starlark/starlark_test.go b/compiler/template/starlark/starlark_test.go index 017add4db..d85900f33 100644 --- a/compiler/template/starlark/starlark_test.go +++ b/compiler/template/starlark/starlark_test.go @@ -22,7 +22,7 @@ func TestStarlark_toStarlark(t *testing.T) { a = append(a, starlark.Value(starlark.String("bar"))) type args struct { - value any + value interface{} } tests := []struct { diff --git a/compiler/types/pipeline/build.go b/compiler/types/pipeline/build.go index f931d3cd2..ccfe1bcbb 100644 --- a/compiler/types/pipeline/build.go +++ b/compiler/types/pipeline/build.go @@ -19,10 +19,10 @@ type Build struct { Token string `json:"token,omitempty" yaml:"token,omitempty"` TokenExp int64 `json:"token_exp,omitempty" yaml:"token_exp,omitempty"` Version string `json:"version,omitempty" yaml:"version,omitempty"` - Metadata Metadata `json:"metadata" yaml:"metadata,omitempty"` + Metadata Metadata `json:"metadata,omitempty" yaml:"metadata,omitempty"` Environment raw.StringSliceMap `json:"environment,omitempty" yaml:"environment,omitempty"` - Worker Worker `json:"worker" yaml:"worker,omitempty"` - Deployment Deployment `json:"deployment" yaml:"deployment,omitempty"` + Worker Worker `json:"worker,omitempty" yaml:"worker,omitempty"` + Deployment Deployment `json:"deployment,omitempty" yaml:"deployment,omitempty"` Secrets SecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"` Services ContainerSlice `json:"services,omitempty" yaml:"services,omitempty"` Stages StageSlice `json:"stages,omitempty" yaml:"stages,omitempty"` diff --git a/compiler/types/pipeline/container.go b/compiler/types/pipeline/container.go index f2f609fc6..e83b17c95 100644 --- a/compiler/types/pipeline/container.go +++ b/compiler/types/pipeline/container.go @@ -7,7 +7,6 @@ import ( "encoding/json" "errors" "fmt" - "maps" "math/rand" "reflect" "strings" @@ -47,9 +46,9 @@ type ( Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"` Pull string `json:"pull,omitempty" yaml:"pull,omitempty"` - Ruleset Ruleset `json:"ruleset" yaml:"ruleset,omitempty"` + Ruleset Ruleset `json:"ruleset,omitempty" yaml:"ruleset,omitempty"` Secrets StepSecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"` - Artifacts Artifacts `json:"artifacts" yaml:"artifacts,omitempty"` + Artifacts Artifacts `json:"artifacts,omitempty" yaml:"artifacts,omitempty"` Ulimits UlimitSlice `json:"ulimits,omitempty" yaml:"ulimits,omitempty"` Volumes VolumeSlice `json:"volumes,omitempty" yaml:"volumes,omitempty"` User string `json:"user,omitempty" yaml:"user,omitempty"` @@ -201,8 +200,10 @@ func (c *Container) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - // set or update the container environment variable - maps.Copy(c.Environment, environment) + for key, value := range environment { + // set or update the container environment variable + c.Environment[key] = value + } return nil } diff --git a/compiler/types/pipeline/ruleset.go b/compiler/types/pipeline/ruleset.go index 34a1b772f..e18072773 100644 --- a/compiler/types/pipeline/ruleset.go +++ b/compiler/types/pipeline/ruleset.go @@ -20,8 +20,8 @@ type ( // // swagger:model PipelineRuleset Ruleset struct { - If Rules `json:"if" yaml:"if,omitempty"` - Unless Rules `json:"unless" yaml:"unless,omitempty"` + If Rules `json:"if,omitempty" yaml:"if,omitempty"` + Unless Rules `json:"unless,omitempty" yaml:"unless,omitempty"` Matcher string `json:"matcher,omitempty" yaml:"matcher,omitempty"` Operator string `json:"operator,omitempty" yaml:"operator,omitempty"` Continue bool `json:"continue,omitempty" yaml:"continue,omitempty"` diff --git a/compiler/types/pipeline/stage.go b/compiler/types/pipeline/stage.go index a3df1338e..27c10c232 100644 --- a/compiler/types/pipeline/stage.go +++ b/compiler/types/pipeline/stage.go @@ -4,7 +4,6 @@ package pipeline import ( "fmt" - "maps" "github.com/go-vela/server/constants" ) @@ -157,8 +156,10 @@ func (s *Stage) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - // set or update the stage environment variable - maps.Copy(s.Environment, environment) + for key, value := range environment { + // set or update the stage environment variable + s.Environment[key] = value + } return nil } diff --git a/compiler/types/raw/map.go b/compiler/types/raw/map.go index 15ed2b795..deb1c81d0 100644 --- a/compiler/types/raw/map.go +++ b/compiler/types/raw/map.go @@ -7,7 +7,6 @@ import ( "encoding/json" "errors" "fmt" - "maps" "strings" "github.com/invopop/jsonschema" @@ -27,7 +26,7 @@ func (s StringSliceMap) Value() (driver.Value, error) { } // Scan decodes the JSON string into map[string]string. -func (s *StringSliceMap) Scan(value any) error { +func (s *StringSliceMap) Scan(value interface{}) error { b, ok := value.(string) if !ok { return errors.New("type assertion to string failed") @@ -78,8 +77,10 @@ func (s *StringSliceMap) UnmarshalJSON(b []byte) error { err = json.Unmarshal(b, &jsonMap) if err == nil { // iterate through each item in the json map - // append each key/value pair to our target map - maps.Copy(targetMap, jsonMap) + for k, v := range jsonMap { + // append each key/value pair to our target map + targetMap[k] = v + } // overwrite existing StringSliceMap *s = targetMap @@ -91,7 +92,7 @@ func (s *StringSliceMap) UnmarshalJSON(b []byte) error { } // UnmarshalYAML implements the Unmarshaler interface for the StringSliceMap type. -func (s *StringSliceMap) UnmarshalYAML(unmarshal func(any) error) error { +func (s *StringSliceMap) UnmarshalYAML(unmarshal func(interface{}) error) error { // target map we want to return targetMap := map[string]string{} @@ -127,8 +128,10 @@ func (s *StringSliceMap) UnmarshalYAML(unmarshal func(any) error) error { err = unmarshal(&yamlMap) if err == nil { // iterate through each item in the yaml map - // append each key/value pair to our target map - maps.Copy(targetMap, yamlMap) + for k, v := range yamlMap { + // append each key/value pair to our target map + targetMap[k] = v + } // overwrite existing StringSliceMap *s = targetMap diff --git a/compiler/types/raw/map_test.go b/compiler/types/raw/map_test.go index 435957885..e8b280161 100644 --- a/compiler/types/raw/map_test.go +++ b/compiler/types/raw/map_test.go @@ -175,7 +175,7 @@ func TestStringSliceMap_Value(t *testing.T) { func TestStringSliceMap_Scan(t *testing.T) { type args struct { - value any + value interface{} } tests := []struct { diff --git a/compiler/types/raw/slice.go b/compiler/types/raw/slice.go index 4d8f926d2..fb6ac59b2 100644 --- a/compiler/types/raw/slice.go +++ b/compiler/types/raw/slice.go @@ -47,7 +47,7 @@ func (s *StringSlice) UnmarshalJSON(b []byte) error { } // UnmarshalYAML implements the Unmarshaler interface for the StringSlice type. -func (s *StringSlice) UnmarshalYAML(unmarshal func(any) error) error { +func (s *StringSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { // yaml string we try unmarshalling to yamlString := "" diff --git a/compiler/types/yaml/build.go b/compiler/types/yaml/build.go index ee80045e0..a4b7494f7 100644 --- a/compiler/types/yaml/build.go +++ b/compiler/types/yaml/build.go @@ -10,16 +10,16 @@ import ( // Build is the yaml representation of a build for a pipeline. type Build struct { Version string `yaml:"version,omitempty" json:"version,omitempty" jsonschema:"required,minLength=1,description=Provide syntax version used to evaluate the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/version/"` - Metadata Metadata `yaml:"metadata,omitempty" json:"metadata" jsonschema:"description=Pass extra information.\nReference: https://go-vela.github.io/docs/reference/yaml/metadata/"` + Metadata Metadata `yaml:"metadata,omitempty" json:"metadata,omitempty" jsonschema:"description=Pass extra information.\nReference: https://go-vela.github.io/docs/reference/yaml/metadata/"` Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Provide global environment variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` - Worker Worker `yaml:"worker,omitempty" json:"worker" jsonschema:"description=Limit the pipeline to certain types of workers.\nReference: https://go-vela.github.io/docs/reference/yaml/worker/"` + Worker Worker `yaml:"worker,omitempty" json:"worker,omitempty" jsonschema:"description=Limit the pipeline to certain types of workers.\nReference: https://go-vela.github.io/docs/reference/yaml/worker/"` Secrets SecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Provide sensitive information.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/"` Services ServiceSlice `yaml:"services,omitempty" json:"services,omitempty" jsonschema:"description=Provide detached (headless) execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/services/"` Stages StageSlice `yaml:"stages,omitempty" json:"stages,omitempty" jsonschema:"oneof_required=stages,description=Provide parallel execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/stages/"` Steps StepSlice `yaml:"steps,omitempty" json:"steps,omitempty" jsonschema:"oneof_required=steps,description=Provide sequential execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/"` Templates TemplateSlice `yaml:"templates,omitempty" json:"templates,omitempty" jsonschema:"description=Provide the name of templates to expand.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/"` - Deployment Deployment `yaml:"deployment,omitempty" json:"deployment" jsonschema:"description=Provide deployment configuration.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/"` - Git Git `yaml:"git,omitempty" json:"git" jsonschema:"description=Provide the git access specifications.\nReference: https://go-vela.github.io/docs/reference/yaml/git/"` + Deployment Deployment `yaml:"deployment,omitempty" json:"deployment,omitempty" jsonschema:"description=Provide deployment configuration.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/"` + Git Git `yaml:"git,omitempty" json:"git,omitempty" jsonschema:"description=Provide the git access specifications.\nReference: https://go-vela.github.io/docs/reference/yaml/git/"` } // ToPipelineAPI converts the Build type to an API Pipeline type. @@ -86,7 +86,7 @@ func (b *Build) hasArtifacts() bool { } // UnmarshalYAML implements the Unmarshaler interface for the Build type. -func (b *Build) UnmarshalYAML(unmarshal func(any) error) error { +func (b *Build) UnmarshalYAML(unmarshal func(interface{}) error) error { // build we try unmarshalling to build := new(struct { Version string diff --git a/compiler/types/yaml/build_test.go b/compiler/types/yaml/build_test.go index 1ecd877ff..84353473e 100644 --- a/compiler/types/yaml/build_test.go +++ b/compiler/types/yaml/build_test.go @@ -242,11 +242,11 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) { }, { Name: "docker_build", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "dry_run": true, "registry": "index.docker.io", "repo": "github/octocat", - "tags": []any{"latest", "dev"}, + "tags": []interface{}{"latest", "dev"}, }, Image: "plugins/docker:18.09", Pull: "always", @@ -260,10 +260,10 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) { }, { Name: "docker_publish", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []any{"latest", "dev"}, + "tags": []interface{}{"latest", "dev"}, }, Image: "plugins/docker:18.09", Pull: "always", @@ -332,7 +332,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) { { Origin: Origin{ Image: "target/vela-vault:latest", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "addr": "vault.example.com", }, Pull: "always", diff --git a/compiler/types/yaml/deployment.go b/compiler/types/yaml/deployment.go index c68063017..6cd3db4e6 100644 --- a/compiler/types/yaml/deployment.go +++ b/compiler/types/yaml/deployment.go @@ -13,7 +13,7 @@ type ( Deployment struct { Targets raw.StringSlice `yaml:"targets,omitempty" json:"targets,omitempty" jsonschema:"description=List of deployment targets for the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-targets-key"` Parameters ParameterMap `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=List of parameters for the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"` - Template StepTemplate `yaml:"template,omitempty" json:"template" jsonschema:"description=Name of template to expand in the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-template-key"` + Template StepTemplate `yaml:"template,omitempty" json:"template,omitempty" jsonschema:"description=Name of template to expand in the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-template-key"` } // ParameterMap is the yaml representation diff --git a/compiler/types/yaml/git.go b/compiler/types/yaml/git.go index 403c9da67..fc740d86e 100644 --- a/compiler/types/yaml/git.go +++ b/compiler/types/yaml/git.go @@ -10,7 +10,7 @@ import ( // Git is the yaml representation of git configurations for a pipeline. type Git struct { - Token `yaml:"token,omitempty" json:"token" jsonschema:"description=Provide the git token specifications, primarily used for cloning.\nReference: https://go-vela.github.io/docs/reference/yaml/git/#token"` + Token `yaml:"token,omitempty" json:"token,omitempty" jsonschema:"description=Provide the git token specifications, primarily used for cloning.\nReference: https://go-vela.github.io/docs/reference/yaml/git/#token"` } // Token is the yaml representation of the git token. diff --git a/compiler/types/yaml/metadata.go b/compiler/types/yaml/metadata.go index 5d5912bcd..89d21c369 100644 --- a/compiler/types/yaml/metadata.go +++ b/compiler/types/yaml/metadata.go @@ -3,8 +3,6 @@ package yaml import ( - "slices" - "github.com/go-vela/server/compiler/types/pipeline" ) @@ -73,5 +71,11 @@ func (m *Metadata) ToPipeline() *pipeline.Metadata { // HasEnvironment checks if the container type // is contained within the environment list. func (m *Metadata) HasEnvironment(container string) bool { - return slices.Contains(m.Environment, container) + for _, e := range m.Environment { + if e == container { + return true + } + } + + return false } diff --git a/compiler/types/yaml/ruleset.go b/compiler/types/yaml/ruleset.go index 75f269a01..0b8ae8f00 100644 --- a/compiler/types/yaml/ruleset.go +++ b/compiler/types/yaml/ruleset.go @@ -14,8 +14,8 @@ type ( // Ruleset is the yaml representation of a // ruleset block for a step in a pipeline. Ruleset struct { - If Rules `yaml:"if,omitempty" json:"if" jsonschema:"description=Limit execution to when all rules match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` - Unless Rules `yaml:"unless,omitempty" json:"unless" jsonschema:"description=Limit execution to when all rules do not match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + If Rules `yaml:"if,omitempty" json:"if,omitempty" jsonschema:"description=Limit execution to when all rules match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + Unless Rules `yaml:"unless,omitempty" json:"unless,omitempty" jsonschema:"description=Limit execution to when all rules do not match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` Matcher string `yaml:"matcher,omitempty" json:"matcher,omitempty" jsonschema:"enum=filepath,enum=regexp,default=filepath,description=Use the defined matching method.\nReference: coming soon"` Operator string `yaml:"operator,omitempty" json:"operator,omitempty" jsonschema:"enum=or,enum=and,default=and,description=Whether all rule conditions must be met or just any one of them.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` Continue bool `yaml:"continue,omitempty" json:"continue,omitempty" jsonschema:"default=false,description=Limits the execution of a step to continuing on any failure.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` @@ -54,7 +54,7 @@ func (r *Ruleset) ToPipeline() *pipeline.Ruleset { } // UnmarshalYAML implements the Unmarshaler interface for the Ruleset type. -func (r *Ruleset) UnmarshalYAML(unmarshal func(any) error) error { +func (r *Ruleset) UnmarshalYAML(unmarshal func(interface{}) error) error { // simple struct we try unmarshalling to simple := new(Rules) @@ -163,7 +163,7 @@ func (r *Rules) ToPipeline() *pipeline.Rules { } // UnmarshalYAML implements the Unmarshaler interface for the Rules type. -func (r *Rules) UnmarshalYAML(unmarshal func(any) error) error { +func (r *Rules) UnmarshalYAML(unmarshal func(interface{}) error) error { // rules struct we try unmarshalling to rules := new(struct { Branch raw.StringSlice diff --git a/compiler/types/yaml/secret.go b/compiler/types/yaml/secret.go index 5cf803de7..37f408fb7 100644 --- a/compiler/types/yaml/secret.go +++ b/compiler/types/yaml/secret.go @@ -5,7 +5,6 @@ package yaml import ( "errors" "fmt" - "maps" "strings" "github.com/invopop/jsonschema" @@ -27,21 +26,21 @@ type ( Key string `yaml:"key,omitempty" json:"key,omitempty" jsonschema:"minLength=1,description=Path to secret to fetch from storage backend.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-key-key"` Engine string `yaml:"engine,omitempty" json:"engine,omitempty" jsonschema:"enum=native,enum=vault,default=native,description=Name of storage backend to fetch secret from.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-engine-key"` Type string `yaml:"type,omitempty" json:"type,omitempty" jsonschema:"enum=repo,enum=org,enum=shared,default=repo,description=Type of secret to fetch from storage backend.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-type-key"` - Origin Origin `yaml:"origin,omitempty" json:"origin" jsonschema:"description=Declaration to pull secrets from non-internal secret providers.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-origin-key"` + Origin Origin `yaml:"origin,omitempty" json:"origin,omitempty" jsonschema:"description=Declaration to pull secrets from non-internal secret providers.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-origin-key"` Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=step_start,enum=build_start,default=build_start,description=When to pull in secrets from storage backend.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-pull-key"` } // Origin is the yaml representation of a method // for looking up secrets with a secret plugin. Origin struct { - Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Variables to inject into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` - Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"required,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` - Parameters map[string]any `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for the secret plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` - Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Secrets to inject that are necessary to retrieve the secrets.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` - Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` - Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` - IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` + Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Variables to inject into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` + Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"required,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` + Parameters map[string]interface{} `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for the secret plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` + Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Secrets to inject that are necessary to retrieve the secrets.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` + Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` + Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset,omitempty" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` } ) @@ -68,7 +67,7 @@ func (s *SecretSlice) ToPipeline() *pipeline.SecretSlice { } // UnmarshalYAML implements the Unmarshaler interface for the SecretSlice type. -func (s *SecretSlice) UnmarshalYAML(unmarshal func(any) error) error { +func (s *SecretSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { // secret slice we try unmarshalling to secretSlice := new([]*Secret) @@ -178,8 +177,10 @@ func (o *Origin) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - // set or update the secret environment variable - maps.Copy(o.Environment, environment) + for key, value := range environment { + // set or update the secret environment variable + o.Environment[key] = value + } return nil } @@ -230,7 +231,7 @@ func (s *StepSecretSlice) ToPipeline() *pipeline.StepSecretSlice { } // UnmarshalYAML implements the Unmarshaler interface for the StepSecretSlice type. -func (s *StepSecretSlice) UnmarshalYAML(unmarshal func(any) error) error { +func (s *StepSecretSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { // string slice we try unmarshalling to stringSlice := new(raw.StringSlice) diff --git a/compiler/types/yaml/secret_test.go b/compiler/types/yaml/secret_test.go index 6e9f2b9b2..34037fc7d 100644 --- a/compiler/types/yaml/secret_test.go +++ b/compiler/types/yaml/secret_test.go @@ -24,10 +24,10 @@ func TestYaml_Origin_MergeEnv(t *testing.T) { Name: "vault", Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "addr": "vault.example.com", "auth_method": "token", - "items": []any{ + "items": []interface{}{ map[string]string{"source": "secret/docker", "path": "docker"}, }, }, @@ -57,10 +57,10 @@ func TestYaml_Origin_MergeEnv(t *testing.T) { Name: "vault", Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "addr": "vault.example.com", "auth_method": "token", - "items": []any{ + "items": []interface{}{ map[string]string{"source": "secret/docker", "path": "docker"}, }, }, @@ -120,7 +120,7 @@ func TestYaml_SecretSlice_ToPipeline(t *testing.T) { Name: "vault", Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "addr": "vault.company.com", }, Pull: "always", @@ -252,7 +252,7 @@ func TestYaml_SecretSlice_UnmarshalYAML(t *testing.T) { Origin: Origin{ Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "addr": "vault.company.com", }, Pull: "always", @@ -284,7 +284,7 @@ func TestYaml_SecretSlice_UnmarshalYAML(t *testing.T) { Origin: Origin{ Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "addr": "vault.company.com", }, Pull: "always", diff --git a/compiler/types/yaml/service.go b/compiler/types/yaml/service.go index 5c81ddbdc..6a2dc75b1 100644 --- a/compiler/types/yaml/service.go +++ b/compiler/types/yaml/service.go @@ -4,7 +4,6 @@ package yaml import ( "fmt" - "maps" "strings" "github.com/go-vela/server/compiler/types/pipeline" @@ -28,7 +27,7 @@ type ( Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/services/#the-pul-key"` Ulimits UlimitSlice `yaml:"ulimits,omitempty" json:"ulimits,omitempty" jsonschema:"description=Set the user limits for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/services/#the-ulimits-key"` User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-key"` - Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset,omitempty" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` } ) @@ -59,7 +58,7 @@ func (s *ServiceSlice) ToPipeline() *pipeline.ContainerSlice { } // UnmarshalYAML implements the Unmarshaler interface for the ServiceSlice type. -func (s *ServiceSlice) UnmarshalYAML(unmarshal func(any) error) error { +func (s *ServiceSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { // service slice we try unmarshalling to serviceSlice := new([]*Service) @@ -127,8 +126,10 @@ func (s *Service) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - // set or update the service environment variable - maps.Copy(s.Environment, environment) + for key, value := range environment { + // set or update the service environment variable + s.Environment[key] = value + } return nil } diff --git a/compiler/types/yaml/stage.go b/compiler/types/yaml/stage.go index 62a19c15a..2fd485d73 100644 --- a/compiler/types/yaml/stage.go +++ b/compiler/types/yaml/stage.go @@ -4,8 +4,6 @@ package yaml import ( "fmt" - "maps" - "slices" "github.com/invopop/jsonschema" "go.yaml.in/yaml/v3" @@ -81,8 +79,10 @@ func (s *StageSlice) UnmarshalYAML(v *yaml.Node) error { if stage.Name != constants.CloneName && stage.Name != constants.InitName { // add clone if not present stage.Needs = func(needs []string) []string { - if slices.Contains(needs, constants.CloneName) { - return needs + for _, s := range needs { + if s == constants.CloneName { + return needs + } } return append(needs, constants.CloneName) @@ -96,7 +96,7 @@ func (s *StageSlice) UnmarshalYAML(v *yaml.Node) error { } // MarshalYAML implements the marshaler interface for the StageSlice type. -func (s StageSlice) MarshalYAML() (any, error) { +func (s StageSlice) MarshalYAML() (interface{}, error) { output := new(yaml.Node) output.Kind = yaml.MappingNode @@ -161,8 +161,10 @@ func (s *Stage) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - // set or update the stage environment variable - maps.Copy(s.Environment, environment) + for key, value := range environment { + // set or update the stage environment variable + s.Environment[key] = value + } return nil } diff --git a/compiler/types/yaml/step.go b/compiler/types/yaml/step.go index fde7272a1..d588222d7 100644 --- a/compiler/types/yaml/step.go +++ b/compiler/types/yaml/step.go @@ -4,7 +4,6 @@ package yaml import ( "fmt" - "maps" "strings" "github.com/go-vela/server/compiler/types/pipeline" @@ -20,24 +19,24 @@ type ( // Step is the yaml representation of a step // from the steps block for a pipeline. Step struct { - Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` - Commands raw.StringSlice `yaml:"commands,omitempty" json:"commands,omitempty" jsonschema:"description=Execution instructions to run inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-commands-key"` - Entrypoint raw.StringSlice `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty" jsonschema:"description=Command to execute inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-entrypoint-key"` - Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Sensitive variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` - Template StepTemplate `yaml:"template,omitempty" json:"template" jsonschema:"oneof_required=template,description=Name of template to expand in the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` - Artifacts Artifacts `yaml:"artifacts,omitempty" json:"artifacts" jsonschema:"description=Artifacts configuration for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-artifacts-key"` - Ulimits UlimitSlice `yaml:"ulimits,omitempty" json:"ulimits,omitempty" jsonschema:"description=Set the user limits for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ulimits-key"` - Volumes VolumeSlice `yaml:"volumes,omitempty" json:"volumes,omitempty" jsonschema:"description=Mount volumes for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-volume-key"` - Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"oneof_required=image,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` - Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` - Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Provide environment variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` - Parameters map[string]any `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for a plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` - Detach bool `yaml:"detach,omitempty" json:"detach,omitempty" jsonschema:"description=Run the container in a detached (headless) state.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-detach-key"` - Privileged bool `yaml:"privileged,omitempty" json:"privileged,omitempty" jsonschema:"description=Run the container with extra privileges.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-privileged-key"` - User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-key"` - ReportAs string `yaml:"report_as,omitempty" json:"report_as,omitempty" jsonschema:"description=Set the name of the step to report as.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-report_as-key"` - IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` + Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset,omitempty" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + Commands raw.StringSlice `yaml:"commands,omitempty" json:"commands,omitempty" jsonschema:"description=Execution instructions to run inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-commands-key"` + Entrypoint raw.StringSlice `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty" jsonschema:"description=Command to execute inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-entrypoint-key"` + Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Sensitive variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` + Template StepTemplate `yaml:"template,omitempty" json:"template,omitempty" jsonschema:"oneof_required=template,description=Name of template to expand in the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` + Artifacts Artifacts `yaml:"artifacts,omitempty" json:"artifacts,omitempty" jsonschema:"description=Artifacts configuration for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-artifacts-key"` + Ulimits UlimitSlice `yaml:"ulimits,omitempty" json:"ulimits,omitempty" jsonschema:"description=Set the user limits for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ulimits-key"` + Volumes VolumeSlice `yaml:"volumes,omitempty" json:"volumes,omitempty" jsonschema:"description=Mount volumes for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-volume-key"` + Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"oneof_required=image,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` + Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` + Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Provide environment variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` + Parameters map[string]interface{} `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for a plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` + Detach bool `yaml:"detach,omitempty" json:"detach,omitempty" jsonschema:"description=Run the container in a detached (headless) state.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-detach-key"` + Privileged bool `yaml:"privileged,omitempty" json:"privileged,omitempty" jsonschema:"description=Run the container with extra privileges.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-privileged-key"` + User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-key"` + ReportAs string `yaml:"report_as,omitempty" json:"report_as,omitempty" jsonschema:"description=Set the name of the step to report as.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-report_as-key"` + IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` } ) @@ -74,7 +73,7 @@ func (s *StepSlice) ToPipeline() *pipeline.ContainerSlice { } // UnmarshalYAML implements the Unmarshaler interface for the StepSlice type. -func (s *StepSlice) UnmarshalYAML(unmarshal func(any) error) error { +func (s *StepSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { // step slice we try unmarshalling to stepSlice := new([]*Step) @@ -142,8 +141,10 @@ func (s *Step) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - // set or update the step environment variable - maps.Copy(s.Environment, environment) + for key, value := range environment { + // set or update the step environment variable + s.Environment[key] = value + } return nil } diff --git a/compiler/types/yaml/step_test.go b/compiler/types/yaml/step_test.go index f018c116e..e4c1901a6 100644 --- a/compiler/types/yaml/step_test.go +++ b/compiler/types/yaml/step_test.go @@ -203,10 +203,10 @@ func TestYaml_StepSlice_UnmarshalYAML(t *testing.T) { Image: "plugins/docker:18.09", Pull: "always", ReportAs: "docker", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []any{"latest", "dev"}, + "tags": []interface{}{"latest", "dev"}, }, }, { @@ -214,10 +214,10 @@ func TestYaml_StepSlice_UnmarshalYAML(t *testing.T) { Pull: "not_present", Template: StepTemplate{ Name: "docker_publish", - Variables: map[string]any{ + Variables: map[string]interface{}{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []any{"latest", "dev"}, + "tags": []interface{}{"latest", "dev"}, }, }, }, diff --git a/compiler/types/yaml/template.go b/compiler/types/yaml/template.go index 1a540b219..4055fc9dc 100644 --- a/compiler/types/yaml/template.go +++ b/compiler/types/yaml/template.go @@ -14,23 +14,23 @@ type ( // Template is the yaml representation of a template // from the templates block for a pipeline. Template struct { - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-name-key"` - Source string `yaml:"source,omitempty" json:"source,omitempty" jsonschema:"required,minLength=1,description=Path to template in remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-source-key"` - Format string `yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=starlark,enum=golang,enum=go,default=go,minLength=1,description=language used within the template file \nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-format-key"` - Type string `yaml:"type,omitempty" json:"type,omitempty" jsonschema:"minLength=1,enum=github,enum=file,example=github,description=Type of template provided from the remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-type-key"` - Variables map[string]any `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-variables-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-name-key"` + Source string `yaml:"source,omitempty" json:"source,omitempty" jsonschema:"required,minLength=1,description=Path to template in remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-source-key"` + Format string `yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=starlark,enum=golang,enum=go,default=go,minLength=1,description=language used within the template file \nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-format-key"` + Type string `yaml:"type,omitempty" json:"type,omitempty" jsonschema:"minLength=1,enum=github,enum=file,example=github,description=Type of template provided from the remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-type-key"` + Variables map[string]interface{} `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-variables-key"` } // StepTemplate is the yaml representation of the // template block for a step in a pipeline. StepTemplate struct { - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` - Variables map[string]any `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` + Variables map[string]interface{} `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` } ) // UnmarshalYAML implements the Unmarshaler interface for the TemplateSlice type. -func (t *TemplateSlice) UnmarshalYAML(unmarshal func(any) error) error { +func (t *TemplateSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { // template slice we try unmarshalling to templateSlice := new([]*Template) diff --git a/compiler/types/yaml/ulimit.go b/compiler/types/yaml/ulimit.go index 1ed2bf0d1..af0fa544b 100644 --- a/compiler/types/yaml/ulimit.go +++ b/compiler/types/yaml/ulimit.go @@ -47,7 +47,7 @@ func (u *UlimitSlice) ToPipeline() *pipeline.UlimitSlice { } // UnmarshalYAML implements the Unmarshaler interface for the UlimitSlice type. -func (u *UlimitSlice) UnmarshalYAML(unmarshal func(any) error) error { +func (u *UlimitSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { // string slice we try unmarshalling to stringSlice := new(raw.StringSlice) diff --git a/compiler/types/yaml/volume.go b/compiler/types/yaml/volume.go index 3d6172f32..58740f652 100644 --- a/compiler/types/yaml/volume.go +++ b/compiler/types/yaml/volume.go @@ -46,7 +46,7 @@ func (v *VolumeSlice) ToPipeline() *pipeline.VolumeSlice { } // UnmarshalYAML implements the Unmarshaler interface for the VolumeSlice type. -func (v *VolumeSlice) UnmarshalYAML(unmarshal func(any) error) error { +func (v *VolumeSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { // string slice we try unmarshalling to stringSlice := new(raw.StringSlice) diff --git a/database/build/clean.go b/database/build/clean.go index d7b48bb40..ca0970d0f 100644 --- a/database/build/clean.go +++ b/database/build/clean.go @@ -21,7 +21,7 @@ func (e *Engine) CleanBuilds(ctx context.Context, msg string, before int64) (int Table(constants.TableBuild). Where("created < ?", before). Where("status = 'running' OR status = 'pending'"). - Updates(map[string]any{ + Updates(map[string]interface{}{ "status": constants.StatusError, "error": msg, "finished": time.Now().UTC().Unix(), diff --git a/database/build/count_deployment.go b/database/build/count_deployment.go index 595cb2b7f..e36b882f2 100644 --- a/database/build/count_deployment.go +++ b/database/build/count_deployment.go @@ -12,7 +12,7 @@ import ( ) // CountBuildsForDeployment gets the count of builds by deployment URL from the database. -func (e *Engine) CountBuildsForDeployment(ctx context.Context, d *api.Deployment, filters map[string]any) (int64, error) { +func (e *Engine) CountBuildsForDeployment(ctx context.Context, d *api.Deployment, filters map[string]interface{}) (int64, error) { e.logger.WithFields(logrus.Fields{ "deployment": d.GetURL(), }).Tracef("getting count of builds for deployment %s", d.GetURL()) diff --git a/database/build/count_deployment_test.go b/database/build/count_deployment_test.go index 750c397cd..6b424c716 100644 --- a/database/build/count_deployment_test.go +++ b/database/build/count_deployment_test.go @@ -97,7 +97,7 @@ func TestBuild_Engine_CountBuildsForDeployment(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/build/count_org.go b/database/build/count_org.go index 128d5973b..156eaae2a 100644 --- a/database/build/count_org.go +++ b/database/build/count_org.go @@ -11,7 +11,7 @@ import ( ) // CountBuildsForOrg gets the count of builds by org name from the database. -func (e *Engine) CountBuildsForOrg(ctx context.Context, org string, filters map[string]any) (int64, error) { +func (e *Engine) CountBuildsForOrg(ctx context.Context, org string, filters map[string]interface{}) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, }).Tracef("getting count of builds for org %s", org) diff --git a/database/build/count_org_test.go b/database/build/count_org_test.go index a44e1e4bf..4256da23b 100644 --- a/database/build/count_org_test.go +++ b/database/build/count_org_test.go @@ -105,21 +105,21 @@ func TestBuild_Engine_CountBuildsForOrg(t *testing.T) { failure bool name string database *Engine - filters map[string]any + filters map[string]interface{} want int64 }{ { failure: false, name: "postgres without filters", database: _postgres, - filters: map[string]any{}, + filters: map[string]interface{}{}, want: 2, }, { failure: false, name: "postgres with event filter", database: _postgres, - filters: map[string]any{ + filters: map[string]interface{}{ "event": "push", }, want: 2, @@ -128,14 +128,14 @@ func TestBuild_Engine_CountBuildsForOrg(t *testing.T) { failure: false, name: "sqlite3 without filters", database: _sqlite, - filters: map[string]any{}, + filters: map[string]interface{}{}, want: 2, }, { failure: false, name: "sqlite3 with event filter", database: _sqlite, - filters: map[string]any{ + filters: map[string]interface{}{ "event": "push", }, want: 2, diff --git a/database/build/count_repo.go b/database/build/count_repo.go index 387a61c81..cdcdb7d62 100644 --- a/database/build/count_repo.go +++ b/database/build/count_repo.go @@ -12,7 +12,7 @@ import ( ) // CountBuildsForRepo gets the count of builds by repo ID from the database. -func (e *Engine) CountBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]any, before, after int64) (int64, error) { +func (e *Engine) CountBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}, before, after int64) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/build/count_repo_test.go b/database/build/count_repo_test.go index 272838d5c..21553af73 100644 --- a/database/build/count_repo_test.go +++ b/database/build/count_repo_test.go @@ -88,7 +88,7 @@ func TestBuild_Engine_CountBuildsForRepo(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/build/count_status.go b/database/build/count_status.go index cbd708813..0ecbae4d4 100644 --- a/database/build/count_status.go +++ b/database/build/count_status.go @@ -9,7 +9,7 @@ import ( ) // CountBuildsForStatus gets the count of builds by status from the database. -func (e *Engine) CountBuildsForStatus(ctx context.Context, status string, filters map[string]any) (int64, error) { +func (e *Engine) CountBuildsForStatus(ctx context.Context, status string, filters map[string]interface{}) (int64, error) { e.logger.Tracef("getting count of builds for status %s", status) // variable to store query results diff --git a/database/build/count_status_test.go b/database/build/count_status_test.go index a7e666aed..9323cac39 100644 --- a/database/build/count_status_test.go +++ b/database/build/count_status_test.go @@ -87,7 +87,7 @@ func TestBuild_Engine_CountBuildsForStatus(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/build/interface.go b/database/build/interface.go index b376d1de9..f2d22d92b 100644 --- a/database/build/interface.go +++ b/database/build/interface.go @@ -31,13 +31,13 @@ type BuildInterface interface { // CountBuilds defines a function that gets the count of all builds. CountBuilds(context.Context) (int64, error) // CountBuildsForDeployment defines a function that gets the count of builds by deployment url. - CountBuildsForDeployment(context.Context, *api.Deployment, map[string]any) (int64, error) + CountBuildsForDeployment(context.Context, *api.Deployment, map[string]interface{}) (int64, error) // CountBuildsForOrg defines a function that gets the count of builds by org name. - CountBuildsForOrg(context.Context, string, map[string]any) (int64, error) + CountBuildsForOrg(context.Context, string, map[string]interface{}) (int64, error) // CountBuildsForRepo defines a function that gets the count of builds by repo ID. - CountBuildsForRepo(context.Context, *api.Repo, map[string]any, int64, int64) (int64, error) + CountBuildsForRepo(context.Context, *api.Repo, map[string]interface{}, int64, int64) (int64, error) // CountBuildsForStatus defines a function that gets the count of builds by status. - CountBuildsForStatus(context.Context, string, map[string]any) (int64, error) + CountBuildsForStatus(context.Context, string, map[string]interface{}) (int64, error) // CreateBuild defines a function that creates a new build. CreateBuild(context.Context, *api.Build) (*api.Build, error) // DeleteBuild defines a function that deletes an existing build. @@ -55,7 +55,7 @@ type BuildInterface interface { // ListBuildsForDashboardRepo defines a function that gets a list of builds based on dashboard filters. ListBuildsForDashboardRepo(context.Context, *api.Repo, []string, []string) ([]*api.Build, error) // ListBuildsForRepo defines a function that gets a list of builds by repo ID. - ListBuildsForRepo(context.Context, *api.Repo, map[string]any, int64, int64, int, int) ([]*api.Build, error) + ListBuildsForRepo(context.Context, *api.Repo, map[string]interface{}, int64, int64, int, int) ([]*api.Build, error) // ListPendingAndRunningBuilds defines a function that gets a list of pending and running builds. ListPendingAndRunningBuilds(context.Context, string) ([]*api.QueueBuild, error) // ListPendingAndRunningBuildsForRepo defines a function that gets a list of pending and running builds for a repo. diff --git a/database/build/list_repo.go b/database/build/list_repo.go index 71bc53895..95b0c6a94 100644 --- a/database/build/list_repo.go +++ b/database/build/list_repo.go @@ -15,7 +15,7 @@ import ( // ListBuildsForRepo gets a list of builds by repo ID from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]any, before, after int64, page, perPage int) ([]*api.Build, error) { +func (e *Engine) ListBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}, before, after int64, page, perPage int) ([]*api.Build, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/build/list_repo_test.go b/database/build/list_repo_test.go index 380a3e7c7..0909be480 100644 --- a/database/build/list_repo_test.go +++ b/database/build/list_repo_test.go @@ -92,7 +92,7 @@ func TestBuild_Engine_ListBuildsForRepo(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/context.go b/database/context.go index 196acbe1d..a09637e33 100644 --- a/database/context.go +++ b/database/context.go @@ -15,7 +15,7 @@ const key = "database" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the database Interface associated with this context. diff --git a/database/integration_test.go b/database/integration_test.go index ad549c431..5367517fd 100644 --- a/database/integration_test.go +++ b/database/integration_test.go @@ -176,7 +176,7 @@ func testBuilds(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for builds methods := make(map[string]bool) // capture the element type of the build interface - element := reflect.TypeFor[build.BuildInterface]() + element := reflect.TypeOf(new(build.BuildInterface)).Elem() // iterate through all methods found in the build interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for builds @@ -483,7 +483,7 @@ func testDashboards(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for schedules methods := make(map[string]bool) // capture the element type of the schedule interface - element := reflect.TypeFor[dashboard.DashboardInterface]() + element := reflect.TypeOf(new(dashboard.DashboardInterface)).Elem() // iterate through all methods found in the schedule interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for schedules @@ -575,7 +575,7 @@ func testExecutables(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for pipelines methods := make(map[string]bool) // capture the element type of the pipeline interface - element := reflect.TypeFor[executable.BuildExecutableInterface]() + element := reflect.TypeOf(new(executable.BuildExecutableInterface)).Elem() // iterate through all methods found in the pipeline interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for pipelines @@ -664,7 +664,7 @@ func testDeployments(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for deployments methods := make(map[string]bool) // capture the element type of the deployment interface - element := reflect.TypeFor[deployment.DeploymentInterface]() + element := reflect.TypeOf(new(deployment.DeploymentInterface)).Elem() // iterate through all methods found in the deployment interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for deployments @@ -844,7 +844,7 @@ func testHooks(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for hooks methods := make(map[string]bool) // capture the element type of the hook interface - element := reflect.TypeFor[hook.HookInterface]() + element := reflect.TypeOf(new(hook.HookInterface)).Elem() // iterate through all methods found in the hook interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for hooks @@ -1032,7 +1032,7 @@ func testJWKs(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for jwks methods := make(map[string]bool) // capture the element type of the jwk interface - element := reflect.TypeFor[dbJWK.JWKInterface]() + element := reflect.TypeOf(new(dbJWK.JWKInterface)).Elem() // iterate through all methods found in the jwk interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for jwks @@ -1131,7 +1131,7 @@ func testLogs(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for logs methods := make(map[string]bool) // capture the element type of the log interface - element := reflect.TypeFor[log.LogInterface]() + element := reflect.TypeOf(new(log.LogInterface)).Elem() // iterate through all methods found in the log interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for logs @@ -1288,7 +1288,7 @@ func testPipelines(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for pipelines methods := make(map[string]bool) // capture the element type of the pipeline interface - element := reflect.TypeFor[pipeline.PipelineInterface]() + element := reflect.TypeOf(new(pipeline.PipelineInterface)).Elem() // iterate through all methods found in the pipeline interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for pipelines @@ -1479,7 +1479,7 @@ func testRepos(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for repos methods := make(map[string]bool) // capture the element type of the repo interface - element := reflect.TypeFor[repo.RepoInterface]() + element := reflect.TypeOf(new(repo.RepoInterface)).Elem() // iterate through all methods found in the repo interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for repos @@ -1695,7 +1695,7 @@ func testSchedules(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for schedules methods := make(map[string]bool) // capture the element type of the schedule interface - element := reflect.TypeFor[schedule.ScheduleInterface]() + element := reflect.TypeOf(new(schedule.ScheduleInterface)).Elem() // iterate through all methods found in the schedule interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for schedules @@ -1878,7 +1878,7 @@ func testSecrets(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for secrets methods := make(map[string]bool) // capture the element type of the secret interface - element := reflect.TypeFor[secret.SecretInterface]() + element := reflect.TypeOf(new(secret.SecretInterface)).Elem() // iterate through all methods found in the secret interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for secrets @@ -2149,7 +2149,7 @@ func testServices(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for services methods := make(map[string]bool) // capture the element type of the service interface - element := reflect.TypeFor[service.ServiceInterface]() + element := reflect.TypeOf(new(service.ServiceInterface)).Elem() // iterate through all methods found in the service interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for services @@ -2323,7 +2323,7 @@ func testSteps(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for steps methods := make(map[string]bool) // capture the element type of the step interface - element := reflect.TypeFor[step.StepInterface]() + element := reflect.TypeOf(new(step.StepInterface)).Elem() // iterate through all methods found in the step interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for steps @@ -2499,7 +2499,7 @@ func testUsers(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for users methods := make(map[string]bool) // capture the element type of the user interface - element := reflect.TypeFor[user.UserInterface]() + element := reflect.TypeOf(new(user.UserInterface)).Elem() // iterate through all methods found in the user interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for users @@ -2634,7 +2634,7 @@ func testWorkers(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for workers methods := make(map[string]bool) // capture the element type of the worker interface - element := reflect.TypeFor[worker.WorkerInterface]() + element := reflect.TypeOf(new(worker.WorkerInterface)).Elem() // iterate through all methods found in the worker interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for workers @@ -2735,7 +2735,7 @@ func testSettings(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for settings methods := make(map[string]bool) // capture the element type of the settings interface - element := reflect.TypeFor[dbSettings.SettingsInterface]() + element := reflect.TypeOf(new(dbSettings.SettingsInterface)).Elem() // iterate through all methods found in the settings interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for settings diff --git a/database/logger.go b/database/logger.go index 1ff93c2cf..819574704 100644 --- a/database/logger.go +++ b/database/logger.go @@ -37,17 +37,17 @@ func (l *GormLogger) LogMode(logger.LogLevel) logger.Interface { } // Info implements the logger.Interface. -func (l *GormLogger) Info(ctx context.Context, msg string, args ...any) { +func (l *GormLogger) Info(ctx context.Context, msg string, args ...interface{}) { l.entry.WithContext(ctx).Info(msg, args) } // Warn implements the logger.Interface. -func (l *GormLogger) Warn(ctx context.Context, msg string, args ...any) { +func (l *GormLogger) Warn(ctx context.Context, msg string, args ...interface{}) { l.entry.WithContext(ctx).Warn(msg, args) } // Error implements the logger.Interface. -func (l *GormLogger) Error(ctx context.Context, msg string, args ...any) { +func (l *GormLogger) Error(ctx context.Context, msg string, args ...interface{}) { l.entry.WithContext(ctx).Error(msg, args) } diff --git a/database/ping.go b/database/ping.go index 9d294fca5..51c502a80 100644 --- a/database/ping.go +++ b/database/ping.go @@ -12,7 +12,7 @@ func (e *engine) Ping() error { e.logger.Tracef("sending ping request to the %s database", e.Driver()) // create a loop to attempt ping requests 5 times - for i := range 5 { + for i := 0; i < 5; i++ { // capture database/sql database from gorm.io/gorm database _sql, err := e.client.DB() if err != nil { diff --git a/database/repo/count_org.go b/database/repo/count_org.go index 8a6125e16..8f4417625 100644 --- a/database/repo/count_org.go +++ b/database/repo/count_org.go @@ -11,7 +11,7 @@ import ( ) // CountReposForOrg gets the count of repos by org name from the database. -func (e *Engine) CountReposForOrg(ctx context.Context, org string, filters map[string]any) (int64, error) { +func (e *Engine) CountReposForOrg(ctx context.Context, org string, filters map[string]interface{}) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, }).Tracef("getting count of repos for org %s", org) diff --git a/database/repo/count_org_test.go b/database/repo/count_org_test.go index c3bf17c68..9444cf0a9 100644 --- a/database/repo/count_org_test.go +++ b/database/repo/count_org_test.go @@ -77,7 +77,7 @@ func TestRepo_Engine_CountReposForOrg(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/repo/count_user.go b/database/repo/count_user.go index 63e622641..2cd366e65 100644 --- a/database/repo/count_user.go +++ b/database/repo/count_user.go @@ -12,7 +12,7 @@ import ( ) // CountReposForUser gets the count of repos by user ID from the database. -func (e *Engine) CountReposForUser(ctx context.Context, u *api.User, filters map[string]any) (int64, error) { +func (e *Engine) CountReposForUser(ctx context.Context, u *api.User, filters map[string]interface{}) (int64, error) { e.logger.WithFields(logrus.Fields{ "user": u.GetName(), }).Tracef("getting count of repos for user %s", u.GetName()) diff --git a/database/repo/count_user_test.go b/database/repo/count_user_test.go index e897a88eb..de04d0c5f 100644 --- a/database/repo/count_user_test.go +++ b/database/repo/count_user_test.go @@ -81,7 +81,7 @@ func TestRepo_Engine_CountReposForUser(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/repo/interface.go b/database/repo/interface.go index 113d5e5b2..56641467d 100644 --- a/database/repo/interface.go +++ b/database/repo/interface.go @@ -29,9 +29,9 @@ type RepoInterface interface { // CountRepos defines a function that gets the count of all repos. CountRepos(context.Context) (int64, error) // CountReposForOrg defines a function that gets the count of repos by org name. - CountReposForOrg(context.Context, string, map[string]any) (int64, error) + CountReposForOrg(context.Context, string, map[string]interface{}) (int64, error) // CountReposForUser defines a function that gets the count of repos by user ID. - CountReposForUser(context.Context, *api.User, map[string]any) (int64, error) + CountReposForUser(context.Context, *api.User, map[string]interface{}) (int64, error) // CreateRepo defines a function that creates a new repo. CreateRepo(context.Context, *api.Repo) (*api.Repo, error) // DeleteRepo defines a function that deletes an existing repo. @@ -45,9 +45,9 @@ type RepoInterface interface { // ListRepos defines a function that gets a list of all repos. ListRepos(context.Context) ([]*api.Repo, error) // ListReposForOrg defines a function that gets a list of repos by org name. - ListReposForOrg(context.Context, string, string, map[string]any, int, int) ([]*api.Repo, error) + ListReposForOrg(context.Context, string, string, map[string]interface{}, int, int) ([]*api.Repo, error) // ListReposForUser defines a function that gets a list of repos by user ID. - ListReposForUser(context.Context, *api.User, string, map[string]any, int, int) ([]*api.Repo, error) + ListReposForUser(context.Context, *api.User, string, map[string]interface{}, int, int) ([]*api.Repo, error) // UpdateRepo defines a function that updates an existing repo. UpdateRepo(context.Context, *api.Repo) (*api.Repo, error) } diff --git a/database/repo/list_org.go b/database/repo/list_org.go index 66ddcaefb..c0f02fa2c 100644 --- a/database/repo/list_org.go +++ b/database/repo/list_org.go @@ -15,7 +15,7 @@ import ( // ListReposForOrg gets a list of repos by org name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListReposForOrg(ctx context.Context, org, sortBy string, filters map[string]any, page, perPage int) ([]*api.Repo, error) { +func (e *Engine) ListReposForOrg(ctx context.Context, org, sortBy string, filters map[string]interface{}, page, perPage int) ([]*api.Repo, error) { e.logger.WithFields(logrus.Fields{ "org": org, }).Tracef("listing repos for org %s", org) diff --git a/database/repo/list_org_test.go b/database/repo/list_org_test.go index fb671b84f..8aff303de 100644 --- a/database/repo/list_org_test.go +++ b/database/repo/list_org_test.go @@ -157,7 +157,7 @@ func TestRepo_Engine_ListReposForOrg(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/repo/list_user.go b/database/repo/list_user.go index 0d29cf2a0..2e0f52dc9 100644 --- a/database/repo/list_user.go +++ b/database/repo/list_user.go @@ -15,7 +15,7 @@ import ( // ListReposForUser gets a list of repos by user ID from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListReposForUser(ctx context.Context, u *api.User, sortBy string, filters map[string]any, page, perPage int) ([]*api.Repo, error) { +func (e *Engine) ListReposForUser(ctx context.Context, u *api.User, sortBy string, filters map[string]interface{}, page, perPage int) ([]*api.Repo, error) { e.logger.WithFields(logrus.Fields{ "user": u.GetName(), }).Tracef("listing repos for user %s", u.GetName()) diff --git a/database/repo/list_user_test.go b/database/repo/list_user_test.go index d49eae238..7fea23252 100644 --- a/database/repo/list_user_test.go +++ b/database/repo/list_user_test.go @@ -156,7 +156,7 @@ func TestRepo_Engine_ListReposForUser(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/secret/count_org.go b/database/secret/count_org.go index 75b39a66c..c84ef3135 100644 --- a/database/secret/count_org.go +++ b/database/secret/count_org.go @@ -11,7 +11,7 @@ import ( ) // CountSecretsForOrg gets the count of secrets by org name from the database. -func (e *Engine) CountSecretsForOrg(ctx context.Context, org string, filters map[string]any) (int64, error) { +func (e *Engine) CountSecretsForOrg(ctx context.Context, org string, filters map[string]interface{}) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, "type": constants.SecretOrg, diff --git a/database/secret/count_org_test.go b/database/secret/count_org_test.go index cf01f3c2c..8208be9a0 100644 --- a/database/secret/count_org_test.go +++ b/database/secret/count_org_test.go @@ -85,7 +85,7 @@ func TestSecret_Engine_CountSecretsForOrg(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/secret/count_repo.go b/database/secret/count_repo.go index 1a66f5d59..84bad6058 100644 --- a/database/secret/count_repo.go +++ b/database/secret/count_repo.go @@ -12,7 +12,7 @@ import ( ) // CountSecretsForRepo gets the count of secrets by org and repo name from the database. -func (e *Engine) CountSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]any) (int64, error) { +func (e *Engine) CountSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/secret/count_repo_test.go b/database/secret/count_repo_test.go index 813d0e3e2..632840b08 100644 --- a/database/secret/count_repo_test.go +++ b/database/secret/count_repo_test.go @@ -95,7 +95,7 @@ func TestSecret_Engine_CountSecretsForRepo(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/secret/count_team.go b/database/secret/count_team.go index b5437e41c..789a85f14 100644 --- a/database/secret/count_team.go +++ b/database/secret/count_team.go @@ -12,7 +12,7 @@ import ( ) // CountSecretsForTeam gets the count of secrets by org and team name from the database. -func (e *Engine) CountSecretsForTeam(ctx context.Context, org, team string, filters map[string]any) (int64, error) { +func (e *Engine) CountSecretsForTeam(ctx context.Context, org, team string, filters map[string]interface{}) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, "team": team, @@ -37,7 +37,7 @@ func (e *Engine) CountSecretsForTeam(ctx context.Context, org, team string, filt } // CountSecretsForTeams gets the count of secrets by teams within an org from the database. -func (e *Engine) CountSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]any) (int64, error) { +func (e *Engine) CountSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]interface{}) (int64, error) { // lower case team names for not case-sensitive values from the SCM i.e. GitHub // // iterate through the list of teams provided diff --git a/database/secret/count_team_test.go b/database/secret/count_team_test.go index 57fca797a..6aa0a6aae 100644 --- a/database/secret/count_team_test.go +++ b/database/secret/count_team_test.go @@ -85,7 +85,7 @@ func TestSecret_Engine_CountSecretsForTeam(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { @@ -193,7 +193,7 @@ func TestSecret_Engine_CountSecretsForTeams(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/secret/interface.go b/database/secret/interface.go index 46f6da43c..fa37ddd47 100644 --- a/database/secret/interface.go +++ b/database/secret/interface.go @@ -29,13 +29,13 @@ type SecretInterface interface { // CountSecrets defines a function that gets the count of all secrets. CountSecrets(context.Context) (int64, error) // CountSecretsForOrg defines a function that gets the count of secrets by org name. - CountSecretsForOrg(context.Context, string, map[string]any) (int64, error) + CountSecretsForOrg(context.Context, string, map[string]interface{}) (int64, error) // CountSecretsForRepo defines a function that gets the count of secrets by org and repo name. - CountSecretsForRepo(context.Context, *api.Repo, map[string]any) (int64, error) + CountSecretsForRepo(context.Context, *api.Repo, map[string]interface{}) (int64, error) // CountSecretsForTeam defines a function that gets the count of secrets by org and team name. - CountSecretsForTeam(context.Context, string, string, map[string]any) (int64, error) + CountSecretsForTeam(context.Context, string, string, map[string]interface{}) (int64, error) // CountSecretsForTeams defines a function that gets the count of secrets by teams within an org. - CountSecretsForTeams(context.Context, string, []string, map[string]any) (int64, error) + CountSecretsForTeams(context.Context, string, []string, map[string]interface{}) (int64, error) // CreateSecret defines a function that creates a new secret. CreateSecret(context.Context, *api.Secret) (*api.Secret, error) // DeleteSecret defines a function that deletes an existing secret. @@ -55,13 +55,13 @@ type SecretInterface interface { // ListSecrets defines a function that gets a list of all secrets. ListSecrets(context.Context) ([]*api.Secret, error) // ListSecretsForOrg defines a function that gets a list of secrets by org name. - ListSecretsForOrg(context.Context, string, map[string]any, int, int) ([]*api.Secret, error) + ListSecretsForOrg(context.Context, string, map[string]interface{}, int, int) ([]*api.Secret, error) // ListSecretsForRepo defines a function that gets a list of secrets by org and repo name. - ListSecretsForRepo(context.Context, *api.Repo, map[string]any, int, int) ([]*api.Secret, error) + ListSecretsForRepo(context.Context, *api.Repo, map[string]interface{}, int, int) ([]*api.Secret, error) // ListSecretsForTeam defines a function that gets a list of secrets by org and team name. - ListSecretsForTeam(context.Context, string, string, map[string]any, int, int) ([]*api.Secret, error) + ListSecretsForTeam(context.Context, string, string, map[string]interface{}, int, int) ([]*api.Secret, error) // ListSecretsForTeams defines a function that gets a list of secrets by teams within an org. - ListSecretsForTeams(context.Context, string, []string, map[string]any, int, int) ([]*api.Secret, error) + ListSecretsForTeams(context.Context, string, []string, map[string]interface{}, int, int) ([]*api.Secret, error) // MigrateSecrets defines a function that updates the org and name of all repo secrets when there is a name change. MigrateSecrets(context.Context, string, string, string, string) error // UpdateSecret defines a function that updates an existing secret. diff --git a/database/secret/list_org.go b/database/secret/list_org.go index 8bcf06e87..b2fcf1c70 100644 --- a/database/secret/list_org.go +++ b/database/secret/list_org.go @@ -15,7 +15,7 @@ import ( // ListSecretsForOrg gets a list of secrets by org name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListSecretsForOrg(ctx context.Context, org string, filters map[string]any, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForOrg(ctx context.Context, org string, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { e.logger.WithFields(logrus.Fields{ "org": org, "type": constants.SecretOrg, diff --git a/database/secret/list_org_test.go b/database/secret/list_org_test.go index 87765d89b..2756b9bf2 100644 --- a/database/secret/list_org_test.go +++ b/database/secret/list_org_test.go @@ -93,7 +93,7 @@ func TestSecret_Engine_ListSecretsForOrg(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/secret/list_repo.go b/database/secret/list_repo.go index ccf6df308..b680968d1 100644 --- a/database/secret/list_repo.go +++ b/database/secret/list_repo.go @@ -15,7 +15,7 @@ import ( // ListSecretsForRepo gets a list of secrets by org name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]any, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/secret/list_repo_test.go b/database/secret/list_repo_test.go index 5cefc83fa..c411bbc57 100644 --- a/database/secret/list_repo_test.go +++ b/database/secret/list_repo_test.go @@ -103,7 +103,7 @@ func TestSecret_Engine_ListSecretsForRepo(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/secret/list_team.go b/database/secret/list_team.go index dd28161b0..f714aa63f 100644 --- a/database/secret/list_team.go +++ b/database/secret/list_team.go @@ -16,7 +16,7 @@ import ( // ListSecretsForTeam gets a list of secrets by org and team name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListSecretsForTeam(ctx context.Context, org, team string, filters map[string]any, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForTeam(ctx context.Context, org, team string, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { e.logger.WithFields(logrus.Fields{ "org": org, "team": team, @@ -69,7 +69,7 @@ func (e *Engine) ListSecretsForTeam(ctx context.Context, org, team string, filte } // ListSecretsForTeams gets a list of secrets by teams within an org from the database. -func (e *Engine) ListSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]any, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { // iterate through the list of teams provided for index, team := range teams { // ensure the team name is lower case diff --git a/database/secret/list_team_test.go b/database/secret/list_team_test.go index 8e371d8d3..be1e82c24 100644 --- a/database/secret/list_team_test.go +++ b/database/secret/list_team_test.go @@ -95,7 +95,7 @@ func TestSecret_Engine_ListSecretsForTeam(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { @@ -210,7 +210,7 @@ func TestSecret_Engine_ListSecretsForTeams(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/service/count_build.go b/database/service/count_build.go index ff81bd932..f985f4fc2 100644 --- a/database/service/count_build.go +++ b/database/service/count_build.go @@ -12,7 +12,7 @@ import ( ) // CountServicesForBuild gets the count of services by build ID from the database. -func (e *Engine) CountServicesForBuild(ctx context.Context, b *api.Build, filters map[string]any) (int64, error) { +func (e *Engine) CountServicesForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}) (int64, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("getting count of services for build %d", b.GetNumber()) diff --git a/database/service/count_build_test.go b/database/service/count_build_test.go index e13e6bbae..b46fe9e6b 100644 --- a/database/service/count_build_test.go +++ b/database/service/count_build_test.go @@ -80,7 +80,7 @@ func TestService_Engine_CountServicesForBuild(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/service/interface.go b/database/service/interface.go index 8899637f0..dbb2aa6c9 100644 --- a/database/service/interface.go +++ b/database/service/interface.go @@ -29,7 +29,7 @@ type ServiceInterface interface { // CountServices defines a function that gets the count of all services. CountServices(context.Context) (int64, error) // CountServicesForBuild defines a function that gets the count of services by build ID. - CountServicesForBuild(context.Context, *api.Build, map[string]any) (int64, error) + CountServicesForBuild(context.Context, *api.Build, map[string]interface{}) (int64, error) // CreateService defines a function that creates a new service. CreateService(context.Context, *api.Service) (*api.Service, error) // DeleteService defines a function that deletes an existing service. @@ -41,7 +41,7 @@ type ServiceInterface interface { // ListServices defines a function that gets a list of all services. ListServices(context.Context) ([]*api.Service, error) // ListServicesForBuild defines a function that gets a list of services by build ID. - ListServicesForBuild(context.Context, *api.Build, map[string]any, int, int) ([]*api.Service, error) + ListServicesForBuild(context.Context, *api.Build, map[string]interface{}, int, int) ([]*api.Service, error) // ListServiceImageCount defines a function that gets a list of all service images and the count of their occurrence. ListServiceImageCount(context.Context) (map[string]float64, error) // ListServiceStatusCount defines a function that gets a list of all service statuses and the count of their occurrence. diff --git a/database/service/list_build.go b/database/service/list_build.go index 93d5c9d03..f251de4a6 100644 --- a/database/service/list_build.go +++ b/database/service/list_build.go @@ -13,7 +13,7 @@ import ( ) // ListServicesForBuild gets a list of all services from the database. -func (e *Engine) ListServicesForBuild(ctx context.Context, b *api.Build, filters map[string]any, page int, perPage int) ([]*api.Service, error) { +func (e *Engine) ListServicesForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}, page int, perPage int) ([]*api.Service, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("listing services for build %d", b.GetNumber()) diff --git a/database/service/list_build_test.go b/database/service/list_build_test.go index c024e8c53..af383c3f3 100644 --- a/database/service/list_build_test.go +++ b/database/service/list_build_test.go @@ -80,7 +80,7 @@ func TestService_Engine_ListServicesForBuild(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/step/count_build.go b/database/step/count_build.go index a828db4b5..a25af4008 100644 --- a/database/step/count_build.go +++ b/database/step/count_build.go @@ -12,7 +12,7 @@ import ( ) // CountStepsForBuild gets the count of steps by build ID from the database. -func (e *Engine) CountStepsForBuild(ctx context.Context, b *api.Build, filters map[string]any) (int64, error) { +func (e *Engine) CountStepsForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}) (int64, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("getting count of steps for build %d", b.GetNumber()) diff --git a/database/step/count_build_test.go b/database/step/count_build_test.go index a88d964ec..fead13b93 100644 --- a/database/step/count_build_test.go +++ b/database/step/count_build_test.go @@ -82,7 +82,7 @@ func TestStep_Engine_CountStepsForBuild(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/step/interface.go b/database/step/interface.go index 9c192bf89..83fcda729 100644 --- a/database/step/interface.go +++ b/database/step/interface.go @@ -29,7 +29,7 @@ type StepInterface interface { // CountSteps defines a function that gets the count of all steps. CountSteps(context.Context) (int64, error) // CountStepsForBuild defines a function that gets the count of steps by build ID. - CountStepsForBuild(context.Context, *api.Build, map[string]any) (int64, error) + CountStepsForBuild(context.Context, *api.Build, map[string]interface{}) (int64, error) // CreateStep defines a function that creates a new step. CreateStep(context.Context, *api.Step) (*api.Step, error) // DeleteStep defines a function that deletes an existing step. @@ -41,7 +41,7 @@ type StepInterface interface { // ListSteps defines a function that gets a list of all steps. ListSteps(ctx context.Context) ([]*api.Step, error) // ListStepsForBuild defines a function that gets a list of steps by build ID. - ListStepsForBuild(context.Context, *api.Build, map[string]any, int, int) ([]*api.Step, error) + ListStepsForBuild(context.Context, *api.Build, map[string]interface{}, int, int) ([]*api.Step, error) // ListStepImageCount defines a function that gets a list of all step images and the count of their occurrence. ListStepImageCount(context.Context) (map[string]float64, error) // ListStepStatusCount defines a function that gets a list of all step statuses and the count of their occurrence. diff --git a/database/step/list_build.go b/database/step/list_build.go index 7d323c6d9..e6fcd1862 100644 --- a/database/step/list_build.go +++ b/database/step/list_build.go @@ -13,7 +13,7 @@ import ( ) // ListStepsForBuild gets a list of all steps from the database. -func (e *Engine) ListStepsForBuild(ctx context.Context, b *api.Build, filters map[string]any, page int, perPage int) ([]*api.Step, error) { +func (e *Engine) ListStepsForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}, page int, perPage int) ([]*api.Step, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("listing steps for build %d", b.GetNumber()) diff --git a/database/step/list_build_test.go b/database/step/list_build_test.go index 50faa1616..e46f59705 100644 --- a/database/step/list_build_test.go +++ b/database/step/list_build_test.go @@ -83,7 +83,7 @@ func TestStep_Engine_ListStepsForBuild(t *testing.T) { }, } - filters := map[string]any{} + filters := map[string]interface{}{} // run tests for _, test := range tests { diff --git a/database/testutils/mock_args.go b/database/testutils/mock_args.go index 463e1fe33..62d9f07fb 100644 --- a/database/testutils/mock_args.go +++ b/database/testutils/mock_args.go @@ -39,12 +39,12 @@ func (t NowTimestamp) Match(v driver.Value) bool { } var JwkKeyOpts = cmp.Options{ - cmp.FilterValues(func(x, y any) bool { + cmp.FilterValues(func(x, y interface{}) bool { _, xOk := x.(jwk.RSAPublicKey) _, yOk := y.(jwk.RSAPublicKey) return xOk && yOk - }, cmp.Comparer(func(x, y any) bool { + }, cmp.Comparer(func(x, y interface{}) bool { xJWK := x.(jwk.RSAPublicKey) yJWK := y.(jwk.RSAPublicKey) diff --git a/database/types/dashboard.go b/database/types/dashboard.go index 6d82250c1..fc90e3818 100644 --- a/database/types/dashboard.go +++ b/database/types/dashboard.go @@ -49,7 +49,7 @@ func (r DashReposJSON) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for DashReposJSON. -func (r *DashReposJSON) Scan(value any) error { +func (r *DashReposJSON) Scan(value interface{}) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &r) @@ -67,7 +67,7 @@ func (a AdminsJSON) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for AdminsJSON. -func (a *AdminsJSON) Scan(value any) error { +func (a *AdminsJSON) Scan(value interface{}) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &a) diff --git a/database/types/deployment_test.go b/database/types/deployment_test.go index a93ab9226..7f5db4d9f 100644 --- a/database/types/deployment_test.go +++ b/database/types/deployment_test.go @@ -233,7 +233,7 @@ func generateBuilds(amount int) []string { // initialize empty builds builds := []string{} - for range amount { + for i := 0; i < amount; i++ { builds = append(builds, "123456789") } diff --git a/database/types/settings.go b/database/types/settings.go index 209b93735..c64d4c6a2 100644 --- a/database/types/settings.go +++ b/database/types/settings.go @@ -69,7 +69,7 @@ func (r Compiler) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for Compiler. -func (r *Compiler) Scan(value any) error { +func (r *Compiler) Scan(value interface{}) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &r) @@ -87,7 +87,7 @@ func (r Queue) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for Queue. -func (r *Queue) Scan(value any) error { +func (r *Queue) Scan(value interface{}) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &r) @@ -105,7 +105,7 @@ func (s SCM) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for Queue. -func (s *SCM) Scan(value any) error { +func (s *SCM) Scan(value interface{}) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &s) diff --git a/database/types/user_test.go b/database/types/user_test.go index d4d1430fb..3d02427e8 100644 --- a/database/types/user_test.go +++ b/database/types/user_test.go @@ -280,7 +280,7 @@ func exceededField(indexes int) []string { values := []string{} // add enough strings to exceed the character limit - for i := range indexes { + for i := 0; i < indexes; i++ { // construct field // use i to adhere to unique favorites field := "github/octocat-" + strconv.Itoa(i) diff --git a/database/types/worker_test.go b/database/types/worker_test.go index e748c95e4..89cea1b2c 100644 --- a/database/types/worker_test.go +++ b/database/types/worker_test.go @@ -200,7 +200,7 @@ func exceededRunningBuildIDs() []string { runningBuildIDs := []string{} // add enough build ids to exceed the character limit - for i := range 50 { + for i := 0; i < 50; i++ { // construct runningBuildID // use i to adhere to unique runningBuildIDs runningBuildID := "1234567890-" + strconv.Itoa(i) diff --git a/go.sum b/go.sum index 90de15586..4d661f200 100644 --- a/go.sum +++ b/go.sum @@ -403,6 +403,7 @@ golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 h1:merA0rdPeUV3YIIfHHcH4qBkiQAc1nfCKSI7lB4cV2M= diff --git a/internal/token/parse.go b/internal/token/parse.go index c02e381a1..74d1a6ee8 100644 --- a/internal/token/parse.go +++ b/internal/token/parse.go @@ -22,7 +22,7 @@ func (tm *Manager) ParseToken(token string) (*Claims, error) { p := jwt.NewParser(jwt.WithValidMethods([]string{jwt.SigningMethodHS256.Name})) // parse and validate given token - tkn, err := p.ParseWithClaims(token, claims, func(t *jwt.Token) (any, error) { + tkn, err := p.ParseWithClaims(token, claims, func(t *jwt.Token) (interface{}, error) { var err error // extract the claims from the token diff --git a/internal/yaml_test.go b/internal/yaml_test.go index 95f3c921c..e70c063f8 100644 --- a/internal/yaml_test.go +++ b/internal/yaml_test.go @@ -23,7 +23,7 @@ func TestInternal_ParseYAML(t *testing.T) { &yaml.Step{ Name: "example", Image: "alpine:latest", - Parameters: map[string]any{ + Parameters: map[string]interface{}{ "REGION": "dev", }, Pull: "not_present", diff --git a/mock/server/build.go b/mock/server/build.go index cd8ee5889..25b694d6e 100644 --- a/mock/server/build.go +++ b/mock/server/build.go @@ -553,11 +553,12 @@ func getInstallToken(c *gin.Context) { var body api.Token - data := - fmt.Appendf(nil, + data := []byte( + fmt.Sprintf( InstallTokenResp, time.Now().Add(1*time.Hour).Unix(), - ) + ), + ) _ = json.Unmarshal(data, &body) diff --git a/mock/server/build_test.go b/mock/server/build_test.go index 0836d37b0..0d7c4825a 100644 --- a/mock/server/build_test.go +++ b/mock/server/build_test.go @@ -18,7 +18,7 @@ func TestBuild_ActiveBuildResp(t *testing.T) { t.Errorf("error unmarshaling build: %v", err) } - tBuild := reflect.TypeFor[api.Build]() + tBuild := reflect.TypeOf(testBuild) for i := 0; i < tBuild.NumField(); i++ { if reflect.ValueOf(testBuild).Field(i).IsNil() { diff --git a/mock/server/dashboard_test.go b/mock/server/dashboard_test.go index 2787f1e50..0c4e42187 100644 --- a/mock/server/dashboard_test.go +++ b/mock/server/dashboard_test.go @@ -18,7 +18,7 @@ func TestDashboard_ActiveDashboardResp(t *testing.T) { t.Errorf("error unmarshaling dashboard: %v", err) } - tDashboard := reflect.TypeFor[api.Dashboard]() + tDashboard := reflect.TypeOf(testDashboard) for i := 0; i < tDashboard.NumField(); i++ { if reflect.ValueOf(testDashboard).Field(i).IsNil() { @@ -33,7 +33,7 @@ func TestDashboard_ActiveDashboardResp(t *testing.T) { t.Errorf("error unmarshaling dash card: %v", err) } - tDashCard := reflect.TypeFor[api.DashCard]() + tDashCard := reflect.TypeOf(testDashCard) for i := 0; i < tDashCard.NumField(); i++ { if reflect.ValueOf(testDashCard).Field(i).IsNil() { @@ -49,7 +49,7 @@ func TestDashboard_ActiveDashboardResp(t *testing.T) { } for _, testDashCard := range testDashCards { - tDashCard := reflect.TypeFor[api.DashCard]() + tDashCard := reflect.TypeOf(testDashCard) for i := 0; i < tDashCard.NumField(); i++ { if reflect.ValueOf(testDashCard).Field(i).IsNil() { diff --git a/mock/server/deployment_test.go b/mock/server/deployment_test.go index db85d78fb..fd5862e11 100644 --- a/mock/server/deployment_test.go +++ b/mock/server/deployment_test.go @@ -18,7 +18,7 @@ func TestDeployment_ActiveDeploymentResp(t *testing.T) { t.Errorf("error unmarshaling deployment: %v", err) } - tDeployment := reflect.TypeFor[api.Deployment]() + tDeployment := reflect.TypeOf(testDeployment) for i := 0; i < tDeployment.NumField(); i++ { if reflect.ValueOf(testDeployment).Field(i).IsNil() { diff --git a/mock/server/hook_test.go b/mock/server/hook_test.go index 808560eb1..8ce8af220 100644 --- a/mock/server/hook_test.go +++ b/mock/server/hook_test.go @@ -18,7 +18,7 @@ func TestHook_ActiveHookResp(t *testing.T) { t.Errorf("error unmarshaling hook: %v", err) } - tHook := reflect.TypeFor[api.Hook]() + tHook := reflect.TypeOf(testHook) for i := 0; i < tHook.NumField(); i++ { if reflect.ValueOf(testHook).Field(i).IsNil() { diff --git a/mock/server/log_test.go b/mock/server/log_test.go index 6feca0e15..28fbdc4a9 100644 --- a/mock/server/log_test.go +++ b/mock/server/log_test.go @@ -18,7 +18,7 @@ func TestLog_ActiveLogResp(t *testing.T) { t.Errorf("error unmarshaling log: %v", err) } - tLog := reflect.TypeFor[api.Log]() + tLog := reflect.TypeOf(testLog) for i := 0; i < tLog.NumField(); i++ { if reflect.ValueOf(testLog).Field(i).IsNil() { diff --git a/mock/server/pipeline.go b/mock/server/pipeline.go index 9b1374140..4544c8041 100644 --- a/mock/server/pipeline.go +++ b/mock/server/pipeline.go @@ -484,7 +484,7 @@ func getTemplates(c *gin.Context) { writeYAML(c, http.StatusOK, body) } -func writeYAML(c *gin.Context, status int, value any) { +func writeYAML(c *gin.Context, status int, value interface{}) { body, err := yml.Marshal(value) if err != nil { msg := fmt.Sprintf("unable to marshal YAML response: %v", err) diff --git a/mock/server/pipeline_test.go b/mock/server/pipeline_test.go index 715f56f71..3f67c6461 100644 --- a/mock/server/pipeline_test.go +++ b/mock/server/pipeline_test.go @@ -18,7 +18,7 @@ func TestPipeline_ActivePipelineResp(t *testing.T) { t.Errorf("error unmarshaling pipeline: %v", err) } - tPipeline := reflect.TypeFor[api.Pipeline]() + tPipeline := reflect.TypeOf(testPipeline) for i := 0; i < tPipeline.NumField(); i++ { if reflect.ValueOf(testPipeline).Field(i).IsNil() { diff --git a/mock/server/repo_test.go b/mock/server/repo_test.go index 6d473c266..19ff8599e 100644 --- a/mock/server/repo_test.go +++ b/mock/server/repo_test.go @@ -18,7 +18,7 @@ func TestRepo_ActiveRepoResp(t *testing.T) { t.Errorf("error unmarshaling repo: %v", err) } - tRepo := reflect.TypeFor[api.Repo]() + tRepo := reflect.TypeOf(testRepo) for i := 0; i < tRepo.NumField(); i++ { if tRepo.Field(i).Name == "Hash" { diff --git a/mock/server/schedule_test.go b/mock/server/schedule_test.go index 394bbb7ff..293676e02 100644 --- a/mock/server/schedule_test.go +++ b/mock/server/schedule_test.go @@ -18,7 +18,7 @@ func TestSchedule_ActiveScheduleResp(t *testing.T) { t.Errorf("error unmarshaling schedule: %v", err) } - tSchedule := reflect.TypeFor[api.Schedule]() + tSchedule := reflect.TypeOf(testSchedule) for i := 0; i < tSchedule.NumField(); i++ { if reflect.ValueOf(testSchedule).Field(i).IsNil() { diff --git a/mock/server/secret_test.go b/mock/server/secret_test.go index 9db4d96c6..43e7098b1 100644 --- a/mock/server/secret_test.go +++ b/mock/server/secret_test.go @@ -18,7 +18,7 @@ func TestSecret_ActiveSecretResp(t *testing.T) { t.Errorf("error unmarshaling secret: %v", err) } - tSecret := reflect.TypeFor[api.Secret]() + tSecret := reflect.TypeOf(testSecret) for i := 0; i < tSecret.NumField(); i++ { if reflect.ValueOf(testSecret).Field(i).IsNil() { diff --git a/mock/server/service_test.go b/mock/server/service_test.go index f8b84295c..70e1da0af 100644 --- a/mock/server/service_test.go +++ b/mock/server/service_test.go @@ -18,7 +18,7 @@ func TestService_ActiveServiceResp(t *testing.T) { t.Errorf("error unmarshaling service: %v", err) } - tService := reflect.TypeFor[api.Service]() + tService := reflect.TypeOf(testService) for i := 0; i < tService.NumField(); i++ { if reflect.ValueOf(testService).Field(i).IsNil() { diff --git a/mock/server/settings_test.go b/mock/server/settings_test.go index 00daecdc9..d827cc756 100644 --- a/mock/server/settings_test.go +++ b/mock/server/settings_test.go @@ -18,7 +18,7 @@ func TestSettings_GetResp(t *testing.T) { t.Errorf("error unmarshaling settings: %v", err) } - tSettings := reflect.TypeFor[settings.Platform]() + tSettings := reflect.TypeOf(testSettings) for i := 0; i < tSettings.NumField(); i++ { f := reflect.ValueOf(testSettings).Field(i) @@ -36,7 +36,7 @@ func TestSettings_UpdateResp(t *testing.T) { t.Errorf("error unmarshaling settings: %v", err) } - tSettings := reflect.TypeFor[settings.Platform]() + tSettings := reflect.TypeOf(testSettings) for i := 0; i < tSettings.NumField(); i++ { f := reflect.ValueOf(testSettings).Field(i) @@ -54,7 +54,7 @@ func TestSettings_RestoreResp(t *testing.T) { t.Errorf("error unmarshaling settings: %v", err) } - tSettings := reflect.TypeFor[settings.Platform]() + tSettings := reflect.TypeOf(testSettings) for i := 0; i < tSettings.NumField(); i++ { f := reflect.ValueOf(testSettings).Field(i) diff --git a/mock/server/step_test.go b/mock/server/step_test.go index 5129a70a3..6b1952949 100644 --- a/mock/server/step_test.go +++ b/mock/server/step_test.go @@ -18,7 +18,7 @@ func TestStep_ActiveStepResp(t *testing.T) { t.Errorf("error unmarshaling step: %v", err) } - tStep := reflect.TypeFor[api.Step]() + tStep := reflect.TypeOf(testStep) for i := 0; i < tStep.NumField(); i++ { if reflect.ValueOf(testStep).Field(i).IsNil() { diff --git a/mock/server/user_test.go b/mock/server/user_test.go index 60b71941b..edd4cfc10 100644 --- a/mock/server/user_test.go +++ b/mock/server/user_test.go @@ -18,7 +18,7 @@ func TestUser_ActiveUserResp(t *testing.T) { t.Errorf("error unmarshaling user: %v", err) } - tUser := reflect.TypeFor[api.User]() + tUser := reflect.TypeOf(testUser) for i := 0; i < tUser.NumField(); i++ { if tUser.Field(i).Name == "Token" || tUser.Field(i).Name == "RefreshToken" || tUser.Field(i).Name == "Hash" { diff --git a/mock/server/worker_test.go b/mock/server/worker_test.go index 34d6aa80e..a9a46b810 100644 --- a/mock/server/worker_test.go +++ b/mock/server/worker_test.go @@ -18,7 +18,7 @@ func TestWorker_ActiveWorkerResp(t *testing.T) { t.Errorf("error unmarshaling worker: %v", err) } - tWorker := reflect.TypeFor[api.Worker]() + tWorker := reflect.TypeOf(testWorker) for i := 0; i < tWorker.NumField(); i++ { if reflect.ValueOf(testWorker).Field(i).IsNil() { @@ -36,7 +36,7 @@ func TestWorker_ListActiveWorkerResp(t *testing.T) { } for index, worker := range testWorkers { - tWorker := reflect.TypeFor[api.Worker]() + tWorker := reflect.TypeOf(worker) for i := 0; i < tWorker.NumField(); i++ { if reflect.ValueOf(worker).Field(i).IsNil() { diff --git a/queue/context_test.go b/queue/context_test.go index 8cfb568c3..a6f7ab4ee 100644 --- a/queue/context_test.go +++ b/queue/context_test.go @@ -52,7 +52,7 @@ func TestExecutor_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value any + value interface{} want Service }{ { diff --git a/queue/redis/redis.go b/queue/redis/redis.go index 1df7df826..4245a7aa5 100644 --- a/queue/redis/redis.go +++ b/queue/redis/redis.go @@ -129,7 +129,7 @@ func failoverFromOptions(source *redis.Options) *redis.FailoverOptions { // the first host from the csv list is set as // the master node all subsequent hosts get // added as sentinel nodes - for host := range strings.SplitSeq(hosts, ",") { + for _, host := range strings.Split(hosts, ",") { if len(target.MasterName) == 0 { target.MasterName = host continue diff --git a/router/middleware/build/context.go b/router/middleware/build/context.go index 38c568c08..6870f5364 100644 --- a/router/middleware/build/context.go +++ b/router/middleware/build/context.go @@ -12,7 +12,7 @@ const key = "build" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the Build associated with this context. diff --git a/router/middleware/claims/context.go b/router/middleware/claims/context.go index 1cd642bcd..da800172e 100644 --- a/router/middleware/claims/context.go +++ b/router/middleware/claims/context.go @@ -12,7 +12,7 @@ const key = "claims" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the Claims associated with this context. diff --git a/router/middleware/cli/context.go b/router/middleware/cli/context.go index f641e3c2e..f5b098a71 100644 --- a/router/middleware/cli/context.go +++ b/router/middleware/cli/context.go @@ -12,7 +12,7 @@ const key = "cli" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the cli command associated with this context. diff --git a/router/middleware/dashboard/context.go b/router/middleware/dashboard/context.go index d2634f69f..f0f973015 100644 --- a/router/middleware/dashboard/context.go +++ b/router/middleware/dashboard/context.go @@ -12,7 +12,7 @@ const key = "dashboard" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the Dashboard associated with this context. diff --git a/router/middleware/hook/context.go b/router/middleware/hook/context.go index b9fb7fbf5..640969321 100644 --- a/router/middleware/hook/context.go +++ b/router/middleware/hook/context.go @@ -12,7 +12,7 @@ const key = "hook" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the hook associated with this context. diff --git a/router/middleware/logger.go b/router/middleware/logger.go index 01e6eacff..d549b87b4 100644 --- a/router/middleware/logger.go +++ b/router/middleware/logger.go @@ -176,8 +176,8 @@ func Logger(logger *logrus.Logger, _ string) gin.HandlerFunc { } } -func sanitize(body any) any { - if m, ok := body.(map[string]any); ok { +func sanitize(body interface{}) interface{} { + if m, ok := body.(map[string]interface{}); ok { if _, ok = m["email"]; ok { m["email"] = constants.SecretMask body = m diff --git a/router/middleware/logger_test.go b/router/middleware/logger_test.go index 19fe4a657..6eab78282 100644 --- a/router/middleware/logger_test.go +++ b/router/middleware/logger_test.go @@ -160,7 +160,7 @@ func TestMiddleware_Logger_Error(t *testing.T) { } func TestMiddleware_Logger_Sanitize(t *testing.T) { - var logBody, logWant map[string]any + var logBody, logWant map[string]interface{} r := new(api.Repo) r.SetID(1) diff --git a/router/middleware/org/context.go b/router/middleware/org/context.go index 1c141276a..03f913237 100644 --- a/router/middleware/org/context.go +++ b/router/middleware/org/context.go @@ -10,7 +10,7 @@ const key = "org" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the Org associated with this context. diff --git a/router/middleware/payload.go b/router/middleware/payload.go index 6de265dca..c362002e7 100644 --- a/router/middleware/payload.go +++ b/router/middleware/payload.go @@ -15,7 +15,7 @@ import ( func Payload() gin.HandlerFunc { return func(c *gin.Context) { // bind JSON payload from request to be added to context - var payload any + var payload interface{} _ = c.BindJSON(&payload) diff --git a/router/middleware/payload_test.go b/router/middleware/payload_test.go index b545682a0..0ad676fb4 100644 --- a/router/middleware/payload_test.go +++ b/router/middleware/payload_test.go @@ -15,7 +15,7 @@ import ( func TestMiddleware_Payload(t *testing.T) { // setup types - var got any + var got interface{} want := `{"foo": "bar"}` jsonBody, _ := json.Marshal(want) diff --git a/router/middleware/pipeline/context.go b/router/middleware/pipeline/context.go index 0a19f809d..8d4ad3563 100644 --- a/router/middleware/pipeline/context.go +++ b/router/middleware/pipeline/context.go @@ -12,7 +12,7 @@ const key = "pipeline" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the Pipeline associated with this context. diff --git a/router/middleware/repo/context.go b/router/middleware/repo/context.go index 14b1a1f37..73c0db4f1 100644 --- a/router/middleware/repo/context.go +++ b/router/middleware/repo/context.go @@ -12,7 +12,7 @@ const key = "repo" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the Repo associated with this context. diff --git a/router/middleware/schedule/context.go b/router/middleware/schedule/context.go index 411ab109b..5c8920d01 100644 --- a/router/middleware/schedule/context.go +++ b/router/middleware/schedule/context.go @@ -12,7 +12,7 @@ const key = "schedule" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the Schedule associated with this context. diff --git a/router/middleware/service/context.go b/router/middleware/service/context.go index 9617f1bec..4098cdea0 100644 --- a/router/middleware/service/context.go +++ b/router/middleware/service/context.go @@ -12,7 +12,7 @@ const key = "service" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the Service associated with this context. diff --git a/router/middleware/settings/context.go b/router/middleware/settings/context.go index cb04ca579..f5aa5fb62 100644 --- a/router/middleware/settings/context.go +++ b/router/middleware/settings/context.go @@ -12,7 +12,7 @@ const key = "settings" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the Settings associated with this context. diff --git a/router/middleware/step/context.go b/router/middleware/step/context.go index 9ef6da785..ae022c6b6 100644 --- a/router/middleware/step/context.go +++ b/router/middleware/step/context.go @@ -12,7 +12,7 @@ const key = "step" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the Step associated with this context. diff --git a/router/middleware/tracing/context.go b/router/middleware/tracing/context.go index 28b06d55d..ea457bbf1 100644 --- a/router/middleware/tracing/context.go +++ b/router/middleware/tracing/context.go @@ -12,7 +12,7 @@ const key = "tracing" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the associated value with this context. diff --git a/router/middleware/user/context.go b/router/middleware/user/context.go index 3e6a583c9..99a4fc3d7 100644 --- a/router/middleware/user/context.go +++ b/router/middleware/user/context.go @@ -12,7 +12,7 @@ const key = "user" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the User associated with this context. diff --git a/router/middleware/worker/context.go b/router/middleware/worker/context.go index 2fdce7f2d..2e9772a9e 100644 --- a/router/middleware/worker/context.go +++ b/router/middleware/worker/context.go @@ -12,7 +12,7 @@ const key = "worker" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the Worker associated with this context. diff --git a/scm/context.go b/scm/context.go index f2e1e9d4b..25f703db8 100644 --- a/scm/context.go +++ b/scm/context.go @@ -14,7 +14,7 @@ const key = "scm" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the scm Service diff --git a/scm/github/app_transport.go b/scm/github/app_transport.go index 107b1fd99..f332d260b 100644 --- a/scm/github/app_transport.go +++ b/scm/github/app_transport.go @@ -119,7 +119,7 @@ type Transport struct { type accessToken struct { Token string `json:"token"` ExpiresAt time.Time `json:"expires_at"` - Permissions github.InstallationPermissions `json:"permissions"` + Permissions github.InstallationPermissions `json:"permissions,omitempty"` Repositories []github.Repository `json:"repositories,omitempty"` } @@ -242,7 +242,7 @@ func (t *Transport) refreshToken(ctx context.Context) error { } // GetReadWriter converts a body interface into an io.ReadWriter object. -func GetReadWriter(i any) (io.ReadWriter, error) { +func GetReadWriter(i interface{}) (io.ReadWriter, error) { var buf io.ReadWriter if i != nil { diff --git a/scm/github/deployment.go b/scm/github/deployment.go index eeba521d1..ccffc87d9 100644 --- a/scm/github/deployment.go +++ b/scm/github/deployment.go @@ -166,7 +166,7 @@ func (c *Client) CreateDeployment(ctx context.Context, u *api.User, r *api.Repo, // create GitHub OAuth client with user's token client := c.newOAuthTokenClient(ctx, *u.Token) - var payload any + var payload interface{} if d.Payload == nil { payload = make(map[string]string) } else { diff --git a/scm/github/repo.go b/scm/github/repo.go index eacb166db..890eefb03 100644 --- a/scm/github/repo.go +++ b/scm/github/repo.go @@ -26,7 +26,7 @@ func (c *Client) ConfigBackoff(ctx context.Context, u *api.User, r *api.Repo, re // number of times to retry retryLimit := 5 - for i := range retryLimit { + for i := 0; i < retryLimit; i++ { logrus.Debugf("fetching config file - Attempt %d", i+1) // attempt to fetch the config data, err = c.Config(ctx, u, r, ref) diff --git a/scm/github/status_test.go b/scm/github/status_test.go index 686cbcb8b..211ec1f0e 100644 --- a/scm/github/status_test.go +++ b/scm/github/status_test.go @@ -222,7 +222,7 @@ func TestGithub_Status_PendingApproval_CheckRun_Create(t *testing.T) { resp := httptest.NewRecorder() _, engine := gin.CreateTestContext(resp) - var payload map[string]any + var payload map[string]interface{} // setup mock server engine.POST("/api/v3/repos/:org/:repo/check-runs", func(c *gin.Context) { @@ -282,7 +282,7 @@ func TestGithub_Status_Running_CheckRun_Update(t *testing.T) { resp := httptest.NewRecorder() _, engine := gin.CreateTestContext(resp) - var payload map[string]any + var payload map[string]interface{} // setup mock server engine.PATCH("/api/v3/repos/:org/:repo/check-runs/:id", func(c *gin.Context) { @@ -353,7 +353,7 @@ func TestGithub_StepStatus_Success_CheckRun_Update(t *testing.T) { resp := httptest.NewRecorder() _, engine := gin.CreateTestContext(resp) - var payload map[string]any + var payload map[string]interface{} // setup mock server engine.PATCH("/api/v3/repos/:org/:repo/check-runs/:id", func(c *gin.Context) { diff --git a/scm/github/webhook.go b/scm/github/webhook.go index 7d74a2445..630edad70 100644 --- a/scm/github/webhook.go +++ b/scm/github/webhook.go @@ -205,8 +205,8 @@ func (c *Client) processPushEvent(_ context.Context, h *api.Hook, payload *githu b.SetEvent(constants.EventTag) // set the proper branch from the base ref - if after, ok := strings.CutPrefix(payload.GetBaseRef(), "refs/heads/"); ok { - b.SetBranch(after) + if strings.HasPrefix(payload.GetBaseRef(), "refs/heads/") { + b.SetBranch(strings.TrimPrefix(payload.GetBaseRef(), "refs/heads/")) } } @@ -224,8 +224,8 @@ func (c *Client) processPushEvent(_ context.Context, h *api.Hook, payload *githu // set the proper event for the build b.SetEvent(constants.EventDelete) - if after, ok := strings.CutPrefix(payload.GetRef(), "refs/tags/"); ok { - b.SetBranch(after) + if strings.HasPrefix(payload.GetRef(), "refs/tags/") { + b.SetBranch(strings.TrimPrefix(payload.GetRef(), "refs/tags/")) // set the proper action for the build b.SetEventAction(constants.ActionTag) // set the proper message for the build diff --git a/secret/context.go b/secret/context.go index 193a69daf..b1b6eb458 100644 --- a/secret/context.go +++ b/secret/context.go @@ -8,7 +8,7 @@ import ( // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext returns the secret Service diff --git a/secret/vault/count.go b/secret/vault/count.go index 98ea384b3..e0764ad0c 100644 --- a/secret/vault/count.go +++ b/secret/vault/count.go @@ -54,7 +54,7 @@ func (c *Client) Count(_ context.Context, sType, org, name string, _ []string) ( } // cast the list of secrets to the expected type - keys, ok := vault.Data["keys"].([]any) + keys, ok := vault.Data["keys"].([]interface{}) if !ok { return 0, fmt.Errorf("not a valid list of secrets from Vault") } diff --git a/secret/vault/create.go b/secret/vault/create.go index 9469aba9e..f5f520e45 100644 --- a/secret/vault/create.go +++ b/secret/vault/create.go @@ -61,27 +61,27 @@ func (c *Client) Create(_ context.Context, sType, org, name string, s *api.Secre // createOrg is a helper function to create // the org secret for the provided path. -func (c *Client) createOrg(org, path string, data map[string]any) (*api.Secret, error) { +func (c *Client) createOrg(org, path string, data map[string]interface{}) (*api.Secret, error) { return c.create(fmt.Sprintf("%s/org/%s/%s", c.config.Prefix, org, path), data) } // createRepo is a helper function to create // the repo secret for the provided path. -func (c *Client) createRepo(org, repo, path string, data map[string]any) (*api.Secret, error) { +func (c *Client) createRepo(org, repo, path string, data map[string]interface{}) (*api.Secret, error) { return c.create(fmt.Sprintf("%s/repo/%s/%s/%s", c.config.Prefix, org, repo, path), data) } // createShared is a helper function to create // the shared secret for the provided path. -func (c *Client) createShared(org, team, path string, data map[string]any) (*api.Secret, error) { +func (c *Client) createShared(org, team, path string, data map[string]interface{}) (*api.Secret, error) { return c.create(fmt.Sprintf("%s/shared/%s/%s/%s", c.config.Prefix, org, team, path), data) } // create is a helper function to create // the secret for the provided path. -func (c *Client) create(path string, data map[string]any) (*api.Secret, error) { +func (c *Client) create(path string, data map[string]interface{}) (*api.Secret, error) { if strings.HasPrefix("secret/data", c.config.Prefix) { - data = map[string]any{ + data = map[string]interface{}{ "data": data, } } diff --git a/secret/vault/list.go b/secret/vault/list.go index e414087db..6011ac7c0 100644 --- a/secret/vault/list.go +++ b/secret/vault/list.go @@ -62,7 +62,7 @@ func (c *Client) List(ctx context.Context, sType, org, name string, _, _ int, _ } // cast the list of secrets to the expected type - keys, ok := vault.Data["keys"].([]any) + keys, ok := vault.Data["keys"].([]interface{}) if !ok { return nil, fmt.Errorf("not a valid list of secrets from Vault") } @@ -109,9 +109,9 @@ func (c *Client) listShared(org, team string) (*api.Secret, error) { // list of secrets for the provided path. func (c *Client) list(path string) (*api.Secret, error) { // handle k/v v2 - if after, ok := strings.CutPrefix(path, "secret/data/"); ok { + if strings.HasPrefix(path, "secret/data/") { // remove secret/data/ prefix - path = after + path = strings.TrimPrefix(path, "secret/data/") // add secret/metadata/ prefix path = fmt.Sprintf("secret/metadata/%s", path) } diff --git a/secret/vault/refresh.go b/secret/vault/refresh.go index fdfe64ce5..47678dff2 100644 --- a/secret/vault/refresh.go +++ b/secret/vault/refresh.go @@ -74,7 +74,7 @@ func (c *Client) getAwsToken(ctx context.Context) (string, time.Duration, error) // generateAwsAuthHeader will generate the necessary data // to send to the Vault server for generating a token. -func (c *Client) generateAwsAuthHeader(ctx context.Context) (map[string]any, error) { +func (c *Client) generateAwsAuthHeader(ctx context.Context) (map[string]interface{}, error) { c.Logger.Trace("generating AWS auth headers for vault") if c.AWS.Presigner == nil { @@ -91,7 +91,7 @@ func (c *Client) generateAwsAuthHeader(ctx context.Context) (map[string]any, err return nil, err } - loginData := map[string]any{ + loginData := map[string]interface{}{ "role": c.AWS.Role, "iam_http_request_method": presignedReq.Method, "iam_request_url": base64.StdEncoding.EncodeToString([]byte(presignedReq.URL)), diff --git a/secret/vault/update.go b/secret/vault/update.go index 13b4d0ae5..bdbe83551 100644 --- a/secret/vault/update.go +++ b/secret/vault/update.go @@ -92,27 +92,27 @@ func (c *Client) Update(ctx context.Context, sType, org, name string, s *api.Sec // updateOrg is a helper function to update // the org secret for the provided path. -func (c *Client) updateOrg(org, path string, data map[string]any) (*api.Secret, error) { +func (c *Client) updateOrg(org, path string, data map[string]interface{}) (*api.Secret, error) { return c.update(fmt.Sprintf("%s/%s/%s/%s", c.config.Prefix, constants.SecretOrg, org, path), data) } // updateRepo is a helper function to update // the repo secret for the provided path. -func (c *Client) updateRepo(org, repo, path string, data map[string]any) (*api.Secret, error) { +func (c *Client) updateRepo(org, repo, path string, data map[string]interface{}) (*api.Secret, error) { return c.update(fmt.Sprintf("%s/%s/%s/%s/%s", c.config.Prefix, constants.SecretRepo, org, repo, path), data) } // updateShared is a helper function to update // the shared secret for the provided path. -func (c *Client) updateShared(org, team, path string, data map[string]any) (*api.Secret, error) { +func (c *Client) updateShared(org, team, path string, data map[string]interface{}) (*api.Secret, error) { return c.update(fmt.Sprintf("%s/%s/%s/%s/%s", c.config.Prefix, constants.SecretShared, org, team, path), data) } // update is a helper function to update // the secret for the provided path. -func (c *Client) update(path string, data map[string]any) (*api.Secret, error) { +func (c *Client) update(path string, data map[string]interface{}) (*api.Secret, error) { if strings.HasPrefix("secret/data", c.config.Prefix) { - data = map[string]any{ + data = map[string]interface{}{ "data": data, } } diff --git a/secret/vault/vault.go b/secret/vault/vault.go index a9e20b08d..770e4f000 100644 --- a/secret/vault/vault.go +++ b/secret/vault/vault.go @@ -148,10 +148,10 @@ func NewWithContext(ctx context.Context, opts ...ClientOpt) (*Client, error) { func secretFromVault(vault *api.Secret) *velaAPI.Secret { s := new(velaAPI.Secret) - var data map[string]any + var data map[string]interface{} // handle k/v v2 if _, ok := vault.Data["data"]; ok { - data = vault.Data["data"].(map[string]any) + data = vault.Data["data"].(map[string]interface{}) } else { data = vault.Data } @@ -173,7 +173,7 @@ func secretFromVault(vault *api.Secret) *velaAPI.Secret { if ok { allowEventsMask := int64(0) - for _, element := range events.([]any) { + for _, element := range events.([]interface{}) { event, ok := element.(string) if ok { switch event { @@ -200,7 +200,7 @@ func secretFromVault(vault *api.Secret) *velaAPI.Secret { // set images if found in Vault secret v, ok = data["images"] if ok { - images, ok := v.([]any) + images, ok := v.([]interface{}) if ok { for _, element := range images { image, ok := element.(string) @@ -353,7 +353,7 @@ func secretFromVault(vault *api.Secret) *velaAPI.Secret { // vaultFromSecret is a helper function to convert a Vela secret to a HashiCorp Vault secret. func vaultFromSecret(s *velaAPI.Secret) *api.Secret { - data := make(map[string]any) + data := make(map[string]interface{}) vault := new(api.Secret) vault.Data = data diff --git a/secret/vault/vault_test.go b/secret/vault/vault_test.go index 15d2949f5..54718b4cf 100644 --- a/secret/vault/vault_test.go +++ b/secret/vault/vault_test.go @@ -101,17 +101,17 @@ func TestVault_secretFromVault(t *testing.T) { } inputV2 := &api.Secret{ - Data: map[string]any{ + Data: map[string]interface{}{ "data": testVaultSecretData(), }, } // test vault secret from pre-v0.23 release inputLegacy := &api.Secret{ - Data: map[string]any{ - "data": map[string]any{ - "events": []any{"push", "tag", "deployment"}, - "images": []any{"foo", "bar"}, + Data: map[string]interface{}{ + "data": map[string]interface{}{ + "events": []interface{}{"push", "tag", "deployment"}, + "images": []interface{}{"foo", "bar"}, "name": "bar", "org": "foo", "repo": "*", @@ -189,7 +189,7 @@ func TestVault_vaultFromSecret(t *testing.T) { s.SetUpdatedBy("octocat2") want := &api.Secret{ - Data: map[string]any{ + Data: map[string]interface{}{ "allow_events": int64(1), "images": []string{"foo", "bar"}, "name": "bar", @@ -217,7 +217,9 @@ func TestVault_vaultFromSecret(t *testing.T) { } func TestVault_AccurateSecretFields(t *testing.T) { - tSecret := reflect.TypeFor[velaAPI.Secret]() + testSecret := velaAPI.Secret{} + + tSecret := reflect.TypeOf(testSecret) vaultSecret := testVaultSecretData() @@ -241,10 +243,10 @@ func TestVault_AccurateSecretFields(t *testing.T) { } // helper function to return a test Vault secret data. -func testVaultSecretData() map[string]any { - return map[string]any{ +func testVaultSecretData() map[string]interface{} { + return map[string]interface{}{ "allow_events": json.Number("8195"), - "images": []any{"foo", "bar"}, + "images": []interface{}{"foo", "bar"}, "name": "bar", "org": "foo", "repo": "*", diff --git a/storage/context.go b/storage/context.go index b63c3a9e8..4f215b192 100644 --- a/storage/context.go +++ b/storage/context.go @@ -13,7 +13,7 @@ const key = "minio" // Setter defines a context that enables setting values. type Setter interface { - Set(any, any) + Set(string, interface{}) } // FromContext retrieves minio service from the context. diff --git a/storage/context_test.go b/storage/context_test.go index 071eeae8c..025f35274 100644 --- a/storage/context_test.go +++ b/storage/context_test.go @@ -52,7 +52,7 @@ func TestExecutor_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value any + value interface{} want Storage }{ { diff --git a/version/version.go b/version/version.go index 890ad8cab..efc7a68ae 100644 --- a/version/version.go +++ b/version/version.go @@ -43,7 +43,7 @@ type Version struct { // PreRelease represents unstable changes that might not be compatible. PreRelease string `json:"pre_release,omitempty"` // Metadata represents extra information surrounding the application version. - Metadata Metadata `json:"metadata"` + Metadata Metadata `json:"metadata,omitempty"` } // Meta implements a formatted string containing only metadata for the Version type. From bfaad34c78cf6f2423bd45965add76e5d380093e Mon Sep 17 00:00:00 2001 From: ecrupper Date: Tue, 24 Feb 2026 16:23:59 -0600 Subject: [PATCH 4/5] adjust json schema to look for required --- api/build/compile_publish.go | 2 +- api/build/list_repo.go | 2 +- api/build/update.go | 4 +- api/pipeline/output.go | 2 +- api/repo/list.go | 2 +- api/repo/list_org.go | 2 +- api/schedule/create.go | 2 +- api/scm/sync_org.go | 4 +- api/service/list.go | 2 +- api/step/list.go | 2 +- api/types/secret.go | 2 +- api/types/storage.go | 6 +-- api/types/storage_sts.go | 2 +- api/types/string.go | 8 ++-- api/types/string_test.go | 8 ++-- cache/context_test.go | 2 +- cache/redis/redis.go | 2 +- compiler/context_test.go | 2 +- compiler/engine.go | 8 ++-- compiler/native/compile.go | 11 +++-- compiler/native/compile_test.go | 8 ++-- compiler/native/environment.go | 41 +++++-------------- compiler/native/environment_test.go | 4 +- compiler/native/expand.go | 4 +- compiler/native/expand_test.go | 24 +++++------ compiler/native/parse.go | 4 +- compiler/native/parse_test.go | 16 ++++---- compiler/native/substitute_test.go | 4 +- compiler/native/validate_test.go | 2 +- compiler/template/native/convert.go | 6 +-- compiler/template/native/render.go | 8 ++-- compiler/template/native/render_test.go | 2 +- compiler/template/starlark/convert.go | 6 +-- compiler/template/starlark/convert_test.go | 8 ++-- compiler/template/starlark/render.go | 4 +- compiler/template/starlark/render_test.go | 2 +- compiler/template/starlark/starlark.go | 6 +-- compiler/template/starlark/starlark_test.go | 2 +- compiler/types/pipeline/build.go | 6 +-- compiler/types/pipeline/container.go | 11 +++-- compiler/types/pipeline/ruleset.go | 4 +- compiler/types/pipeline/stage.go | 7 ++-- compiler/types/raw/map.go | 17 ++++---- compiler/types/raw/map_test.go | 2 +- compiler/types/raw/slice.go | 2 +- compiler/types/yaml/build.go | 10 ++--- compiler/types/yaml/build_test.go | 10 ++--- compiler/types/yaml/deployment.go | 2 +- compiler/types/yaml/git.go | 2 +- compiler/types/yaml/metadata.go | 10 ++--- compiler/types/yaml/ruleset.go | 8 ++-- compiler/types/yaml/secret.go | 29 +++++++------ compiler/types/yaml/secret_test.go | 14 +++---- compiler/types/yaml/service.go | 11 +++-- compiler/types/yaml/stage.go | 16 ++++---- compiler/types/yaml/step.go | 45 ++++++++++----------- compiler/types/yaml/step_test.go | 8 ++-- compiler/types/yaml/template.go | 16 ++++---- compiler/types/yaml/ulimit.go | 2 +- compiler/types/yaml/volume.go | 2 +- database/build/clean.go | 2 +- database/build/count_deployment.go | 2 +- database/build/count_deployment_test.go | 2 +- database/build/count_org.go | 2 +- database/build/count_org_test.go | 10 ++--- database/build/count_repo.go | 2 +- database/build/count_repo_test.go | 2 +- database/build/count_status.go | 2 +- database/build/count_status_test.go | 2 +- database/build/interface.go | 10 ++--- database/build/list_repo.go | 2 +- database/build/list_repo_test.go | 2 +- database/context.go | 2 +- database/integration_test.go | 32 +++++++-------- database/logger.go | 6 +-- database/ping.go | 2 +- database/repo/count_org.go | 2 +- database/repo/count_org_test.go | 2 +- database/repo/count_user.go | 2 +- database/repo/count_user_test.go | 2 +- database/repo/interface.go | 8 ++-- database/repo/list_org.go | 2 +- database/repo/list_org_test.go | 2 +- database/repo/list_user.go | 2 +- database/repo/list_user_test.go | 2 +- database/secret/count_org.go | 2 +- database/secret/count_org_test.go | 2 +- database/secret/count_repo.go | 2 +- database/secret/count_repo_test.go | 2 +- database/secret/count_team.go | 4 +- database/secret/count_team_test.go | 4 +- database/secret/interface.go | 16 ++++---- database/secret/list_org.go | 2 +- database/secret/list_org_test.go | 2 +- database/secret/list_repo.go | 2 +- database/secret/list_repo_test.go | 2 +- database/secret/list_team.go | 4 +- database/secret/list_team_test.go | 4 +- database/service/count_build.go | 2 +- database/service/count_build_test.go | 2 +- database/service/interface.go | 4 +- database/service/list_build.go | 2 +- database/service/list_build_test.go | 2 +- database/step/count_build.go | 2 +- database/step/count_build_test.go | 2 +- database/step/interface.go | 4 +- database/step/list_build.go | 2 +- database/step/list_build_test.go | 2 +- database/testutils/mock_args.go | 4 +- database/types/dashboard.go | 4 +- database/types/deployment_test.go | 2 +- database/types/settings.go | 6 +-- database/types/user_test.go | 2 +- database/types/worker_test.go | 2 +- go.sum | 1 - internal/token/parse.go | 2 +- internal/yaml_test.go | 2 +- mock/server/build.go | 7 ++-- mock/server/build_test.go | 2 +- mock/server/dashboard_test.go | 6 +-- mock/server/deployment_test.go | 2 +- mock/server/hook_test.go | 2 +- mock/server/log_test.go | 2 +- mock/server/pipeline.go | 2 +- mock/server/pipeline_test.go | 2 +- mock/server/repo_test.go | 2 +- mock/server/schedule_test.go | 2 +- mock/server/secret_test.go | 2 +- mock/server/service_test.go | 2 +- mock/server/settings_test.go | 6 +-- mock/server/step_test.go | 2 +- mock/server/user_test.go | 2 +- mock/server/worker_test.go | 4 +- queue/context_test.go | 2 +- queue/redis/redis.go | 2 +- router/middleware/build/context.go | 2 +- router/middleware/claims/context.go | 2 +- router/middleware/cli/context.go | 2 +- router/middleware/dashboard/context.go | 2 +- router/middleware/hook/context.go | 2 +- router/middleware/logger.go | 4 +- router/middleware/logger_test.go | 2 +- router/middleware/org/context.go | 2 +- router/middleware/payload.go | 2 +- router/middleware/payload_test.go | 2 +- router/middleware/pipeline/context.go | 2 +- router/middleware/repo/context.go | 2 +- router/middleware/schedule/context.go | 2 +- router/middleware/service/context.go | 2 +- router/middleware/settings/context.go | 2 +- router/middleware/step/context.go | 2 +- router/middleware/tracing/context.go | 2 +- router/middleware/user/context.go | 2 +- router/middleware/worker/context.go | 2 +- schema/pipeline.go | 3 +- scm/context.go | 2 +- scm/github/app_transport.go | 4 +- scm/github/deployment.go | 2 +- scm/github/repo.go | 2 +- scm/github/status_test.go | 6 +-- scm/github/webhook.go | 8 ++-- secret/context.go | 2 +- secret/vault/count.go | 2 +- secret/vault/create.go | 10 ++--- secret/vault/list.go | 6 +-- secret/vault/refresh.go | 4 +- secret/vault/update.go | 10 ++--- secret/vault/vault.go | 10 ++--- secret/vault/vault_test.go | 22 +++++----- storage/context.go | 2 +- storage/context_test.go | 2 +- version/version.go | 2 +- 172 files changed, 408 insertions(+), 445 deletions(-) diff --git a/api/build/compile_publish.go b/api/build/compile_publish.go index 33f2358a6..7a33a6c60 100644 --- a/api/build/compile_publish.go +++ b/api/build/compile_publish.go @@ -116,7 +116,7 @@ func CompileAndPublish( } // create SQL filters for querying pending and running builds for repo - filters := map[string]interface{}{ + filters := map[string]any{ "status": []string{constants.StatusPending, constants.StatusRunning}, } diff --git a/api/build/list_repo.go b/api/build/list_repo.go index 1d06fff45..7bc725601 100644 --- a/api/build/list_repo.go +++ b/api/build/list_repo.go @@ -127,7 +127,7 @@ import ( func ListBuildsForRepo(c *gin.Context) { // variables that will hold the build list, build list filters and total count var ( - filters = map[string]interface{}{} + filters = map[string]any{} b []*types.Build ) diff --git a/api/build/update.go b/api/build/update.go index aaaf81c2c..a87211cd1 100644 --- a/api/build/update.go +++ b/api/build/update.go @@ -230,7 +230,7 @@ func UpdateComponentStatuses(c *gin.Context, b *types.Build, status, scmToken st for page > 0 { // retrieve build steps (per page) from the database - stepsPart, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]interface{}{}, page, perPage) + stepsPart, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]any{}, page, perPage) if err != nil { return err } @@ -285,7 +285,7 @@ func UpdateComponentStatuses(c *gin.Context, b *types.Build, status, scmToken st for page > 0 { // retrieve build services (per page) from the database - servicesPart, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]interface{}{}, page, perPage) + servicesPart, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]any{}, page, perPage) if err != nil { return err } diff --git a/api/pipeline/output.go b/api/pipeline/output.go index 5a0f22440..e851c58e9 100644 --- a/api/pipeline/output.go +++ b/api/pipeline/output.go @@ -21,7 +21,7 @@ const ( // writeOutput is a helper function to return the provided value to the // request based off the output query parameter provided. If no output // query parameter is provided, then YAML is used by default. -func writeOutput(c *gin.Context, value interface{}) { +func writeOutput(c *gin.Context, value any) { output := util.QueryParameter(c, "output", outputYAML) // format response body based off output query parameter diff --git a/api/repo/list.go b/api/repo/list.go index cc99e7ba2..f72ccf89a 100644 --- a/api/repo/list.go +++ b/api/repo/list.go @@ -103,7 +103,7 @@ func ListRepos(c *gin.Context) { // capture the query parameters if present: // // * active - filters := map[string]interface{}{ + filters := map[string]any{ "active": util.QueryParameter(c, "active", "true"), } diff --git a/api/repo/list_org.go b/api/repo/list_org.go index b3ed1461c..0c4d07a9c 100644 --- a/api/repo/list_org.go +++ b/api/repo/list_org.go @@ -123,7 +123,7 @@ func ListReposForOrg(c *gin.Context) { sortBy := util.QueryParameter(c, "sort_by", "name") // prep filters - filters := make(map[string]interface{}) + filters := make(map[string]any) // capture the query parameters if present: // diff --git a/api/schedule/create.go b/api/schedule/create.go index 36741832b..1dc2bc75b 100644 --- a/api/schedule/create.go +++ b/api/schedule/create.go @@ -231,7 +231,7 @@ func validateEntry(minimum time.Duration, entry string) error { // start with now t := time.Now().UTC() - for i := 0; i < tickForward; i++ { + for range tickForward { // check the previous occurrence of the entry prevTime, err := gronx.PrevTickBefore(entry, t, true) if err != nil { diff --git a/api/scm/sync_org.go b/api/scm/sync_org.go index 6b92e517e..634361b28 100644 --- a/api/scm/sync_org.go +++ b/api/scm/sync_org.go @@ -93,7 +93,7 @@ func SyncReposForOrg(c *gin.Context) { } // send API call to capture the total number of repos for the org - t, err := database.FromContext(c).CountReposForOrg(ctx, o, map[string]interface{}{}) + t, err := database.FromContext(c).CountReposForOrg(ctx, o, map[string]any{}) if err != nil { retErr := fmt.Errorf("unable to get repo count for org %s: %w", o, err) @@ -106,7 +106,7 @@ func SyncReposForOrg(c *gin.Context) { page := 0 // capture all repos belonging to a certain org in database for orgRepos := int64(0); orgRepos < t; orgRepos += 100 { - r, err := database.FromContext(c).ListReposForOrg(ctx, o, "name", map[string]interface{}{}, page, 100) + r, err := database.FromContext(c).ListReposForOrg(ctx, o, "name", map[string]any{}, page, 100) if err != nil { retErr := fmt.Errorf("unable to get repo count for org %s: %w", o, err) diff --git a/api/service/list.go b/api/service/list.go index 373d16794..8a8423ca2 100644 --- a/api/service/list.go +++ b/api/service/list.go @@ -120,7 +120,7 @@ func ListServices(c *gin.Context) { perPage = max(1, min(100, perPage)) // send API call to capture the list of services for the build - s, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]interface{}{}, page, perPage) + s, err := database.FromContext(c).ListServicesForBuild(ctx, b, map[string]any{}, page, perPage) if err != nil { retErr := fmt.Errorf("unable to get services for build %s: %w", entry, err) diff --git a/api/step/list.go b/api/step/list.go index fb29dc7c2..4b4e0ffd1 100644 --- a/api/step/list.go +++ b/api/step/list.go @@ -120,7 +120,7 @@ func ListSteps(c *gin.Context) { perPage = max(1, min(100, perPage)) // send API call to capture the list of steps for the build - s, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]interface{}{}, page, perPage) + s, err := database.FromContext(c).ListStepsForBuild(ctx, b, map[string]any{}, page, perPage) if err != nil { retErr := fmt.Errorf("unable to list steps for build %s: %w", entry, err) diff --git a/api/types/secret.go b/api/types/secret.go index bcf4a6e90..49635a04a 100644 --- a/api/types/secret.go +++ b/api/types/secret.go @@ -34,7 +34,7 @@ type Secret struct { // UnmarshalYAML implements the Unmarshaler interface for the Secret type. // This allows custom fields in the Secret type to be read from a YAML file, like AllowEvents. -func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *Secret) UnmarshalYAML(unmarshal func(any) error) error { // create an alias to perform a normal unmarshal and avoid an infinite loop type jsonSecret Secret diff --git a/api/types/storage.go b/api/types/storage.go index 0c6913282..efd7b429c 100644 --- a/api/types/storage.go +++ b/api/types/storage.go @@ -11,13 +11,13 @@ import ( // swagger:model CreateBucket type Bucket struct { BucketName string `json:"bucket_name,omitempty"` - MakeBucketOptions minio.MakeBucketOptions `json:"make_bucket_options,omitempty"` - ListObjectsOptions minio.ListObjectsOptions `json:"list_objects_options,omitempty"` + MakeBucketOptions minio.MakeBucketOptions `json:"make_bucket_options"` + ListObjectsOptions minio.ListObjectsOptions `json:"list_objects_options"` Recursive bool `json:"recursive"` } type Object struct { ObjectName string `json:"object_name,omitempty"` - Bucket Bucket `json:"bucket,omitempty"` + Bucket Bucket `json:"bucket"` FilePath string `json:"file_path,omitempty"` } diff --git a/api/types/storage_sts.go b/api/types/storage_sts.go index 40e560751..4e0d243a2 100644 --- a/api/types/storage_sts.go +++ b/api/types/storage_sts.go @@ -18,5 +18,5 @@ type STSCreds struct { Prefix string `json:"prefix,omitempty"` Secure bool `json:"secure,omitempty"` - ExpiresAt time.Time `json:"expires_at,omitempty"` + ExpiresAt time.Time `json:"expires_at"` } diff --git a/api/types/string.go b/api/types/string.go index f86367ba6..25f573499 100644 --- a/api/types/string.go +++ b/api/types/string.go @@ -13,7 +13,7 @@ import ( // ToString is a helper function to convert // the provided interface value to a string. -func ToString(v interface{}) string { +func ToString(v any) string { switch v := v.(type) { case string: return v @@ -45,7 +45,7 @@ func ToString(v interface{}) string { return strconv.FormatUint(uint64(v), 10) case uint64: return strconv.FormatUint(v, 10) - case []interface{}: + case []any: return unmarshalSlice(v) default: return unmarshalMap(v) @@ -53,7 +53,7 @@ func ToString(v interface{}) string { } // helper function to unmarshal a parameter in map format. -func unmarshalMap(v interface{}) string { +func unmarshalMap(v any) string { yml, err := yaml.Marshal(v) if err != nil { return err.Error() @@ -68,7 +68,7 @@ func unmarshalMap(v interface{}) string { } // helper function to unmarshal a parameter in slice format. -func unmarshalSlice(v interface{}) string { +func unmarshalSlice(v any) string { out, err := yaml.Marshal(v) if err != nil { return err.Error() diff --git a/api/types/string_test.go b/api/types/string_test.go index e362f0766..d2cff807b 100644 --- a/api/types/string_test.go +++ b/api/types/string_test.go @@ -10,8 +10,8 @@ import ( func TestTypes_ToString(t *testing.T) { // setup tests tests := []struct { - parameter interface{} - want interface{} + parameter any + want any }{ {parameter: "string", want: "string"}, // string {parameter: true, want: "true"}, // bool @@ -33,11 +33,11 @@ func TestTypes_ToString(t *testing.T) { want: "{\"hello\":\"world\"}", }, { // slice - parameter: []interface{}{1, 2, 3}, + parameter: []any{1, 2, 3}, want: "1,2,3", }, { // slice complex - parameter: []interface{}{struct{ Foo string }{Foo: "bar"}}, + parameter: []any{struct{ Foo string }{Foo: "bar"}}, want: "[{\"foo\":\"bar\"}]", }, { // complex diff --git a/cache/context_test.go b/cache/context_test.go index c7e1b0f4d..af79948cb 100644 --- a/cache/context_test.go +++ b/cache/context_test.go @@ -52,7 +52,7 @@ func TestCache_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value interface{} + value any want Service }{ { diff --git a/cache/redis/redis.go b/cache/redis/redis.go index 96e61efa5..a3bf5fd10 100644 --- a/cache/redis/redis.go +++ b/cache/redis/redis.go @@ -125,7 +125,7 @@ func failoverFromOptions(source *redis.Options) *redis.FailoverOptions { // the first host from the csv list is set as // the master node all subsequent hosts get // added as sentinel nodes - for _, host := range strings.Split(hosts, ",") { + for host := range strings.SplitSeq(hosts, ",") { if len(target.MasterName) == 0 { target.MasterName = host continue diff --git a/compiler/context_test.go b/compiler/context_test.go index 5a31cc911..4ef2dcb55 100644 --- a/compiler/context_test.go +++ b/compiler/context_test.go @@ -52,7 +52,7 @@ func TestCompiler_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value interface{} + value any want Engine }{ { diff --git a/compiler/engine.go b/compiler/engine.go index ac02cd8fe..520e962e3 100644 --- a/compiler/engine.go +++ b/compiler/engine.go @@ -24,12 +24,12 @@ type Engine interface { // Compile defines a function that produces an executable // representation of a pipeline from an object. This calls // Parse internally to convert the object to a yaml configuration. - Compile(context.Context, interface{}) (*pipeline.Build, *api.Pipeline, error) + Compile(context.Context, any) (*pipeline.Build, *api.Pipeline, error) // CompileLite defines a function that produces an light executable // representation of a pipeline from an object. This calls // Parse internally to convert the object to a yaml configuration. - CompileLite(context.Context, interface{}, *pipeline.RuleData, bool) (*yaml.Build, *api.Pipeline, error) + CompileLite(context.Context, any, *pipeline.RuleData, bool) (*yaml.Build, *api.Pipeline, error) // Duplicate defines a function that // creates a clone of the Engine. @@ -37,11 +37,11 @@ type Engine interface { // Parse defines a function that converts // an object to a yaml configuration. - Parse(interface{}, string, *yaml.Template) (*yaml.Build, []byte, []string, error) + Parse(any, string, *yaml.Template) (*yaml.Build, []byte, []string, error) // ParseRaw defines a function that converts // an object to a string. - ParseRaw(interface{}) (string, error) + ParseRaw(any) (string, error) // ValidateYAML defines a function that verifies // the yaml configuration is accurate. diff --git a/compiler/native/compile.go b/compiler/native/compile.go index 9d2753487..db50486cf 100644 --- a/compiler/native/compile.go +++ b/compiler/native/compile.go @@ -8,6 +8,7 @@ import ( "encoding/json" "fmt" "io" + "maps" "net/http" "strings" "time" @@ -38,7 +39,7 @@ type ModifyResponse struct { } // Compile produces an executable pipeline from a yaml configuration. -func (c *Client) Compile(ctx context.Context, v interface{}) (*pipeline.Build, *api.Pipeline, error) { +func (c *Client) Compile(ctx context.Context, v any) (*pipeline.Build, *api.Pipeline, error) { p, data, warnings, err := c.Parse(v, c.repo.GetPipelineType(), new(yaml.Template)) if err != nil { return nil, nil, err @@ -120,7 +121,7 @@ func (c *Client) Compile(ctx context.Context, v interface{}) (*pipeline.Build, * } // CompileLite produces a partial of an executable pipeline from a yaml configuration. -func (c *Client) CompileLite(ctx context.Context, v interface{}, ruleData *pipeline.RuleData, substitute bool) (*yaml.Build, *api.Pipeline, error) { +func (c *Client) CompileLite(ctx context.Context, v any, ruleData *pipeline.RuleData, substitute bool) (*yaml.Build, *api.Pipeline, error) { p, data, warnings, err := c.Parse(v, c.repo.GetPipelineType(), new(yaml.Template)) if err != nil { return nil, nil, err @@ -256,7 +257,7 @@ func (c *Client) compileInline(ctx context.Context, p *yaml.Build, depth int) (* // initialize variable map if not parsed from config if len(template.Variables) == 0 { - template.Variables = make(map[string]interface{}) + template.Variables = make(map[string]any) } // inject template name into variables @@ -279,9 +280,7 @@ func (c *Client) compileInline(ctx context.Context, p *yaml.Build, depth int) (* switch { case len(parsed.Environment) > 0: - for key, value := range parsed.Environment { - newPipeline.Environment[key] = value - } + maps.Copy(newPipeline.Environment, parsed.Environment) fallthrough case len(parsed.Stages) > 0: diff --git a/compiler/native/compile_test.go b/compiler/native/compile_test.go index 6611dc87d..a22f82c3c 100644 --- a/compiler/native/compile_test.go +++ b/compiler/native/compile_test.go @@ -2288,8 +2288,8 @@ func Test_client_modifyConfig(t *testing.T) { Environment: nil, Name: "docker", Pull: "always", - Parameters: map[string]interface{}{ - "init_options": map[string]interface{}{ + Parameters: map[string]any{ + "init_options": map[string]any{ "get_plugins": "true", }, }, @@ -2321,8 +2321,8 @@ func Test_client_modifyConfig(t *testing.T) { Environment: nil, Name: "docker", Pull: "always", - Parameters: map[string]interface{}{ - "init_options": map[string]interface{}{ + Parameters: map[string]any{ + "init_options": map[string]any{ "get_plugins": "true", }, }, diff --git a/compiler/native/environment.go b/compiler/native/environment.go index 0a5c96958..4f8620749 100644 --- a/compiler/native/environment.go +++ b/compiler/native/environment.go @@ -4,6 +4,7 @@ package native import ( "fmt" + "maps" "os" "strconv" "strings" @@ -44,17 +45,13 @@ func (c *Client) EnvironmentStage(s *yaml.Stage, globalEnv raw.StringSliceMap) ( // inject the declared environment // variables to the build stage - for k, v := range s.Environment { - env[k] = v - } + maps.Copy(env, s.Environment) // inject the default environment // variables to the build stage // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - for k, v := range defaultEnv { - env[k] = v - } + maps.Copy(env, defaultEnv) // overwrite existing build stage environment s.Environment = env @@ -99,17 +96,13 @@ func (c *Client) EnvironmentStep(s *yaml.Step, stageEnv raw.StringSliceMap) (*ya // inject the declared environment // variables to the build step - for k, v := range s.Environment { - env[k] = v - } + maps.Copy(env, s.Environment) // inject the default environment // variables to the build step // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - for k, v := range defaultEnv { - env[k] = v - } + maps.Copy(env, defaultEnv) // check if the compiler is setup for a local pipeline if c.local && !s.Detach { @@ -161,17 +154,13 @@ func (c *Client) EnvironmentServices(s yaml.ServiceSlice, globalEnv raw.StringSl // inject the declared environment // variables to the build service - for k, v := range service.Environment { - env[k] = v - } + maps.Copy(env, service.Environment) // inject the default environment // variables to the build service // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - for k, v := range defaultEnv { - env[k] = v - } + maps.Copy(env, defaultEnv) // overwrite existing build service environment service.Environment = env @@ -202,17 +191,13 @@ func (c *Client) EnvironmentSecrets(s yaml.SecretSlice, globalEnv raw.StringSlic // inject the declared environment // variables to the build secret - for k, v := range secret.Origin.Environment { - env[k] = v - } + maps.Copy(env, secret.Origin.Environment) // inject the default environment // variables to the build secret // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - for k, v := range defaultEnv { - env[k] = v - } + maps.Copy(env, defaultEnv) // check if the compiler is setup for a local pipeline if c.local { @@ -261,9 +246,7 @@ func (c *Client) EnvironmentBuild() map[string]string { // variables to the build // we do this after injecting the declared environment // to ensure the default env overrides any conflicts - for k, v := range defaultEnv { - env[k] = v - } + maps.Copy(env, defaultEnv) // check if the compiler is setup for a local pipeline if c.local { @@ -281,9 +264,7 @@ func (c *Client) EnvironmentBuild() map[string]string { // helper function to merge two maps together. func appendMap(originalMap, otherMap map[string]string) map[string]string { - for key, value := range otherMap { - originalMap[key] = value - } + maps.Copy(originalMap, otherMap) return originalMap } diff --git a/compiler/native/environment_test.go b/compiler/native/environment_test.go index 833ad7532..873385896 100644 --- a/compiler/native/environment_test.go +++ b/compiler/native/environment_test.go @@ -395,7 +395,7 @@ func TestNative_EnvironmentSecrets(t *testing.T) { Image: "vault", Name: str, Pull: "always", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "foo": "bar", }, Environment: raw.StringSliceMap{ @@ -412,7 +412,7 @@ func TestNative_EnvironmentSecrets(t *testing.T) { Image: "vault", Name: str, Pull: "always", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "foo": "bar", }, Environment: raw.StringSliceMap{ diff --git a/compiler/native/expand.go b/compiler/native/expand.go index d6eb97b9e..6ac18960a 100644 --- a/compiler/native/expand.go +++ b/compiler/native/expand.go @@ -137,7 +137,7 @@ func (c *Client) ExpandSteps(ctx context.Context, s *yaml.Build, tmpls map[strin // initialize variable map if not parsed from config if len(step.Template.Variables) == 0 { - step.Template.Variables = make(map[string]interface{}) + step.Template.Variables = make(map[string]any) } // inject template name into variables @@ -259,7 +259,7 @@ func (c *Client) ExpandDeployment(ctx context.Context, b *yaml.Build, tmpls map[ // initialize variable map if not parsed from config if len(b.Deployment.Template.Variables) == 0 { - b.Deployment.Template.Variables = make(map[string]interface{}) + b.Deployment.Template.Variables = make(map[string]any) } tmplBuild, _, err := c.mergeDeployTemplate(bytes, tmpl, &b.Deployment) diff --git a/compiler/native/expand_test.go b/compiler/native/expand_test.go index 7552df75a..ee8c7784b 100644 --- a/compiler/native/expand_test.go +++ b/compiler/native/expand_test.go @@ -55,7 +55,7 @@ func TestNative_ExpandStages(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -255,7 +255,7 @@ func TestNative_ExpandSteps(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -515,7 +515,7 @@ func TestNative_ExpandDeployment(t *testing.T) { deployCfg := yaml.Deployment{ Template: yaml.StepTemplate{ Name: "deploy", - Variables: map[string]interface{}{ + Variables: map[string]any{ "regions": []string{"us-east-1", "us-west-1"}, }, }, @@ -611,7 +611,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -622,7 +622,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "maven", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -639,7 +639,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "npm", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -753,12 +753,12 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Target: "VAULT_TOKEN", }, }, - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.example.com", "auth_method": "token", "username": "octocat", - "items": []interface{}{ - map[string]interface{}{"path": "docker", "source": "secret/docker"}, + "items": []any{ + map[string]any{"path": "docker", "source": "secret/docker"}, }, }, }, @@ -847,7 +847,7 @@ func TestNative_ExpandStepsStarlark(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "go", - Variables: map[string]interface{}{}, + Variables: map[string]any{}, }, }, } @@ -1150,7 +1150,7 @@ func TestNative_ExpandStepsDuplicateCalls(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", @@ -1161,7 +1161,7 @@ func TestNative_ExpandStepsDuplicateCalls(t *testing.T) { Name: "sample-dup", Template: yaml.StepTemplate{ Name: "gradle", - Variables: map[string]interface{}{ + Variables: map[string]any{ "image": "openjdk:latest", "environment": "{ GRADLE_USER_HOME: .gradle, GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false }", "pull_policy": "pull: true", diff --git a/compiler/native/parse.go b/compiler/native/parse.go index f1993639f..229172f77 100644 --- a/compiler/native/parse.go +++ b/compiler/native/parse.go @@ -16,7 +16,7 @@ import ( ) // ParseRaw converts an object to a string. -func (c *Client) ParseRaw(v interface{}) (string, error) { +func (c *Client) ParseRaw(v any) (string, error) { switch v := v.(type) { case []byte: return string(v), nil @@ -40,7 +40,7 @@ func (c *Client) ParseRaw(v interface{}) (string, error) { } // Parse converts an object to a yaml configuration. -func (c *Client) Parse(v interface{}, pipelineType string, template *yaml.Template) (*yaml.Build, []byte, []string, error) { +func (c *Client) Parse(v any, pipelineType string, template *yaml.Template) (*yaml.Build, []byte, []string, error) { var ( p *yaml.Build warnings []string diff --git a/compiler/native/parse_test.go b/compiler/native/parse_test.go index 2dd82edd1..811d01623 100644 --- a/compiler/native/parse_test.go +++ b/compiler/native/parse_test.go @@ -187,10 +187,10 @@ func TestNative_Parse_Parameters(t *testing.T) { Steps: yaml.StepSlice{ &yaml.Step{ Image: "plugins/docker:18.09", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, Name: "docker", Pull: "always", @@ -297,10 +297,10 @@ func TestNative_Parse_StagesPipeline(t *testing.T) { Steps: yaml.StepSlice{ &yaml.Step{ Image: "plugins/docker:18.09", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, Name: "publish", Pull: "always", @@ -409,10 +409,10 @@ func TestNative_Parse_StepsPipeline(t *testing.T) { }, &yaml.Step{ Image: "plugins/docker:18.09", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, Name: "publish", Pull: "always", @@ -884,7 +884,7 @@ func Test_client_Parse(t *testing.T) { Name: "foo", Image: "alpine", Pull: "not_present", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "foo", }, }, @@ -968,7 +968,7 @@ func Test_client_ParseRaw(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var ( - content interface{} + content any err error ) diff --git a/compiler/native/substitute_test.go b/compiler/native/substitute_test.go index 735063feb..fb7cf540d 100644 --- a/compiler/native/substitute_test.go +++ b/compiler/native/substitute_test.go @@ -196,7 +196,7 @@ func Test_client_SubstituteSteps(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "go", - Variables: map[string]interface{}{ + Variables: map[string]any{ "build_author": "${BUILD_AUTHOR}", "unknown": "${DEPLOYMENT_PARAMETER_API_IMAGE}", }, @@ -212,7 +212,7 @@ func Test_client_SubstituteSteps(t *testing.T) { Name: "sample", Template: yaml.StepTemplate{ Name: "go", - Variables: map[string]interface{}{ + Variables: map[string]any{ "build_author": "testauthor", "unknown": "${DEPLOYMENT_PARAMETER_API_IMAGE}", }, diff --git a/compiler/native/validate_test.go b/compiler/native/validate_test.go index 29ed8747b..f782d2e2b 100644 --- a/compiler/native/validate_test.go +++ b/compiler/native/validate_test.go @@ -648,7 +648,7 @@ func TestNative_Validate_Steps_ExceedReportAs(t *testing.T) { reportSteps := pipeline.ContainerSlice{} - for i := 0; i < 12; i++ { + for i := range 12 { reportStep := &pipeline.Container{ Commands: raw.StringSlice{"echo hello"}, Image: "alpine", diff --git a/compiler/template/native/convert.go b/compiler/template/native/convert.go index 51382c9a7..a2d3916bb 100644 --- a/compiler/template/native/convert.go +++ b/compiler/template/native/convert.go @@ -30,9 +30,9 @@ func convertPlatformVars(slice raw.StringSliceMap, name string) raw.StringSliceM } // check if the key has a 'vela_*' prefix - if strings.HasPrefix(key, "vela_") { + if after, ok := strings.CutPrefix(key, "vela_"); ok { // add the key/value pair without the 'vela_` prefix - envs[strings.TrimPrefix(key, "vela_")] = value + envs[after] = value } } @@ -49,7 +49,7 @@ func convertPlatformVars(slice raw.StringSliceMap, name string) raw.StringSliceM // https://github.com/helm/helm/blob/a499b4b179307c267bdf3ec49b880e3dbd2a5591/pkg/engine/funcs.go#L83 // // This is designed to be called from a template. -func toYAML(v interface{}) string { +func toYAML(v any) string { data, err := yaml.Marshal(v) if err != nil { // Swallow errors inside of a template. diff --git a/compiler/template/native/render.go b/compiler/template/native/render.go index c9836f8f9..69cecfaa4 100644 --- a/compiler/template/native/render.go +++ b/compiler/template/native/render.go @@ -15,11 +15,11 @@ import ( ) // Render combines the template with the step in the yaml pipeline. -func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]interface{}) (*types.Build, []string, error) { +func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]any) (*types.Build, []string, error) { buffer := new(bytes.Buffer) velaFuncs := funcHandler{envs: convertPlatformVars(environment, name)} - templateFuncMap := map[string]interface{}{ + templateFuncMap := map[string]any{ "vela": velaFuncs.returnPlatformVar, "toYaml": toYAML, } @@ -69,11 +69,11 @@ func Render(tmpl string, name string, tName string, environment raw.StringSliceM } // RenderBuild renders the templated build. -func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]interface{}) (*types.Build, []string, error) { +func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]any) (*types.Build, []string, error) { buffer := new(bytes.Buffer) velaFuncs := funcHandler{envs: convertPlatformVars(envs, tmpl)} - templateFuncMap := map[string]interface{}{ + templateFuncMap := map[string]any{ "vela": velaFuncs.returnPlatformVar, "toYaml": toYAML, } diff --git a/compiler/template/native/render_test.go b/compiler/template/native/render_test.go index a7b93c8cf..4510950b1 100644 --- a/compiler/template/native/render_test.go +++ b/compiler/template/native/render_test.go @@ -133,7 +133,7 @@ func TestNative_RenderBuild(t *testing.T) { got, _, err := RenderBuild("build", string(sFile), map[string]string{ "VELA_REPO_FULL_NAME": "octocat/hello-world", "VELA_BUILD_BRANCH": "main", - }, map[string]interface{}{}) + }, map[string]any{}) if (err != nil) != tt.wantErr { t.Errorf("RenderBuild() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/compiler/template/starlark/convert.go b/compiler/template/starlark/convert.go index 8a519db4f..3f1671217 100644 --- a/compiler/template/starlark/convert.go +++ b/compiler/template/starlark/convert.go @@ -17,7 +17,7 @@ import ( // // Explanation of type "starlark.StringDict": // https://pkg.go.dev/go.starlark.net/starlark#StringDict -func convertTemplateVars(m map[string]interface{}) (*starlark.Dict, error) { +func convertTemplateVars(m map[string]any) (*starlark.Dict, error) { dict := starlark.NewDict(0) // loop through user vars converting provided types to starlark primitives @@ -90,9 +90,9 @@ func convertPlatformVars(slice raw.StringSliceMap, name string) (*starlark.Dict, // iterate through the list of possible prefixes to look for for _, prefix := range []string{"deployment_parameter_", "vela_"} { // check if the key has the prefix - if strings.HasPrefix(key, prefix) { + if after, ok := strings.CutPrefix(key, prefix); ok { // trim the prefix from the input key - key = strings.TrimPrefix(key, prefix) + key = after // check if the prefix is from 'vela_*' if strings.EqualFold(prefix, "vela_") { diff --git a/compiler/template/starlark/convert_test.go b/compiler/template/starlark/convert_test.go index 7175da779..b1024506f 100644 --- a/compiler/template/starlark/convert_test.go +++ b/compiler/template/starlark/convert_test.go @@ -48,22 +48,22 @@ func TestStarlark_Render_convertTemplateVars(t *testing.T) { tests := []struct { name string - args map[string]interface{} + args map[string]any want *starlark.Dict }{ { name: "test for a user passed string", - args: map[string]interface{}{"pull": "always"}, + args: map[string]any{"pull": "always"}, want: strWant, }, { name: "test for a user passed array", - args: map[string]interface{}{"tags": []string{"latest", "1.14", "1.15"}}, + args: map[string]any{"tags": []string{"latest", "1.14", "1.15"}}, want: arrayWant, }, { name: "test for a user passed map", - args: map[string]interface{}{"commands": map[string]string{"test": "go test ./..."}}, + args: map[string]any{"commands": map[string]string{"test": "go test ./..."}}, want: mapWant, }} diff --git a/compiler/template/starlark/render.go b/compiler/template/starlark/render.go index 1460b6de4..25ea2f2e5 100644 --- a/compiler/template/starlark/render.go +++ b/compiler/template/starlark/render.go @@ -31,7 +31,7 @@ var ( ) // Render combines the template with the step in the yaml pipeline. -func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]interface{}, limit int64) (*types.Build, []string, error) { +func Render(tmpl string, name string, tName string, environment raw.StringSliceMap, variables map[string]any, limit int64) (*types.Build, []string, error) { thread := &starlark.Thread{Name: name} if limit < 0 { @@ -145,7 +145,7 @@ func Render(tmpl string, name string, tName string, environment raw.StringSliceM // RenderBuild renders the templated build. // //nolint:lll // ignore function length due to input args -func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]interface{}, limit int64) (*types.Build, []string, error) { +func RenderBuild(tmpl string, b string, envs map[string]string, variables map[string]any, limit int64) (*types.Build, []string, error) { thread := &starlark.Thread{Name: "templated-base"} if limit < 0 { diff --git a/compiler/template/starlark/render_test.go b/compiler/template/starlark/render_test.go index 5c070510c..70b501112 100644 --- a/compiler/template/starlark/render_test.go +++ b/compiler/template/starlark/render_test.go @@ -220,7 +220,7 @@ func TestNative_RenderBuild(t *testing.T) { "VELA_REPO_FULL_NAME": "octocat/hello-world", "VELA_BUILD_BRANCH": "main", "VELA_REPO_ORG": "octocat", - }, map[string]interface{}{}, tt.execLimit) + }, map[string]any{}, tt.execLimit) if (err != nil) != tt.wantErr { t.Errorf("RenderBuild() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/compiler/template/starlark/starlark.go b/compiler/template/starlark/starlark.go index 02db098aa..7ffcd95f9 100644 --- a/compiler/template/starlark/starlark.go +++ b/compiler/template/starlark/starlark.go @@ -32,7 +32,7 @@ var ( // https://github.com/wonderix/shalm/blob/899b8f7787883d40619eefcc39bd12f42a09b5e7/pkg/shalm/convert.go#L14-L85 // //nolint:gocyclo // ignore complexity -func toStarlark(value interface{}) (starlark.Value, error) { +func toStarlark(value any) (starlark.Value, error) { logrus.Tracef("converting %v to starlark type", value) if value == nil { @@ -81,7 +81,7 @@ func toStarlark(value interface{}) (starlark.Value, error) { } return starlark.Tuple(a), nil - case reflect.Ptr: + case reflect.Pointer: val, err := toStarlark(v.Elem().Interface()) if err != nil { return nil, err @@ -126,7 +126,7 @@ func toStarlark(value interface{}) (starlark.Value, error) { return nil, err } - var m map[string]interface{} + var m map[string]any err = json.Unmarshal(data, &m) if err != nil { diff --git a/compiler/template/starlark/starlark_test.go b/compiler/template/starlark/starlark_test.go index d85900f33..017add4db 100644 --- a/compiler/template/starlark/starlark_test.go +++ b/compiler/template/starlark/starlark_test.go @@ -22,7 +22,7 @@ func TestStarlark_toStarlark(t *testing.T) { a = append(a, starlark.Value(starlark.String("bar"))) type args struct { - value interface{} + value any } tests := []struct { diff --git a/compiler/types/pipeline/build.go b/compiler/types/pipeline/build.go index ccfe1bcbb..f931d3cd2 100644 --- a/compiler/types/pipeline/build.go +++ b/compiler/types/pipeline/build.go @@ -19,10 +19,10 @@ type Build struct { Token string `json:"token,omitempty" yaml:"token,omitempty"` TokenExp int64 `json:"token_exp,omitempty" yaml:"token_exp,omitempty"` Version string `json:"version,omitempty" yaml:"version,omitempty"` - Metadata Metadata `json:"metadata,omitempty" yaml:"metadata,omitempty"` + Metadata Metadata `json:"metadata" yaml:"metadata,omitempty"` Environment raw.StringSliceMap `json:"environment,omitempty" yaml:"environment,omitempty"` - Worker Worker `json:"worker,omitempty" yaml:"worker,omitempty"` - Deployment Deployment `json:"deployment,omitempty" yaml:"deployment,omitempty"` + Worker Worker `json:"worker" yaml:"worker,omitempty"` + Deployment Deployment `json:"deployment" yaml:"deployment,omitempty"` Secrets SecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"` Services ContainerSlice `json:"services,omitempty" yaml:"services,omitempty"` Stages StageSlice `json:"stages,omitempty" yaml:"stages,omitempty"` diff --git a/compiler/types/pipeline/container.go b/compiler/types/pipeline/container.go index e83b17c95..f2f609fc6 100644 --- a/compiler/types/pipeline/container.go +++ b/compiler/types/pipeline/container.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "maps" "math/rand" "reflect" "strings" @@ -46,9 +47,9 @@ type ( Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"` Pull string `json:"pull,omitempty" yaml:"pull,omitempty"` - Ruleset Ruleset `json:"ruleset,omitempty" yaml:"ruleset,omitempty"` + Ruleset Ruleset `json:"ruleset" yaml:"ruleset,omitempty"` Secrets StepSecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"` - Artifacts Artifacts `json:"artifacts,omitempty" yaml:"artifacts,omitempty"` + Artifacts Artifacts `json:"artifacts" yaml:"artifacts,omitempty"` Ulimits UlimitSlice `json:"ulimits,omitempty" yaml:"ulimits,omitempty"` Volumes VolumeSlice `json:"volumes,omitempty" yaml:"volumes,omitempty"` User string `json:"user,omitempty" yaml:"user,omitempty"` @@ -200,10 +201,8 @@ func (c *Container) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the container environment variable - c.Environment[key] = value - } + // set or update the container environment variable + maps.Copy(c.Environment, environment) return nil } diff --git a/compiler/types/pipeline/ruleset.go b/compiler/types/pipeline/ruleset.go index e18072773..34a1b772f 100644 --- a/compiler/types/pipeline/ruleset.go +++ b/compiler/types/pipeline/ruleset.go @@ -20,8 +20,8 @@ type ( // // swagger:model PipelineRuleset Ruleset struct { - If Rules `json:"if,omitempty" yaml:"if,omitempty"` - Unless Rules `json:"unless,omitempty" yaml:"unless,omitempty"` + If Rules `json:"if" yaml:"if,omitempty"` + Unless Rules `json:"unless" yaml:"unless,omitempty"` Matcher string `json:"matcher,omitempty" yaml:"matcher,omitempty"` Operator string `json:"operator,omitempty" yaml:"operator,omitempty"` Continue bool `json:"continue,omitempty" yaml:"continue,omitempty"` diff --git a/compiler/types/pipeline/stage.go b/compiler/types/pipeline/stage.go index 27c10c232..a3df1338e 100644 --- a/compiler/types/pipeline/stage.go +++ b/compiler/types/pipeline/stage.go @@ -4,6 +4,7 @@ package pipeline import ( "fmt" + "maps" "github.com/go-vela/server/constants" ) @@ -156,10 +157,8 @@ func (s *Stage) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the stage environment variable - s.Environment[key] = value - } + // set or update the stage environment variable + maps.Copy(s.Environment, environment) return nil } diff --git a/compiler/types/raw/map.go b/compiler/types/raw/map.go index deb1c81d0..15ed2b795 100644 --- a/compiler/types/raw/map.go +++ b/compiler/types/raw/map.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "maps" "strings" "github.com/invopop/jsonschema" @@ -26,7 +27,7 @@ func (s StringSliceMap) Value() (driver.Value, error) { } // Scan decodes the JSON string into map[string]string. -func (s *StringSliceMap) Scan(value interface{}) error { +func (s *StringSliceMap) Scan(value any) error { b, ok := value.(string) if !ok { return errors.New("type assertion to string failed") @@ -77,10 +78,8 @@ func (s *StringSliceMap) UnmarshalJSON(b []byte) error { err = json.Unmarshal(b, &jsonMap) if err == nil { // iterate through each item in the json map - for k, v := range jsonMap { - // append each key/value pair to our target map - targetMap[k] = v - } + // append each key/value pair to our target map + maps.Copy(targetMap, jsonMap) // overwrite existing StringSliceMap *s = targetMap @@ -92,7 +91,7 @@ func (s *StringSliceMap) UnmarshalJSON(b []byte) error { } // UnmarshalYAML implements the Unmarshaler interface for the StringSliceMap type. -func (s *StringSliceMap) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *StringSliceMap) UnmarshalYAML(unmarshal func(any) error) error { // target map we want to return targetMap := map[string]string{} @@ -128,10 +127,8 @@ func (s *StringSliceMap) UnmarshalYAML(unmarshal func(interface{}) error) error err = unmarshal(&yamlMap) if err == nil { // iterate through each item in the yaml map - for k, v := range yamlMap { - // append each key/value pair to our target map - targetMap[k] = v - } + // append each key/value pair to our target map + maps.Copy(targetMap, yamlMap) // overwrite existing StringSliceMap *s = targetMap diff --git a/compiler/types/raw/map_test.go b/compiler/types/raw/map_test.go index e8b280161..435957885 100644 --- a/compiler/types/raw/map_test.go +++ b/compiler/types/raw/map_test.go @@ -175,7 +175,7 @@ func TestStringSliceMap_Value(t *testing.T) { func TestStringSliceMap_Scan(t *testing.T) { type args struct { - value interface{} + value any } tests := []struct { diff --git a/compiler/types/raw/slice.go b/compiler/types/raw/slice.go index fb6ac59b2..4d8f926d2 100644 --- a/compiler/types/raw/slice.go +++ b/compiler/types/raw/slice.go @@ -47,7 +47,7 @@ func (s *StringSlice) UnmarshalJSON(b []byte) error { } // UnmarshalYAML implements the Unmarshaler interface for the StringSlice type. -func (s *StringSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *StringSlice) UnmarshalYAML(unmarshal func(any) error) error { // yaml string we try unmarshalling to yamlString := "" diff --git a/compiler/types/yaml/build.go b/compiler/types/yaml/build.go index a4b7494f7..ee80045e0 100644 --- a/compiler/types/yaml/build.go +++ b/compiler/types/yaml/build.go @@ -10,16 +10,16 @@ import ( // Build is the yaml representation of a build for a pipeline. type Build struct { Version string `yaml:"version,omitempty" json:"version,omitempty" jsonschema:"required,minLength=1,description=Provide syntax version used to evaluate the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/version/"` - Metadata Metadata `yaml:"metadata,omitempty" json:"metadata,omitempty" jsonschema:"description=Pass extra information.\nReference: https://go-vela.github.io/docs/reference/yaml/metadata/"` + Metadata Metadata `yaml:"metadata,omitempty" json:"metadata" jsonschema:"description=Pass extra information.\nReference: https://go-vela.github.io/docs/reference/yaml/metadata/"` Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Provide global environment variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` - Worker Worker `yaml:"worker,omitempty" json:"worker,omitempty" jsonschema:"description=Limit the pipeline to certain types of workers.\nReference: https://go-vela.github.io/docs/reference/yaml/worker/"` + Worker Worker `yaml:"worker,omitempty" json:"worker" jsonschema:"description=Limit the pipeline to certain types of workers.\nReference: https://go-vela.github.io/docs/reference/yaml/worker/"` Secrets SecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Provide sensitive information.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/"` Services ServiceSlice `yaml:"services,omitempty" json:"services,omitempty" jsonschema:"description=Provide detached (headless) execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/services/"` Stages StageSlice `yaml:"stages,omitempty" json:"stages,omitempty" jsonschema:"oneof_required=stages,description=Provide parallel execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/stages/"` Steps StepSlice `yaml:"steps,omitempty" json:"steps,omitempty" jsonschema:"oneof_required=steps,description=Provide sequential execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/"` Templates TemplateSlice `yaml:"templates,omitempty" json:"templates,omitempty" jsonschema:"description=Provide the name of templates to expand.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/"` - Deployment Deployment `yaml:"deployment,omitempty" json:"deployment,omitempty" jsonschema:"description=Provide deployment configuration.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/"` - Git Git `yaml:"git,omitempty" json:"git,omitempty" jsonschema:"description=Provide the git access specifications.\nReference: https://go-vela.github.io/docs/reference/yaml/git/"` + Deployment Deployment `yaml:"deployment,omitempty" json:"deployment" jsonschema:"description=Provide deployment configuration.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/"` + Git Git `yaml:"git,omitempty" json:"git" jsonschema:"description=Provide the git access specifications.\nReference: https://go-vela.github.io/docs/reference/yaml/git/"` } // ToPipelineAPI converts the Build type to an API Pipeline type. @@ -86,7 +86,7 @@ func (b *Build) hasArtifacts() bool { } // UnmarshalYAML implements the Unmarshaler interface for the Build type. -func (b *Build) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (b *Build) UnmarshalYAML(unmarshal func(any) error) error { // build we try unmarshalling to build := new(struct { Version string diff --git a/compiler/types/yaml/build_test.go b/compiler/types/yaml/build_test.go index 84353473e..1ecd877ff 100644 --- a/compiler/types/yaml/build_test.go +++ b/compiler/types/yaml/build_test.go @@ -242,11 +242,11 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) { }, { Name: "docker_build", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "dry_run": true, "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, Image: "plugins/docker:18.09", Pull: "always", @@ -260,10 +260,10 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) { }, { Name: "docker_publish", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, Image: "plugins/docker:18.09", Pull: "always", @@ -332,7 +332,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) { { Origin: Origin{ Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.example.com", }, Pull: "always", diff --git a/compiler/types/yaml/deployment.go b/compiler/types/yaml/deployment.go index 6cd3db4e6..c68063017 100644 --- a/compiler/types/yaml/deployment.go +++ b/compiler/types/yaml/deployment.go @@ -13,7 +13,7 @@ type ( Deployment struct { Targets raw.StringSlice `yaml:"targets,omitempty" json:"targets,omitempty" jsonschema:"description=List of deployment targets for the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-targets-key"` Parameters ParameterMap `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=List of parameters for the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"` - Template StepTemplate `yaml:"template,omitempty" json:"template,omitempty" jsonschema:"description=Name of template to expand in the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-template-key"` + Template StepTemplate `yaml:"template,omitempty" json:"template" jsonschema:"description=Name of template to expand in the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-template-key"` } // ParameterMap is the yaml representation diff --git a/compiler/types/yaml/git.go b/compiler/types/yaml/git.go index fc740d86e..403c9da67 100644 --- a/compiler/types/yaml/git.go +++ b/compiler/types/yaml/git.go @@ -10,7 +10,7 @@ import ( // Git is the yaml representation of git configurations for a pipeline. type Git struct { - Token `yaml:"token,omitempty" json:"token,omitempty" jsonschema:"description=Provide the git token specifications, primarily used for cloning.\nReference: https://go-vela.github.io/docs/reference/yaml/git/#token"` + Token `yaml:"token,omitempty" json:"token" jsonschema:"description=Provide the git token specifications, primarily used for cloning.\nReference: https://go-vela.github.io/docs/reference/yaml/git/#token"` } // Token is the yaml representation of the git token. diff --git a/compiler/types/yaml/metadata.go b/compiler/types/yaml/metadata.go index 89d21c369..5d5912bcd 100644 --- a/compiler/types/yaml/metadata.go +++ b/compiler/types/yaml/metadata.go @@ -3,6 +3,8 @@ package yaml import ( + "slices" + "github.com/go-vela/server/compiler/types/pipeline" ) @@ -71,11 +73,5 @@ func (m *Metadata) ToPipeline() *pipeline.Metadata { // HasEnvironment checks if the container type // is contained within the environment list. func (m *Metadata) HasEnvironment(container string) bool { - for _, e := range m.Environment { - if e == container { - return true - } - } - - return false + return slices.Contains(m.Environment, container) } diff --git a/compiler/types/yaml/ruleset.go b/compiler/types/yaml/ruleset.go index 0b8ae8f00..75f269a01 100644 --- a/compiler/types/yaml/ruleset.go +++ b/compiler/types/yaml/ruleset.go @@ -14,8 +14,8 @@ type ( // Ruleset is the yaml representation of a // ruleset block for a step in a pipeline. Ruleset struct { - If Rules `yaml:"if,omitempty" json:"if,omitempty" jsonschema:"description=Limit execution to when all rules match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` - Unless Rules `yaml:"unless,omitempty" json:"unless,omitempty" jsonschema:"description=Limit execution to when all rules do not match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + If Rules `yaml:"if,omitempty" json:"if" jsonschema:"description=Limit execution to when all rules match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + Unless Rules `yaml:"unless,omitempty" json:"unless" jsonschema:"description=Limit execution to when all rules do not match.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` Matcher string `yaml:"matcher,omitempty" json:"matcher,omitempty" jsonschema:"enum=filepath,enum=regexp,default=filepath,description=Use the defined matching method.\nReference: coming soon"` Operator string `yaml:"operator,omitempty" json:"operator,omitempty" jsonschema:"enum=or,enum=and,default=and,description=Whether all rule conditions must be met or just any one of them.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` Continue bool `yaml:"continue,omitempty" json:"continue,omitempty" jsonschema:"default=false,description=Limits the execution of a step to continuing on any failure.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` @@ -54,7 +54,7 @@ func (r *Ruleset) ToPipeline() *pipeline.Ruleset { } // UnmarshalYAML implements the Unmarshaler interface for the Ruleset type. -func (r *Ruleset) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (r *Ruleset) UnmarshalYAML(unmarshal func(any) error) error { // simple struct we try unmarshalling to simple := new(Rules) @@ -163,7 +163,7 @@ func (r *Rules) ToPipeline() *pipeline.Rules { } // UnmarshalYAML implements the Unmarshaler interface for the Rules type. -func (r *Rules) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (r *Rules) UnmarshalYAML(unmarshal func(any) error) error { // rules struct we try unmarshalling to rules := new(struct { Branch raw.StringSlice diff --git a/compiler/types/yaml/secret.go b/compiler/types/yaml/secret.go index 37f408fb7..5cf803de7 100644 --- a/compiler/types/yaml/secret.go +++ b/compiler/types/yaml/secret.go @@ -5,6 +5,7 @@ package yaml import ( "errors" "fmt" + "maps" "strings" "github.com/invopop/jsonschema" @@ -26,21 +27,21 @@ type ( Key string `yaml:"key,omitempty" json:"key,omitempty" jsonschema:"minLength=1,description=Path to secret to fetch from storage backend.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-key-key"` Engine string `yaml:"engine,omitempty" json:"engine,omitempty" jsonschema:"enum=native,enum=vault,default=native,description=Name of storage backend to fetch secret from.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-engine-key"` Type string `yaml:"type,omitempty" json:"type,omitempty" jsonschema:"enum=repo,enum=org,enum=shared,default=repo,description=Type of secret to fetch from storage backend.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-type-key"` - Origin Origin `yaml:"origin,omitempty" json:"origin,omitempty" jsonschema:"description=Declaration to pull secrets from non-internal secret providers.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-origin-key"` + Origin Origin `yaml:"origin,omitempty" json:"origin" jsonschema:"description=Declaration to pull secrets from non-internal secret providers.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-origin-key"` Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=step_start,enum=build_start,default=build_start,description=When to pull in secrets from storage backend.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/#the-pull-key"` } // Origin is the yaml representation of a method // for looking up secrets with a secret plugin. Origin struct { - Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Variables to inject into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` - Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"required,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` - Parameters map[string]interface{} `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for the secret plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` - Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Secrets to inject that are necessary to retrieve the secrets.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` - Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` - Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset,omitempty" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` - IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` + Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Variables to inject into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` + Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"required,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` + Parameters map[string]any `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for the secret plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` + Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Secrets to inject that are necessary to retrieve the secrets.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` + Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` + Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the secret origin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` } ) @@ -67,7 +68,7 @@ func (s *SecretSlice) ToPipeline() *pipeline.SecretSlice { } // UnmarshalYAML implements the Unmarshaler interface for the SecretSlice type. -func (s *SecretSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *SecretSlice) UnmarshalYAML(unmarshal func(any) error) error { // secret slice we try unmarshalling to secretSlice := new([]*Secret) @@ -177,10 +178,8 @@ func (o *Origin) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the secret environment variable - o.Environment[key] = value - } + // set or update the secret environment variable + maps.Copy(o.Environment, environment) return nil } @@ -231,7 +230,7 @@ func (s *StepSecretSlice) ToPipeline() *pipeline.StepSecretSlice { } // UnmarshalYAML implements the Unmarshaler interface for the StepSecretSlice type. -func (s *StepSecretSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *StepSecretSlice) UnmarshalYAML(unmarshal func(any) error) error { // string slice we try unmarshalling to stringSlice := new(raw.StringSlice) diff --git a/compiler/types/yaml/secret_test.go b/compiler/types/yaml/secret_test.go index 34037fc7d..6e9f2b9b2 100644 --- a/compiler/types/yaml/secret_test.go +++ b/compiler/types/yaml/secret_test.go @@ -24,10 +24,10 @@ func TestYaml_Origin_MergeEnv(t *testing.T) { Name: "vault", Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.example.com", "auth_method": "token", - "items": []interface{}{ + "items": []any{ map[string]string{"source": "secret/docker", "path": "docker"}, }, }, @@ -57,10 +57,10 @@ func TestYaml_Origin_MergeEnv(t *testing.T) { Name: "vault", Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.example.com", "auth_method": "token", - "items": []interface{}{ + "items": []any{ map[string]string{"source": "secret/docker", "path": "docker"}, }, }, @@ -120,7 +120,7 @@ func TestYaml_SecretSlice_ToPipeline(t *testing.T) { Name: "vault", Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.company.com", }, Pull: "always", @@ -252,7 +252,7 @@ func TestYaml_SecretSlice_UnmarshalYAML(t *testing.T) { Origin: Origin{ Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.company.com", }, Pull: "always", @@ -284,7 +284,7 @@ func TestYaml_SecretSlice_UnmarshalYAML(t *testing.T) { Origin: Origin{ Environment: map[string]string{"FOO": "bar"}, Image: "target/vela-vault:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "addr": "vault.company.com", }, Pull: "always", diff --git a/compiler/types/yaml/service.go b/compiler/types/yaml/service.go index 6a2dc75b1..5c81ddbdc 100644 --- a/compiler/types/yaml/service.go +++ b/compiler/types/yaml/service.go @@ -4,6 +4,7 @@ package yaml import ( "fmt" + "maps" "strings" "github.com/go-vela/server/compiler/types/pipeline" @@ -27,7 +28,7 @@ type ( Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/services/#the-pul-key"` Ulimits UlimitSlice `yaml:"ulimits,omitempty" json:"ulimits,omitempty" jsonschema:"description=Set the user limits for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/services/#the-ulimits-key"` User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-key"` - Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset,omitempty" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` } ) @@ -58,7 +59,7 @@ func (s *ServiceSlice) ToPipeline() *pipeline.ContainerSlice { } // UnmarshalYAML implements the Unmarshaler interface for the ServiceSlice type. -func (s *ServiceSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *ServiceSlice) UnmarshalYAML(unmarshal func(any) error) error { // service slice we try unmarshalling to serviceSlice := new([]*Service) @@ -126,10 +127,8 @@ func (s *Service) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the service environment variable - s.Environment[key] = value - } + // set or update the service environment variable + maps.Copy(s.Environment, environment) return nil } diff --git a/compiler/types/yaml/stage.go b/compiler/types/yaml/stage.go index 2fd485d73..62a19c15a 100644 --- a/compiler/types/yaml/stage.go +++ b/compiler/types/yaml/stage.go @@ -4,6 +4,8 @@ package yaml import ( "fmt" + "maps" + "slices" "github.com/invopop/jsonschema" "go.yaml.in/yaml/v3" @@ -79,10 +81,8 @@ func (s *StageSlice) UnmarshalYAML(v *yaml.Node) error { if stage.Name != constants.CloneName && stage.Name != constants.InitName { // add clone if not present stage.Needs = func(needs []string) []string { - for _, s := range needs { - if s == constants.CloneName { - return needs - } + if slices.Contains(needs, constants.CloneName) { + return needs } return append(needs, constants.CloneName) @@ -96,7 +96,7 @@ func (s *StageSlice) UnmarshalYAML(v *yaml.Node) error { } // MarshalYAML implements the marshaler interface for the StageSlice type. -func (s StageSlice) MarshalYAML() (interface{}, error) { +func (s StageSlice) MarshalYAML() (any, error) { output := new(yaml.Node) output.Kind = yaml.MappingNode @@ -161,10 +161,8 @@ func (s *Stage) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the stage environment variable - s.Environment[key] = value - } + // set or update the stage environment variable + maps.Copy(s.Environment, environment) return nil } diff --git a/compiler/types/yaml/step.go b/compiler/types/yaml/step.go index d588222d7..fde7272a1 100644 --- a/compiler/types/yaml/step.go +++ b/compiler/types/yaml/step.go @@ -4,6 +4,7 @@ package yaml import ( "fmt" + "maps" "strings" "github.com/go-vela/server/compiler/types/pipeline" @@ -19,24 +20,24 @@ type ( // Step is the yaml representation of a step // from the steps block for a pipeline. Step struct { - Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset,omitempty" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` - Commands raw.StringSlice `yaml:"commands,omitempty" json:"commands,omitempty" jsonschema:"description=Execution instructions to run inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-commands-key"` - Entrypoint raw.StringSlice `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty" jsonschema:"description=Command to execute inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-entrypoint-key"` - Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Sensitive variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` - Template StepTemplate `yaml:"template,omitempty" json:"template,omitempty" jsonschema:"oneof_required=template,description=Name of template to expand in the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` - Artifacts Artifacts `yaml:"artifacts,omitempty" json:"artifacts,omitempty" jsonschema:"description=Artifacts configuration for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-artifacts-key"` - Ulimits UlimitSlice `yaml:"ulimits,omitempty" json:"ulimits,omitempty" jsonschema:"description=Set the user limits for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ulimits-key"` - Volumes VolumeSlice `yaml:"volumes,omitempty" json:"volumes,omitempty" jsonschema:"description=Mount volumes for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-volume-key"` - Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"oneof_required=image,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` - Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` - Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Provide environment variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` - Parameters map[string]interface{} `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for a plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` - Detach bool `yaml:"detach,omitempty" json:"detach,omitempty" jsonschema:"description=Run the container in a detached (headless) state.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-detach-key"` - Privileged bool `yaml:"privileged,omitempty" json:"privileged,omitempty" jsonschema:"description=Run the container with extra privileges.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-privileged-key"` - User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-key"` - ReportAs string `yaml:"report_as,omitempty" json:"report_as,omitempty" jsonschema:"description=Set the name of the step to report as.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-report_as-key"` - IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` + Ruleset Ruleset `yaml:"ruleset,omitempty" json:"ruleset" jsonschema:"description=Conditions to limit the execution of the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ruleset-key"` + Commands raw.StringSlice `yaml:"commands,omitempty" json:"commands,omitempty" jsonschema:"description=Execution instructions to run inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-commands-key"` + Entrypoint raw.StringSlice `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty" jsonschema:"description=Command to execute inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-entrypoint-key"` + Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Sensitive variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"` + Template StepTemplate `yaml:"template,omitempty" json:"template" jsonschema:"oneof_required=template,description=Name of template to expand in the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` + Artifacts Artifacts `yaml:"artifacts,omitempty" json:"artifacts" jsonschema:"description=Artifacts configuration for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-artifacts-key"` + Ulimits UlimitSlice `yaml:"ulimits,omitempty" json:"ulimits,omitempty" jsonschema:"description=Set the user limits for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ulimits-key"` + Volumes VolumeSlice `yaml:"volumes,omitempty" json:"volumes,omitempty" jsonschema:"description=Mount volumes for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-volume-key"` + Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"oneof_required=image,minLength=1,description=Docker image to use to create the ephemeral container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-image-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique name for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-name-key"` + Pull string `yaml:"pull,omitempty" json:"pull,omitempty" jsonschema:"enum=always,enum=not_present,enum=on_start,enum=never,default=not_present,description=Declaration to configure if and when the Docker image is pulled.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-pull-key"` + Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Provide environment variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"` + Parameters map[string]any `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=Extra configuration variables for a plugin.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-parameters-key"` + Detach bool `yaml:"detach,omitempty" json:"detach,omitempty" jsonschema:"description=Run the container in a detached (headless) state.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-detach-key"` + Privileged bool `yaml:"privileged,omitempty" json:"privileged,omitempty" jsonschema:"description=Run the container with extra privileges.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-privileged-key"` + User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-key"` + ReportAs string `yaml:"report_as,omitempty" json:"report_as,omitempty" jsonschema:"description=Set the name of the step to report as.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-report_as-key"` + IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"` } ) @@ -73,7 +74,7 @@ func (s *StepSlice) ToPipeline() *pipeline.ContainerSlice { } // UnmarshalYAML implements the Unmarshaler interface for the StepSlice type. -func (s *StepSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *StepSlice) UnmarshalYAML(unmarshal func(any) error) error { // step slice we try unmarshalling to stepSlice := new([]*Step) @@ -141,10 +142,8 @@ func (s *Step) MergeEnv(environment map[string]string) error { } // iterate through all environment variables provided - for key, value := range environment { - // set or update the step environment variable - s.Environment[key] = value - } + // set or update the step environment variable + maps.Copy(s.Environment, environment) return nil } diff --git a/compiler/types/yaml/step_test.go b/compiler/types/yaml/step_test.go index e4c1901a6..f018c116e 100644 --- a/compiler/types/yaml/step_test.go +++ b/compiler/types/yaml/step_test.go @@ -203,10 +203,10 @@ func TestYaml_StepSlice_UnmarshalYAML(t *testing.T) { Image: "plugins/docker:18.09", Pull: "always", ReportAs: "docker", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, }, { @@ -214,10 +214,10 @@ func TestYaml_StepSlice_UnmarshalYAML(t *testing.T) { Pull: "not_present", Template: StepTemplate{ Name: "docker_publish", - Variables: map[string]interface{}{ + Variables: map[string]any{ "registry": "index.docker.io", "repo": "github/octocat", - "tags": []interface{}{"latest", "dev"}, + "tags": []any{"latest", "dev"}, }, }, }, diff --git a/compiler/types/yaml/template.go b/compiler/types/yaml/template.go index 4055fc9dc..1a540b219 100644 --- a/compiler/types/yaml/template.go +++ b/compiler/types/yaml/template.go @@ -14,23 +14,23 @@ type ( // Template is the yaml representation of a template // from the templates block for a pipeline. Template struct { - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-name-key"` - Source string `yaml:"source,omitempty" json:"source,omitempty" jsonschema:"required,minLength=1,description=Path to template in remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-source-key"` - Format string `yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=starlark,enum=golang,enum=go,default=go,minLength=1,description=language used within the template file \nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-format-key"` - Type string `yaml:"type,omitempty" json:"type,omitempty" jsonschema:"minLength=1,enum=github,enum=file,example=github,description=Type of template provided from the remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-type-key"` - Variables map[string]interface{} `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-variables-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-name-key"` + Source string `yaml:"source,omitempty" json:"source,omitempty" jsonschema:"required,minLength=1,description=Path to template in remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-source-key"` + Format string `yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=starlark,enum=golang,enum=go,default=go,minLength=1,description=language used within the template file \nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-format-key"` + Type string `yaml:"type,omitempty" json:"type,omitempty" jsonschema:"minLength=1,enum=github,enum=file,example=github,description=Type of template provided from the remote system.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-type-key"` + Variables map[string]any `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/#the-variables-key"` } // StepTemplate is the yaml representation of the // template block for a step in a pipeline. StepTemplate struct { - Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` - Variables map[string]interface{} `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` + Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"required,minLength=1,description=Unique identifier for the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` + Variables map[string]any `yaml:"vars,omitempty" json:"vars,omitempty" jsonschema:"description=Variables injected into the template.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"` } ) // UnmarshalYAML implements the Unmarshaler interface for the TemplateSlice type. -func (t *TemplateSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (t *TemplateSlice) UnmarshalYAML(unmarshal func(any) error) error { // template slice we try unmarshalling to templateSlice := new([]*Template) diff --git a/compiler/types/yaml/ulimit.go b/compiler/types/yaml/ulimit.go index af0fa544b..1ed2bf0d1 100644 --- a/compiler/types/yaml/ulimit.go +++ b/compiler/types/yaml/ulimit.go @@ -47,7 +47,7 @@ func (u *UlimitSlice) ToPipeline() *pipeline.UlimitSlice { } // UnmarshalYAML implements the Unmarshaler interface for the UlimitSlice type. -func (u *UlimitSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (u *UlimitSlice) UnmarshalYAML(unmarshal func(any) error) error { // string slice we try unmarshalling to stringSlice := new(raw.StringSlice) diff --git a/compiler/types/yaml/volume.go b/compiler/types/yaml/volume.go index 58740f652..3d6172f32 100644 --- a/compiler/types/yaml/volume.go +++ b/compiler/types/yaml/volume.go @@ -46,7 +46,7 @@ func (v *VolumeSlice) ToPipeline() *pipeline.VolumeSlice { } // UnmarshalYAML implements the Unmarshaler interface for the VolumeSlice type. -func (v *VolumeSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (v *VolumeSlice) UnmarshalYAML(unmarshal func(any) error) error { // string slice we try unmarshalling to stringSlice := new(raw.StringSlice) diff --git a/database/build/clean.go b/database/build/clean.go index ca0970d0f..d7b48bb40 100644 --- a/database/build/clean.go +++ b/database/build/clean.go @@ -21,7 +21,7 @@ func (e *Engine) CleanBuilds(ctx context.Context, msg string, before int64) (int Table(constants.TableBuild). Where("created < ?", before). Where("status = 'running' OR status = 'pending'"). - Updates(map[string]interface{}{ + Updates(map[string]any{ "status": constants.StatusError, "error": msg, "finished": time.Now().UTC().Unix(), diff --git a/database/build/count_deployment.go b/database/build/count_deployment.go index e36b882f2..595cb2b7f 100644 --- a/database/build/count_deployment.go +++ b/database/build/count_deployment.go @@ -12,7 +12,7 @@ import ( ) // CountBuildsForDeployment gets the count of builds by deployment URL from the database. -func (e *Engine) CountBuildsForDeployment(ctx context.Context, d *api.Deployment, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountBuildsForDeployment(ctx context.Context, d *api.Deployment, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "deployment": d.GetURL(), }).Tracef("getting count of builds for deployment %s", d.GetURL()) diff --git a/database/build/count_deployment_test.go b/database/build/count_deployment_test.go index 6b424c716..750c397cd 100644 --- a/database/build/count_deployment_test.go +++ b/database/build/count_deployment_test.go @@ -97,7 +97,7 @@ func TestBuild_Engine_CountBuildsForDeployment(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/build/count_org.go b/database/build/count_org.go index 156eaae2a..128d5973b 100644 --- a/database/build/count_org.go +++ b/database/build/count_org.go @@ -11,7 +11,7 @@ import ( ) // CountBuildsForOrg gets the count of builds by org name from the database. -func (e *Engine) CountBuildsForOrg(ctx context.Context, org string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountBuildsForOrg(ctx context.Context, org string, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, }).Tracef("getting count of builds for org %s", org) diff --git a/database/build/count_org_test.go b/database/build/count_org_test.go index 4256da23b..a44e1e4bf 100644 --- a/database/build/count_org_test.go +++ b/database/build/count_org_test.go @@ -105,21 +105,21 @@ func TestBuild_Engine_CountBuildsForOrg(t *testing.T) { failure bool name string database *Engine - filters map[string]interface{} + filters map[string]any want int64 }{ { failure: false, name: "postgres without filters", database: _postgres, - filters: map[string]interface{}{}, + filters: map[string]any{}, want: 2, }, { failure: false, name: "postgres with event filter", database: _postgres, - filters: map[string]interface{}{ + filters: map[string]any{ "event": "push", }, want: 2, @@ -128,14 +128,14 @@ func TestBuild_Engine_CountBuildsForOrg(t *testing.T) { failure: false, name: "sqlite3 without filters", database: _sqlite, - filters: map[string]interface{}{}, + filters: map[string]any{}, want: 2, }, { failure: false, name: "sqlite3 with event filter", database: _sqlite, - filters: map[string]interface{}{ + filters: map[string]any{ "event": "push", }, want: 2, diff --git a/database/build/count_repo.go b/database/build/count_repo.go index cdcdb7d62..387a61c81 100644 --- a/database/build/count_repo.go +++ b/database/build/count_repo.go @@ -12,7 +12,7 @@ import ( ) // CountBuildsForRepo gets the count of builds by repo ID from the database. -func (e *Engine) CountBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}, before, after int64) (int64, error) { +func (e *Engine) CountBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]any, before, after int64) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/build/count_repo_test.go b/database/build/count_repo_test.go index 21553af73..272838d5c 100644 --- a/database/build/count_repo_test.go +++ b/database/build/count_repo_test.go @@ -88,7 +88,7 @@ func TestBuild_Engine_CountBuildsForRepo(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/build/count_status.go b/database/build/count_status.go index 0ecbae4d4..cbd708813 100644 --- a/database/build/count_status.go +++ b/database/build/count_status.go @@ -9,7 +9,7 @@ import ( ) // CountBuildsForStatus gets the count of builds by status from the database. -func (e *Engine) CountBuildsForStatus(ctx context.Context, status string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountBuildsForStatus(ctx context.Context, status string, filters map[string]any) (int64, error) { e.logger.Tracef("getting count of builds for status %s", status) // variable to store query results diff --git a/database/build/count_status_test.go b/database/build/count_status_test.go index 9323cac39..a7e666aed 100644 --- a/database/build/count_status_test.go +++ b/database/build/count_status_test.go @@ -87,7 +87,7 @@ func TestBuild_Engine_CountBuildsForStatus(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/build/interface.go b/database/build/interface.go index f2d22d92b..b376d1de9 100644 --- a/database/build/interface.go +++ b/database/build/interface.go @@ -31,13 +31,13 @@ type BuildInterface interface { // CountBuilds defines a function that gets the count of all builds. CountBuilds(context.Context) (int64, error) // CountBuildsForDeployment defines a function that gets the count of builds by deployment url. - CountBuildsForDeployment(context.Context, *api.Deployment, map[string]interface{}) (int64, error) + CountBuildsForDeployment(context.Context, *api.Deployment, map[string]any) (int64, error) // CountBuildsForOrg defines a function that gets the count of builds by org name. - CountBuildsForOrg(context.Context, string, map[string]interface{}) (int64, error) + CountBuildsForOrg(context.Context, string, map[string]any) (int64, error) // CountBuildsForRepo defines a function that gets the count of builds by repo ID. - CountBuildsForRepo(context.Context, *api.Repo, map[string]interface{}, int64, int64) (int64, error) + CountBuildsForRepo(context.Context, *api.Repo, map[string]any, int64, int64) (int64, error) // CountBuildsForStatus defines a function that gets the count of builds by status. - CountBuildsForStatus(context.Context, string, map[string]interface{}) (int64, error) + CountBuildsForStatus(context.Context, string, map[string]any) (int64, error) // CreateBuild defines a function that creates a new build. CreateBuild(context.Context, *api.Build) (*api.Build, error) // DeleteBuild defines a function that deletes an existing build. @@ -55,7 +55,7 @@ type BuildInterface interface { // ListBuildsForDashboardRepo defines a function that gets a list of builds based on dashboard filters. ListBuildsForDashboardRepo(context.Context, *api.Repo, []string, []string) ([]*api.Build, error) // ListBuildsForRepo defines a function that gets a list of builds by repo ID. - ListBuildsForRepo(context.Context, *api.Repo, map[string]interface{}, int64, int64, int, int) ([]*api.Build, error) + ListBuildsForRepo(context.Context, *api.Repo, map[string]any, int64, int64, int, int) ([]*api.Build, error) // ListPendingAndRunningBuilds defines a function that gets a list of pending and running builds. ListPendingAndRunningBuilds(context.Context, string) ([]*api.QueueBuild, error) // ListPendingAndRunningBuildsForRepo defines a function that gets a list of pending and running builds for a repo. diff --git a/database/build/list_repo.go b/database/build/list_repo.go index 95b0c6a94..71bc53895 100644 --- a/database/build/list_repo.go +++ b/database/build/list_repo.go @@ -15,7 +15,7 @@ import ( // ListBuildsForRepo gets a list of builds by repo ID from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}, before, after int64, page, perPage int) ([]*api.Build, error) { +func (e *Engine) ListBuildsForRepo(ctx context.Context, r *api.Repo, filters map[string]any, before, after int64, page, perPage int) ([]*api.Build, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/build/list_repo_test.go b/database/build/list_repo_test.go index 0909be480..380a3e7c7 100644 --- a/database/build/list_repo_test.go +++ b/database/build/list_repo_test.go @@ -92,7 +92,7 @@ func TestBuild_Engine_ListBuildsForRepo(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/context.go b/database/context.go index a09637e33..196acbe1d 100644 --- a/database/context.go +++ b/database/context.go @@ -15,7 +15,7 @@ const key = "database" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the database Interface associated with this context. diff --git a/database/integration_test.go b/database/integration_test.go index 5367517fd..ad549c431 100644 --- a/database/integration_test.go +++ b/database/integration_test.go @@ -176,7 +176,7 @@ func testBuilds(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for builds methods := make(map[string]bool) // capture the element type of the build interface - element := reflect.TypeOf(new(build.BuildInterface)).Elem() + element := reflect.TypeFor[build.BuildInterface]() // iterate through all methods found in the build interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for builds @@ -483,7 +483,7 @@ func testDashboards(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for schedules methods := make(map[string]bool) // capture the element type of the schedule interface - element := reflect.TypeOf(new(dashboard.DashboardInterface)).Elem() + element := reflect.TypeFor[dashboard.DashboardInterface]() // iterate through all methods found in the schedule interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for schedules @@ -575,7 +575,7 @@ func testExecutables(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for pipelines methods := make(map[string]bool) // capture the element type of the pipeline interface - element := reflect.TypeOf(new(executable.BuildExecutableInterface)).Elem() + element := reflect.TypeFor[executable.BuildExecutableInterface]() // iterate through all methods found in the pipeline interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for pipelines @@ -664,7 +664,7 @@ func testDeployments(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for deployments methods := make(map[string]bool) // capture the element type of the deployment interface - element := reflect.TypeOf(new(deployment.DeploymentInterface)).Elem() + element := reflect.TypeFor[deployment.DeploymentInterface]() // iterate through all methods found in the deployment interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for deployments @@ -844,7 +844,7 @@ func testHooks(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for hooks methods := make(map[string]bool) // capture the element type of the hook interface - element := reflect.TypeOf(new(hook.HookInterface)).Elem() + element := reflect.TypeFor[hook.HookInterface]() // iterate through all methods found in the hook interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for hooks @@ -1032,7 +1032,7 @@ func testJWKs(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for jwks methods := make(map[string]bool) // capture the element type of the jwk interface - element := reflect.TypeOf(new(dbJWK.JWKInterface)).Elem() + element := reflect.TypeFor[dbJWK.JWKInterface]() // iterate through all methods found in the jwk interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for jwks @@ -1131,7 +1131,7 @@ func testLogs(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for logs methods := make(map[string]bool) // capture the element type of the log interface - element := reflect.TypeOf(new(log.LogInterface)).Elem() + element := reflect.TypeFor[log.LogInterface]() // iterate through all methods found in the log interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for logs @@ -1288,7 +1288,7 @@ func testPipelines(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for pipelines methods := make(map[string]bool) // capture the element type of the pipeline interface - element := reflect.TypeOf(new(pipeline.PipelineInterface)).Elem() + element := reflect.TypeFor[pipeline.PipelineInterface]() // iterate through all methods found in the pipeline interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for pipelines @@ -1479,7 +1479,7 @@ func testRepos(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for repos methods := make(map[string]bool) // capture the element type of the repo interface - element := reflect.TypeOf(new(repo.RepoInterface)).Elem() + element := reflect.TypeFor[repo.RepoInterface]() // iterate through all methods found in the repo interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for repos @@ -1695,7 +1695,7 @@ func testSchedules(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for schedules methods := make(map[string]bool) // capture the element type of the schedule interface - element := reflect.TypeOf(new(schedule.ScheduleInterface)).Elem() + element := reflect.TypeFor[schedule.ScheduleInterface]() // iterate through all methods found in the schedule interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for schedules @@ -1878,7 +1878,7 @@ func testSecrets(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for secrets methods := make(map[string]bool) // capture the element type of the secret interface - element := reflect.TypeOf(new(secret.SecretInterface)).Elem() + element := reflect.TypeFor[secret.SecretInterface]() // iterate through all methods found in the secret interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for secrets @@ -2149,7 +2149,7 @@ func testServices(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for services methods := make(map[string]bool) // capture the element type of the service interface - element := reflect.TypeOf(new(service.ServiceInterface)).Elem() + element := reflect.TypeFor[service.ServiceInterface]() // iterate through all methods found in the service interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for services @@ -2323,7 +2323,7 @@ func testSteps(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for steps methods := make(map[string]bool) // capture the element type of the step interface - element := reflect.TypeOf(new(step.StepInterface)).Elem() + element := reflect.TypeFor[step.StepInterface]() // iterate through all methods found in the step interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for steps @@ -2499,7 +2499,7 @@ func testUsers(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for users methods := make(map[string]bool) // capture the element type of the user interface - element := reflect.TypeOf(new(user.UserInterface)).Elem() + element := reflect.TypeFor[user.UserInterface]() // iterate through all methods found in the user interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for users @@ -2634,7 +2634,7 @@ func testWorkers(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for workers methods := make(map[string]bool) // capture the element type of the worker interface - element := reflect.TypeOf(new(worker.WorkerInterface)).Elem() + element := reflect.TypeFor[worker.WorkerInterface]() // iterate through all methods found in the worker interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for workers @@ -2735,7 +2735,7 @@ func testSettings(t *testing.T, db Interface, resources *Resources) { // create a variable to track the number of methods called for settings methods := make(map[string]bool) // capture the element type of the settings interface - element := reflect.TypeOf(new(dbSettings.SettingsInterface)).Elem() + element := reflect.TypeFor[dbSettings.SettingsInterface]() // iterate through all methods found in the settings interface for i := 0; i < element.NumMethod(); i++ { // skip tracking the methods to create indexes and tables for settings diff --git a/database/logger.go b/database/logger.go index 819574704..1ff93c2cf 100644 --- a/database/logger.go +++ b/database/logger.go @@ -37,17 +37,17 @@ func (l *GormLogger) LogMode(logger.LogLevel) logger.Interface { } // Info implements the logger.Interface. -func (l *GormLogger) Info(ctx context.Context, msg string, args ...interface{}) { +func (l *GormLogger) Info(ctx context.Context, msg string, args ...any) { l.entry.WithContext(ctx).Info(msg, args) } // Warn implements the logger.Interface. -func (l *GormLogger) Warn(ctx context.Context, msg string, args ...interface{}) { +func (l *GormLogger) Warn(ctx context.Context, msg string, args ...any) { l.entry.WithContext(ctx).Warn(msg, args) } // Error implements the logger.Interface. -func (l *GormLogger) Error(ctx context.Context, msg string, args ...interface{}) { +func (l *GormLogger) Error(ctx context.Context, msg string, args ...any) { l.entry.WithContext(ctx).Error(msg, args) } diff --git a/database/ping.go b/database/ping.go index 51c502a80..9d294fca5 100644 --- a/database/ping.go +++ b/database/ping.go @@ -12,7 +12,7 @@ func (e *engine) Ping() error { e.logger.Tracef("sending ping request to the %s database", e.Driver()) // create a loop to attempt ping requests 5 times - for i := 0; i < 5; i++ { + for i := range 5 { // capture database/sql database from gorm.io/gorm database _sql, err := e.client.DB() if err != nil { diff --git a/database/repo/count_org.go b/database/repo/count_org.go index 8f4417625..8a6125e16 100644 --- a/database/repo/count_org.go +++ b/database/repo/count_org.go @@ -11,7 +11,7 @@ import ( ) // CountReposForOrg gets the count of repos by org name from the database. -func (e *Engine) CountReposForOrg(ctx context.Context, org string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountReposForOrg(ctx context.Context, org string, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, }).Tracef("getting count of repos for org %s", org) diff --git a/database/repo/count_org_test.go b/database/repo/count_org_test.go index 9444cf0a9..c3bf17c68 100644 --- a/database/repo/count_org_test.go +++ b/database/repo/count_org_test.go @@ -77,7 +77,7 @@ func TestRepo_Engine_CountReposForOrg(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/repo/count_user.go b/database/repo/count_user.go index 2cd366e65..63e622641 100644 --- a/database/repo/count_user.go +++ b/database/repo/count_user.go @@ -12,7 +12,7 @@ import ( ) // CountReposForUser gets the count of repos by user ID from the database. -func (e *Engine) CountReposForUser(ctx context.Context, u *api.User, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountReposForUser(ctx context.Context, u *api.User, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "user": u.GetName(), }).Tracef("getting count of repos for user %s", u.GetName()) diff --git a/database/repo/count_user_test.go b/database/repo/count_user_test.go index de04d0c5f..e897a88eb 100644 --- a/database/repo/count_user_test.go +++ b/database/repo/count_user_test.go @@ -81,7 +81,7 @@ func TestRepo_Engine_CountReposForUser(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/repo/interface.go b/database/repo/interface.go index 56641467d..113d5e5b2 100644 --- a/database/repo/interface.go +++ b/database/repo/interface.go @@ -29,9 +29,9 @@ type RepoInterface interface { // CountRepos defines a function that gets the count of all repos. CountRepos(context.Context) (int64, error) // CountReposForOrg defines a function that gets the count of repos by org name. - CountReposForOrg(context.Context, string, map[string]interface{}) (int64, error) + CountReposForOrg(context.Context, string, map[string]any) (int64, error) // CountReposForUser defines a function that gets the count of repos by user ID. - CountReposForUser(context.Context, *api.User, map[string]interface{}) (int64, error) + CountReposForUser(context.Context, *api.User, map[string]any) (int64, error) // CreateRepo defines a function that creates a new repo. CreateRepo(context.Context, *api.Repo) (*api.Repo, error) // DeleteRepo defines a function that deletes an existing repo. @@ -45,9 +45,9 @@ type RepoInterface interface { // ListRepos defines a function that gets a list of all repos. ListRepos(context.Context) ([]*api.Repo, error) // ListReposForOrg defines a function that gets a list of repos by org name. - ListReposForOrg(context.Context, string, string, map[string]interface{}, int, int) ([]*api.Repo, error) + ListReposForOrg(context.Context, string, string, map[string]any, int, int) ([]*api.Repo, error) // ListReposForUser defines a function that gets a list of repos by user ID. - ListReposForUser(context.Context, *api.User, string, map[string]interface{}, int, int) ([]*api.Repo, error) + ListReposForUser(context.Context, *api.User, string, map[string]any, int, int) ([]*api.Repo, error) // UpdateRepo defines a function that updates an existing repo. UpdateRepo(context.Context, *api.Repo) (*api.Repo, error) } diff --git a/database/repo/list_org.go b/database/repo/list_org.go index c0f02fa2c..66ddcaefb 100644 --- a/database/repo/list_org.go +++ b/database/repo/list_org.go @@ -15,7 +15,7 @@ import ( // ListReposForOrg gets a list of repos by org name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListReposForOrg(ctx context.Context, org, sortBy string, filters map[string]interface{}, page, perPage int) ([]*api.Repo, error) { +func (e *Engine) ListReposForOrg(ctx context.Context, org, sortBy string, filters map[string]any, page, perPage int) ([]*api.Repo, error) { e.logger.WithFields(logrus.Fields{ "org": org, }).Tracef("listing repos for org %s", org) diff --git a/database/repo/list_org_test.go b/database/repo/list_org_test.go index 8aff303de..fb671b84f 100644 --- a/database/repo/list_org_test.go +++ b/database/repo/list_org_test.go @@ -157,7 +157,7 @@ func TestRepo_Engine_ListReposForOrg(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/repo/list_user.go b/database/repo/list_user.go index 2e0f52dc9..0d29cf2a0 100644 --- a/database/repo/list_user.go +++ b/database/repo/list_user.go @@ -15,7 +15,7 @@ import ( // ListReposForUser gets a list of repos by user ID from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListReposForUser(ctx context.Context, u *api.User, sortBy string, filters map[string]interface{}, page, perPage int) ([]*api.Repo, error) { +func (e *Engine) ListReposForUser(ctx context.Context, u *api.User, sortBy string, filters map[string]any, page, perPage int) ([]*api.Repo, error) { e.logger.WithFields(logrus.Fields{ "user": u.GetName(), }).Tracef("listing repos for user %s", u.GetName()) diff --git a/database/repo/list_user_test.go b/database/repo/list_user_test.go index 7fea23252..d49eae238 100644 --- a/database/repo/list_user_test.go +++ b/database/repo/list_user_test.go @@ -156,7 +156,7 @@ func TestRepo_Engine_ListReposForUser(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/count_org.go b/database/secret/count_org.go index c84ef3135..75b39a66c 100644 --- a/database/secret/count_org.go +++ b/database/secret/count_org.go @@ -11,7 +11,7 @@ import ( ) // CountSecretsForOrg gets the count of secrets by org name from the database. -func (e *Engine) CountSecretsForOrg(ctx context.Context, org string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountSecretsForOrg(ctx context.Context, org string, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, "type": constants.SecretOrg, diff --git a/database/secret/count_org_test.go b/database/secret/count_org_test.go index 8208be9a0..cf01f3c2c 100644 --- a/database/secret/count_org_test.go +++ b/database/secret/count_org_test.go @@ -85,7 +85,7 @@ func TestSecret_Engine_CountSecretsForOrg(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/count_repo.go b/database/secret/count_repo.go index 84bad6058..1a66f5d59 100644 --- a/database/secret/count_repo.go +++ b/database/secret/count_repo.go @@ -12,7 +12,7 @@ import ( ) // CountSecretsForRepo gets the count of secrets by org and repo name from the database. -func (e *Engine) CountSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/secret/count_repo_test.go b/database/secret/count_repo_test.go index 632840b08..813d0e3e2 100644 --- a/database/secret/count_repo_test.go +++ b/database/secret/count_repo_test.go @@ -95,7 +95,7 @@ func TestSecret_Engine_CountSecretsForRepo(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/count_team.go b/database/secret/count_team.go index 789a85f14..b5437e41c 100644 --- a/database/secret/count_team.go +++ b/database/secret/count_team.go @@ -12,7 +12,7 @@ import ( ) // CountSecretsForTeam gets the count of secrets by org and team name from the database. -func (e *Engine) CountSecretsForTeam(ctx context.Context, org, team string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountSecretsForTeam(ctx context.Context, org, team string, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "org": org, "team": team, @@ -37,7 +37,7 @@ func (e *Engine) CountSecretsForTeam(ctx context.Context, org, team string, filt } // CountSecretsForTeams gets the count of secrets by teams within an org from the database. -func (e *Engine) CountSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]any) (int64, error) { // lower case team names for not case-sensitive values from the SCM i.e. GitHub // // iterate through the list of teams provided diff --git a/database/secret/count_team_test.go b/database/secret/count_team_test.go index 6aa0a6aae..57fca797a 100644 --- a/database/secret/count_team_test.go +++ b/database/secret/count_team_test.go @@ -85,7 +85,7 @@ func TestSecret_Engine_CountSecretsForTeam(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { @@ -193,7 +193,7 @@ func TestSecret_Engine_CountSecretsForTeams(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/interface.go b/database/secret/interface.go index fa37ddd47..46f6da43c 100644 --- a/database/secret/interface.go +++ b/database/secret/interface.go @@ -29,13 +29,13 @@ type SecretInterface interface { // CountSecrets defines a function that gets the count of all secrets. CountSecrets(context.Context) (int64, error) // CountSecretsForOrg defines a function that gets the count of secrets by org name. - CountSecretsForOrg(context.Context, string, map[string]interface{}) (int64, error) + CountSecretsForOrg(context.Context, string, map[string]any) (int64, error) // CountSecretsForRepo defines a function that gets the count of secrets by org and repo name. - CountSecretsForRepo(context.Context, *api.Repo, map[string]interface{}) (int64, error) + CountSecretsForRepo(context.Context, *api.Repo, map[string]any) (int64, error) // CountSecretsForTeam defines a function that gets the count of secrets by org and team name. - CountSecretsForTeam(context.Context, string, string, map[string]interface{}) (int64, error) + CountSecretsForTeam(context.Context, string, string, map[string]any) (int64, error) // CountSecretsForTeams defines a function that gets the count of secrets by teams within an org. - CountSecretsForTeams(context.Context, string, []string, map[string]interface{}) (int64, error) + CountSecretsForTeams(context.Context, string, []string, map[string]any) (int64, error) // CreateSecret defines a function that creates a new secret. CreateSecret(context.Context, *api.Secret) (*api.Secret, error) // DeleteSecret defines a function that deletes an existing secret. @@ -55,13 +55,13 @@ type SecretInterface interface { // ListSecrets defines a function that gets a list of all secrets. ListSecrets(context.Context) ([]*api.Secret, error) // ListSecretsForOrg defines a function that gets a list of secrets by org name. - ListSecretsForOrg(context.Context, string, map[string]interface{}, int, int) ([]*api.Secret, error) + ListSecretsForOrg(context.Context, string, map[string]any, int, int) ([]*api.Secret, error) // ListSecretsForRepo defines a function that gets a list of secrets by org and repo name. - ListSecretsForRepo(context.Context, *api.Repo, map[string]interface{}, int, int) ([]*api.Secret, error) + ListSecretsForRepo(context.Context, *api.Repo, map[string]any, int, int) ([]*api.Secret, error) // ListSecretsForTeam defines a function that gets a list of secrets by org and team name. - ListSecretsForTeam(context.Context, string, string, map[string]interface{}, int, int) ([]*api.Secret, error) + ListSecretsForTeam(context.Context, string, string, map[string]any, int, int) ([]*api.Secret, error) // ListSecretsForTeams defines a function that gets a list of secrets by teams within an org. - ListSecretsForTeams(context.Context, string, []string, map[string]interface{}, int, int) ([]*api.Secret, error) + ListSecretsForTeams(context.Context, string, []string, map[string]any, int, int) ([]*api.Secret, error) // MigrateSecrets defines a function that updates the org and name of all repo secrets when there is a name change. MigrateSecrets(context.Context, string, string, string, string) error // UpdateSecret defines a function that updates an existing secret. diff --git a/database/secret/list_org.go b/database/secret/list_org.go index b2fcf1c70..8bcf06e87 100644 --- a/database/secret/list_org.go +++ b/database/secret/list_org.go @@ -15,7 +15,7 @@ import ( // ListSecretsForOrg gets a list of secrets by org name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListSecretsForOrg(ctx context.Context, org string, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForOrg(ctx context.Context, org string, filters map[string]any, page, perPage int) ([]*api.Secret, error) { e.logger.WithFields(logrus.Fields{ "org": org, "type": constants.SecretOrg, diff --git a/database/secret/list_org_test.go b/database/secret/list_org_test.go index 2756b9bf2..87765d89b 100644 --- a/database/secret/list_org_test.go +++ b/database/secret/list_org_test.go @@ -93,7 +93,7 @@ func TestSecret_Engine_ListSecretsForOrg(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/list_repo.go b/database/secret/list_repo.go index b680968d1..ccf6df308 100644 --- a/database/secret/list_repo.go +++ b/database/secret/list_repo.go @@ -15,7 +15,7 @@ import ( // ListSecretsForRepo gets a list of secrets by org name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForRepo(ctx context.Context, r *api.Repo, filters map[string]any, page, perPage int) ([]*api.Secret, error) { e.logger.WithFields(logrus.Fields{ "org": r.GetOrg(), "repo": r.GetName(), diff --git a/database/secret/list_repo_test.go b/database/secret/list_repo_test.go index c411bbc57..5cefc83fa 100644 --- a/database/secret/list_repo_test.go +++ b/database/secret/list_repo_test.go @@ -103,7 +103,7 @@ func TestSecret_Engine_ListSecretsForRepo(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/secret/list_team.go b/database/secret/list_team.go index f714aa63f..dd28161b0 100644 --- a/database/secret/list_team.go +++ b/database/secret/list_team.go @@ -16,7 +16,7 @@ import ( // ListSecretsForTeam gets a list of secrets by org and team name from the database. // //nolint:lll // ignore long line length due to variable names -func (e *Engine) ListSecretsForTeam(ctx context.Context, org, team string, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForTeam(ctx context.Context, org, team string, filters map[string]any, page, perPage int) ([]*api.Secret, error) { e.logger.WithFields(logrus.Fields{ "org": org, "team": team, @@ -69,7 +69,7 @@ func (e *Engine) ListSecretsForTeam(ctx context.Context, org, team string, filte } // ListSecretsForTeams gets a list of secrets by teams within an org from the database. -func (e *Engine) ListSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]interface{}, page, perPage int) ([]*api.Secret, error) { +func (e *Engine) ListSecretsForTeams(ctx context.Context, org string, teams []string, filters map[string]any, page, perPage int) ([]*api.Secret, error) { // iterate through the list of teams provided for index, team := range teams { // ensure the team name is lower case diff --git a/database/secret/list_team_test.go b/database/secret/list_team_test.go index be1e82c24..8e371d8d3 100644 --- a/database/secret/list_team_test.go +++ b/database/secret/list_team_test.go @@ -95,7 +95,7 @@ func TestSecret_Engine_ListSecretsForTeam(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { @@ -210,7 +210,7 @@ func TestSecret_Engine_ListSecretsForTeams(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/service/count_build.go b/database/service/count_build.go index f985f4fc2..ff81bd932 100644 --- a/database/service/count_build.go +++ b/database/service/count_build.go @@ -12,7 +12,7 @@ import ( ) // CountServicesForBuild gets the count of services by build ID from the database. -func (e *Engine) CountServicesForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountServicesForBuild(ctx context.Context, b *api.Build, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("getting count of services for build %d", b.GetNumber()) diff --git a/database/service/count_build_test.go b/database/service/count_build_test.go index b46fe9e6b..e13e6bbae 100644 --- a/database/service/count_build_test.go +++ b/database/service/count_build_test.go @@ -80,7 +80,7 @@ func TestService_Engine_CountServicesForBuild(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/service/interface.go b/database/service/interface.go index dbb2aa6c9..8899637f0 100644 --- a/database/service/interface.go +++ b/database/service/interface.go @@ -29,7 +29,7 @@ type ServiceInterface interface { // CountServices defines a function that gets the count of all services. CountServices(context.Context) (int64, error) // CountServicesForBuild defines a function that gets the count of services by build ID. - CountServicesForBuild(context.Context, *api.Build, map[string]interface{}) (int64, error) + CountServicesForBuild(context.Context, *api.Build, map[string]any) (int64, error) // CreateService defines a function that creates a new service. CreateService(context.Context, *api.Service) (*api.Service, error) // DeleteService defines a function that deletes an existing service. @@ -41,7 +41,7 @@ type ServiceInterface interface { // ListServices defines a function that gets a list of all services. ListServices(context.Context) ([]*api.Service, error) // ListServicesForBuild defines a function that gets a list of services by build ID. - ListServicesForBuild(context.Context, *api.Build, map[string]interface{}, int, int) ([]*api.Service, error) + ListServicesForBuild(context.Context, *api.Build, map[string]any, int, int) ([]*api.Service, error) // ListServiceImageCount defines a function that gets a list of all service images and the count of their occurrence. ListServiceImageCount(context.Context) (map[string]float64, error) // ListServiceStatusCount defines a function that gets a list of all service statuses and the count of their occurrence. diff --git a/database/service/list_build.go b/database/service/list_build.go index f251de4a6..93d5c9d03 100644 --- a/database/service/list_build.go +++ b/database/service/list_build.go @@ -13,7 +13,7 @@ import ( ) // ListServicesForBuild gets a list of all services from the database. -func (e *Engine) ListServicesForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}, page int, perPage int) ([]*api.Service, error) { +func (e *Engine) ListServicesForBuild(ctx context.Context, b *api.Build, filters map[string]any, page int, perPage int) ([]*api.Service, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("listing services for build %d", b.GetNumber()) diff --git a/database/service/list_build_test.go b/database/service/list_build_test.go index af383c3f3..c024e8c53 100644 --- a/database/service/list_build_test.go +++ b/database/service/list_build_test.go @@ -80,7 +80,7 @@ func TestService_Engine_ListServicesForBuild(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/step/count_build.go b/database/step/count_build.go index a25af4008..a828db4b5 100644 --- a/database/step/count_build.go +++ b/database/step/count_build.go @@ -12,7 +12,7 @@ import ( ) // CountStepsForBuild gets the count of steps by build ID from the database. -func (e *Engine) CountStepsForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}) (int64, error) { +func (e *Engine) CountStepsForBuild(ctx context.Context, b *api.Build, filters map[string]any) (int64, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("getting count of steps for build %d", b.GetNumber()) diff --git a/database/step/count_build_test.go b/database/step/count_build_test.go index fead13b93..a88d964ec 100644 --- a/database/step/count_build_test.go +++ b/database/step/count_build_test.go @@ -82,7 +82,7 @@ func TestStep_Engine_CountStepsForBuild(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/step/interface.go b/database/step/interface.go index 83fcda729..9c192bf89 100644 --- a/database/step/interface.go +++ b/database/step/interface.go @@ -29,7 +29,7 @@ type StepInterface interface { // CountSteps defines a function that gets the count of all steps. CountSteps(context.Context) (int64, error) // CountStepsForBuild defines a function that gets the count of steps by build ID. - CountStepsForBuild(context.Context, *api.Build, map[string]interface{}) (int64, error) + CountStepsForBuild(context.Context, *api.Build, map[string]any) (int64, error) // CreateStep defines a function that creates a new step. CreateStep(context.Context, *api.Step) (*api.Step, error) // DeleteStep defines a function that deletes an existing step. @@ -41,7 +41,7 @@ type StepInterface interface { // ListSteps defines a function that gets a list of all steps. ListSteps(ctx context.Context) ([]*api.Step, error) // ListStepsForBuild defines a function that gets a list of steps by build ID. - ListStepsForBuild(context.Context, *api.Build, map[string]interface{}, int, int) ([]*api.Step, error) + ListStepsForBuild(context.Context, *api.Build, map[string]any, int, int) ([]*api.Step, error) // ListStepImageCount defines a function that gets a list of all step images and the count of their occurrence. ListStepImageCount(context.Context) (map[string]float64, error) // ListStepStatusCount defines a function that gets a list of all step statuses and the count of their occurrence. diff --git a/database/step/list_build.go b/database/step/list_build.go index e6fcd1862..7d323c6d9 100644 --- a/database/step/list_build.go +++ b/database/step/list_build.go @@ -13,7 +13,7 @@ import ( ) // ListStepsForBuild gets a list of all steps from the database. -func (e *Engine) ListStepsForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}, page int, perPage int) ([]*api.Step, error) { +func (e *Engine) ListStepsForBuild(ctx context.Context, b *api.Build, filters map[string]any, page int, perPage int) ([]*api.Step, error) { e.logger.WithFields(logrus.Fields{ "build": b.GetNumber(), }).Tracef("listing steps for build %d", b.GetNumber()) diff --git a/database/step/list_build_test.go b/database/step/list_build_test.go index e46f59705..50faa1616 100644 --- a/database/step/list_build_test.go +++ b/database/step/list_build_test.go @@ -83,7 +83,7 @@ func TestStep_Engine_ListStepsForBuild(t *testing.T) { }, } - filters := map[string]interface{}{} + filters := map[string]any{} // run tests for _, test := range tests { diff --git a/database/testutils/mock_args.go b/database/testutils/mock_args.go index 62d9f07fb..463e1fe33 100644 --- a/database/testutils/mock_args.go +++ b/database/testutils/mock_args.go @@ -39,12 +39,12 @@ func (t NowTimestamp) Match(v driver.Value) bool { } var JwkKeyOpts = cmp.Options{ - cmp.FilterValues(func(x, y interface{}) bool { + cmp.FilterValues(func(x, y any) bool { _, xOk := x.(jwk.RSAPublicKey) _, yOk := y.(jwk.RSAPublicKey) return xOk && yOk - }, cmp.Comparer(func(x, y interface{}) bool { + }, cmp.Comparer(func(x, y any) bool { xJWK := x.(jwk.RSAPublicKey) yJWK := y.(jwk.RSAPublicKey) diff --git a/database/types/dashboard.go b/database/types/dashboard.go index fc90e3818..6d82250c1 100644 --- a/database/types/dashboard.go +++ b/database/types/dashboard.go @@ -49,7 +49,7 @@ func (r DashReposJSON) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for DashReposJSON. -func (r *DashReposJSON) Scan(value interface{}) error { +func (r *DashReposJSON) Scan(value any) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &r) @@ -67,7 +67,7 @@ func (a AdminsJSON) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for AdminsJSON. -func (a *AdminsJSON) Scan(value interface{}) error { +func (a *AdminsJSON) Scan(value any) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &a) diff --git a/database/types/deployment_test.go b/database/types/deployment_test.go index 7f5db4d9f..a93ab9226 100644 --- a/database/types/deployment_test.go +++ b/database/types/deployment_test.go @@ -233,7 +233,7 @@ func generateBuilds(amount int) []string { // initialize empty builds builds := []string{} - for i := 0; i < amount; i++ { + for range amount { builds = append(builds, "123456789") } diff --git a/database/types/settings.go b/database/types/settings.go index c64d4c6a2..209b93735 100644 --- a/database/types/settings.go +++ b/database/types/settings.go @@ -69,7 +69,7 @@ func (r Compiler) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for Compiler. -func (r *Compiler) Scan(value interface{}) error { +func (r *Compiler) Scan(value any) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &r) @@ -87,7 +87,7 @@ func (r Queue) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for Queue. -func (r *Queue) Scan(value interface{}) error { +func (r *Queue) Scan(value any) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &r) @@ -105,7 +105,7 @@ func (s SCM) Value() (driver.Value, error) { } // Scan - Implement the database/sql scanner interface for Queue. -func (s *SCM) Scan(value interface{}) error { +func (s *SCM) Scan(value any) error { switch v := value.(type) { case []byte: return json.Unmarshal(v, &s) diff --git a/database/types/user_test.go b/database/types/user_test.go index 3d02427e8..d4d1430fb 100644 --- a/database/types/user_test.go +++ b/database/types/user_test.go @@ -280,7 +280,7 @@ func exceededField(indexes int) []string { values := []string{} // add enough strings to exceed the character limit - for i := 0; i < indexes; i++ { + for i := range indexes { // construct field // use i to adhere to unique favorites field := "github/octocat-" + strconv.Itoa(i) diff --git a/database/types/worker_test.go b/database/types/worker_test.go index 89cea1b2c..e748c95e4 100644 --- a/database/types/worker_test.go +++ b/database/types/worker_test.go @@ -200,7 +200,7 @@ func exceededRunningBuildIDs() []string { runningBuildIDs := []string{} // add enough build ids to exceed the character limit - for i := 0; i < 50; i++ { + for i := range 50 { // construct runningBuildID // use i to adhere to unique runningBuildIDs runningBuildID := "1234567890-" + strconv.Itoa(i) diff --git a/go.sum b/go.sum index 4d661f200..90de15586 100644 --- a/go.sum +++ b/go.sum @@ -403,7 +403,6 @@ golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 h1:merA0rdPeUV3YIIfHHcH4qBkiQAc1nfCKSI7lB4cV2M= diff --git a/internal/token/parse.go b/internal/token/parse.go index 74d1a6ee8..c02e381a1 100644 --- a/internal/token/parse.go +++ b/internal/token/parse.go @@ -22,7 +22,7 @@ func (tm *Manager) ParseToken(token string) (*Claims, error) { p := jwt.NewParser(jwt.WithValidMethods([]string{jwt.SigningMethodHS256.Name})) // parse and validate given token - tkn, err := p.ParseWithClaims(token, claims, func(t *jwt.Token) (interface{}, error) { + tkn, err := p.ParseWithClaims(token, claims, func(t *jwt.Token) (any, error) { var err error // extract the claims from the token diff --git a/internal/yaml_test.go b/internal/yaml_test.go index e70c063f8..95f3c921c 100644 --- a/internal/yaml_test.go +++ b/internal/yaml_test.go @@ -23,7 +23,7 @@ func TestInternal_ParseYAML(t *testing.T) { &yaml.Step{ Name: "example", Image: "alpine:latest", - Parameters: map[string]interface{}{ + Parameters: map[string]any{ "REGION": "dev", }, Pull: "not_present", diff --git a/mock/server/build.go b/mock/server/build.go index 25b694d6e..cd8ee5889 100644 --- a/mock/server/build.go +++ b/mock/server/build.go @@ -553,12 +553,11 @@ func getInstallToken(c *gin.Context) { var body api.Token - data := []byte( - fmt.Sprintf( + data := + fmt.Appendf(nil, InstallTokenResp, time.Now().Add(1*time.Hour).Unix(), - ), - ) + ) _ = json.Unmarshal(data, &body) diff --git a/mock/server/build_test.go b/mock/server/build_test.go index 0d7c4825a..0836d37b0 100644 --- a/mock/server/build_test.go +++ b/mock/server/build_test.go @@ -18,7 +18,7 @@ func TestBuild_ActiveBuildResp(t *testing.T) { t.Errorf("error unmarshaling build: %v", err) } - tBuild := reflect.TypeOf(testBuild) + tBuild := reflect.TypeFor[api.Build]() for i := 0; i < tBuild.NumField(); i++ { if reflect.ValueOf(testBuild).Field(i).IsNil() { diff --git a/mock/server/dashboard_test.go b/mock/server/dashboard_test.go index 0c4e42187..2787f1e50 100644 --- a/mock/server/dashboard_test.go +++ b/mock/server/dashboard_test.go @@ -18,7 +18,7 @@ func TestDashboard_ActiveDashboardResp(t *testing.T) { t.Errorf("error unmarshaling dashboard: %v", err) } - tDashboard := reflect.TypeOf(testDashboard) + tDashboard := reflect.TypeFor[api.Dashboard]() for i := 0; i < tDashboard.NumField(); i++ { if reflect.ValueOf(testDashboard).Field(i).IsNil() { @@ -33,7 +33,7 @@ func TestDashboard_ActiveDashboardResp(t *testing.T) { t.Errorf("error unmarshaling dash card: %v", err) } - tDashCard := reflect.TypeOf(testDashCard) + tDashCard := reflect.TypeFor[api.DashCard]() for i := 0; i < tDashCard.NumField(); i++ { if reflect.ValueOf(testDashCard).Field(i).IsNil() { @@ -49,7 +49,7 @@ func TestDashboard_ActiveDashboardResp(t *testing.T) { } for _, testDashCard := range testDashCards { - tDashCard := reflect.TypeOf(testDashCard) + tDashCard := reflect.TypeFor[api.DashCard]() for i := 0; i < tDashCard.NumField(); i++ { if reflect.ValueOf(testDashCard).Field(i).IsNil() { diff --git a/mock/server/deployment_test.go b/mock/server/deployment_test.go index fd5862e11..db85d78fb 100644 --- a/mock/server/deployment_test.go +++ b/mock/server/deployment_test.go @@ -18,7 +18,7 @@ func TestDeployment_ActiveDeploymentResp(t *testing.T) { t.Errorf("error unmarshaling deployment: %v", err) } - tDeployment := reflect.TypeOf(testDeployment) + tDeployment := reflect.TypeFor[api.Deployment]() for i := 0; i < tDeployment.NumField(); i++ { if reflect.ValueOf(testDeployment).Field(i).IsNil() { diff --git a/mock/server/hook_test.go b/mock/server/hook_test.go index 8ce8af220..808560eb1 100644 --- a/mock/server/hook_test.go +++ b/mock/server/hook_test.go @@ -18,7 +18,7 @@ func TestHook_ActiveHookResp(t *testing.T) { t.Errorf("error unmarshaling hook: %v", err) } - tHook := reflect.TypeOf(testHook) + tHook := reflect.TypeFor[api.Hook]() for i := 0; i < tHook.NumField(); i++ { if reflect.ValueOf(testHook).Field(i).IsNil() { diff --git a/mock/server/log_test.go b/mock/server/log_test.go index 28fbdc4a9..6feca0e15 100644 --- a/mock/server/log_test.go +++ b/mock/server/log_test.go @@ -18,7 +18,7 @@ func TestLog_ActiveLogResp(t *testing.T) { t.Errorf("error unmarshaling log: %v", err) } - tLog := reflect.TypeOf(testLog) + tLog := reflect.TypeFor[api.Log]() for i := 0; i < tLog.NumField(); i++ { if reflect.ValueOf(testLog).Field(i).IsNil() { diff --git a/mock/server/pipeline.go b/mock/server/pipeline.go index 4544c8041..9b1374140 100644 --- a/mock/server/pipeline.go +++ b/mock/server/pipeline.go @@ -484,7 +484,7 @@ func getTemplates(c *gin.Context) { writeYAML(c, http.StatusOK, body) } -func writeYAML(c *gin.Context, status int, value interface{}) { +func writeYAML(c *gin.Context, status int, value any) { body, err := yml.Marshal(value) if err != nil { msg := fmt.Sprintf("unable to marshal YAML response: %v", err) diff --git a/mock/server/pipeline_test.go b/mock/server/pipeline_test.go index 3f67c6461..715f56f71 100644 --- a/mock/server/pipeline_test.go +++ b/mock/server/pipeline_test.go @@ -18,7 +18,7 @@ func TestPipeline_ActivePipelineResp(t *testing.T) { t.Errorf("error unmarshaling pipeline: %v", err) } - tPipeline := reflect.TypeOf(testPipeline) + tPipeline := reflect.TypeFor[api.Pipeline]() for i := 0; i < tPipeline.NumField(); i++ { if reflect.ValueOf(testPipeline).Field(i).IsNil() { diff --git a/mock/server/repo_test.go b/mock/server/repo_test.go index 19ff8599e..6d473c266 100644 --- a/mock/server/repo_test.go +++ b/mock/server/repo_test.go @@ -18,7 +18,7 @@ func TestRepo_ActiveRepoResp(t *testing.T) { t.Errorf("error unmarshaling repo: %v", err) } - tRepo := reflect.TypeOf(testRepo) + tRepo := reflect.TypeFor[api.Repo]() for i := 0; i < tRepo.NumField(); i++ { if tRepo.Field(i).Name == "Hash" { diff --git a/mock/server/schedule_test.go b/mock/server/schedule_test.go index 293676e02..394bbb7ff 100644 --- a/mock/server/schedule_test.go +++ b/mock/server/schedule_test.go @@ -18,7 +18,7 @@ func TestSchedule_ActiveScheduleResp(t *testing.T) { t.Errorf("error unmarshaling schedule: %v", err) } - tSchedule := reflect.TypeOf(testSchedule) + tSchedule := reflect.TypeFor[api.Schedule]() for i := 0; i < tSchedule.NumField(); i++ { if reflect.ValueOf(testSchedule).Field(i).IsNil() { diff --git a/mock/server/secret_test.go b/mock/server/secret_test.go index 43e7098b1..9db4d96c6 100644 --- a/mock/server/secret_test.go +++ b/mock/server/secret_test.go @@ -18,7 +18,7 @@ func TestSecret_ActiveSecretResp(t *testing.T) { t.Errorf("error unmarshaling secret: %v", err) } - tSecret := reflect.TypeOf(testSecret) + tSecret := reflect.TypeFor[api.Secret]() for i := 0; i < tSecret.NumField(); i++ { if reflect.ValueOf(testSecret).Field(i).IsNil() { diff --git a/mock/server/service_test.go b/mock/server/service_test.go index 70e1da0af..f8b84295c 100644 --- a/mock/server/service_test.go +++ b/mock/server/service_test.go @@ -18,7 +18,7 @@ func TestService_ActiveServiceResp(t *testing.T) { t.Errorf("error unmarshaling service: %v", err) } - tService := reflect.TypeOf(testService) + tService := reflect.TypeFor[api.Service]() for i := 0; i < tService.NumField(); i++ { if reflect.ValueOf(testService).Field(i).IsNil() { diff --git a/mock/server/settings_test.go b/mock/server/settings_test.go index d827cc756..00daecdc9 100644 --- a/mock/server/settings_test.go +++ b/mock/server/settings_test.go @@ -18,7 +18,7 @@ func TestSettings_GetResp(t *testing.T) { t.Errorf("error unmarshaling settings: %v", err) } - tSettings := reflect.TypeOf(testSettings) + tSettings := reflect.TypeFor[settings.Platform]() for i := 0; i < tSettings.NumField(); i++ { f := reflect.ValueOf(testSettings).Field(i) @@ -36,7 +36,7 @@ func TestSettings_UpdateResp(t *testing.T) { t.Errorf("error unmarshaling settings: %v", err) } - tSettings := reflect.TypeOf(testSettings) + tSettings := reflect.TypeFor[settings.Platform]() for i := 0; i < tSettings.NumField(); i++ { f := reflect.ValueOf(testSettings).Field(i) @@ -54,7 +54,7 @@ func TestSettings_RestoreResp(t *testing.T) { t.Errorf("error unmarshaling settings: %v", err) } - tSettings := reflect.TypeOf(testSettings) + tSettings := reflect.TypeFor[settings.Platform]() for i := 0; i < tSettings.NumField(); i++ { f := reflect.ValueOf(testSettings).Field(i) diff --git a/mock/server/step_test.go b/mock/server/step_test.go index 6b1952949..5129a70a3 100644 --- a/mock/server/step_test.go +++ b/mock/server/step_test.go @@ -18,7 +18,7 @@ func TestStep_ActiveStepResp(t *testing.T) { t.Errorf("error unmarshaling step: %v", err) } - tStep := reflect.TypeOf(testStep) + tStep := reflect.TypeFor[api.Step]() for i := 0; i < tStep.NumField(); i++ { if reflect.ValueOf(testStep).Field(i).IsNil() { diff --git a/mock/server/user_test.go b/mock/server/user_test.go index edd4cfc10..60b71941b 100644 --- a/mock/server/user_test.go +++ b/mock/server/user_test.go @@ -18,7 +18,7 @@ func TestUser_ActiveUserResp(t *testing.T) { t.Errorf("error unmarshaling user: %v", err) } - tUser := reflect.TypeOf(testUser) + tUser := reflect.TypeFor[api.User]() for i := 0; i < tUser.NumField(); i++ { if tUser.Field(i).Name == "Token" || tUser.Field(i).Name == "RefreshToken" || tUser.Field(i).Name == "Hash" { diff --git a/mock/server/worker_test.go b/mock/server/worker_test.go index a9a46b810..34d6aa80e 100644 --- a/mock/server/worker_test.go +++ b/mock/server/worker_test.go @@ -18,7 +18,7 @@ func TestWorker_ActiveWorkerResp(t *testing.T) { t.Errorf("error unmarshaling worker: %v", err) } - tWorker := reflect.TypeOf(testWorker) + tWorker := reflect.TypeFor[api.Worker]() for i := 0; i < tWorker.NumField(); i++ { if reflect.ValueOf(testWorker).Field(i).IsNil() { @@ -36,7 +36,7 @@ func TestWorker_ListActiveWorkerResp(t *testing.T) { } for index, worker := range testWorkers { - tWorker := reflect.TypeOf(worker) + tWorker := reflect.TypeFor[api.Worker]() for i := 0; i < tWorker.NumField(); i++ { if reflect.ValueOf(worker).Field(i).IsNil() { diff --git a/queue/context_test.go b/queue/context_test.go index a6f7ab4ee..8cfb568c3 100644 --- a/queue/context_test.go +++ b/queue/context_test.go @@ -52,7 +52,7 @@ func TestExecutor_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value interface{} + value any want Service }{ { diff --git a/queue/redis/redis.go b/queue/redis/redis.go index 4245a7aa5..1df7df826 100644 --- a/queue/redis/redis.go +++ b/queue/redis/redis.go @@ -129,7 +129,7 @@ func failoverFromOptions(source *redis.Options) *redis.FailoverOptions { // the first host from the csv list is set as // the master node all subsequent hosts get // added as sentinel nodes - for _, host := range strings.Split(hosts, ",") { + for host := range strings.SplitSeq(hosts, ",") { if len(target.MasterName) == 0 { target.MasterName = host continue diff --git a/router/middleware/build/context.go b/router/middleware/build/context.go index 6870f5364..38c568c08 100644 --- a/router/middleware/build/context.go +++ b/router/middleware/build/context.go @@ -12,7 +12,7 @@ const key = "build" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Build associated with this context. diff --git a/router/middleware/claims/context.go b/router/middleware/claims/context.go index da800172e..1cd642bcd 100644 --- a/router/middleware/claims/context.go +++ b/router/middleware/claims/context.go @@ -12,7 +12,7 @@ const key = "claims" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Claims associated with this context. diff --git a/router/middleware/cli/context.go b/router/middleware/cli/context.go index f5b098a71..f641e3c2e 100644 --- a/router/middleware/cli/context.go +++ b/router/middleware/cli/context.go @@ -12,7 +12,7 @@ const key = "cli" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the cli command associated with this context. diff --git a/router/middleware/dashboard/context.go b/router/middleware/dashboard/context.go index f0f973015..d2634f69f 100644 --- a/router/middleware/dashboard/context.go +++ b/router/middleware/dashboard/context.go @@ -12,7 +12,7 @@ const key = "dashboard" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Dashboard associated with this context. diff --git a/router/middleware/hook/context.go b/router/middleware/hook/context.go index 640969321..b9fb7fbf5 100644 --- a/router/middleware/hook/context.go +++ b/router/middleware/hook/context.go @@ -12,7 +12,7 @@ const key = "hook" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the hook associated with this context. diff --git a/router/middleware/logger.go b/router/middleware/logger.go index d549b87b4..01e6eacff 100644 --- a/router/middleware/logger.go +++ b/router/middleware/logger.go @@ -176,8 +176,8 @@ func Logger(logger *logrus.Logger, _ string) gin.HandlerFunc { } } -func sanitize(body interface{}) interface{} { - if m, ok := body.(map[string]interface{}); ok { +func sanitize(body any) any { + if m, ok := body.(map[string]any); ok { if _, ok = m["email"]; ok { m["email"] = constants.SecretMask body = m diff --git a/router/middleware/logger_test.go b/router/middleware/logger_test.go index 6eab78282..19fe4a657 100644 --- a/router/middleware/logger_test.go +++ b/router/middleware/logger_test.go @@ -160,7 +160,7 @@ func TestMiddleware_Logger_Error(t *testing.T) { } func TestMiddleware_Logger_Sanitize(t *testing.T) { - var logBody, logWant map[string]interface{} + var logBody, logWant map[string]any r := new(api.Repo) r.SetID(1) diff --git a/router/middleware/org/context.go b/router/middleware/org/context.go index 03f913237..1c141276a 100644 --- a/router/middleware/org/context.go +++ b/router/middleware/org/context.go @@ -10,7 +10,7 @@ const key = "org" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Org associated with this context. diff --git a/router/middleware/payload.go b/router/middleware/payload.go index c362002e7..6de265dca 100644 --- a/router/middleware/payload.go +++ b/router/middleware/payload.go @@ -15,7 +15,7 @@ import ( func Payload() gin.HandlerFunc { return func(c *gin.Context) { // bind JSON payload from request to be added to context - var payload interface{} + var payload any _ = c.BindJSON(&payload) diff --git a/router/middleware/payload_test.go b/router/middleware/payload_test.go index 0ad676fb4..b545682a0 100644 --- a/router/middleware/payload_test.go +++ b/router/middleware/payload_test.go @@ -15,7 +15,7 @@ import ( func TestMiddleware_Payload(t *testing.T) { // setup types - var got interface{} + var got any want := `{"foo": "bar"}` jsonBody, _ := json.Marshal(want) diff --git a/router/middleware/pipeline/context.go b/router/middleware/pipeline/context.go index 8d4ad3563..0a19f809d 100644 --- a/router/middleware/pipeline/context.go +++ b/router/middleware/pipeline/context.go @@ -12,7 +12,7 @@ const key = "pipeline" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Pipeline associated with this context. diff --git a/router/middleware/repo/context.go b/router/middleware/repo/context.go index 73c0db4f1..14b1a1f37 100644 --- a/router/middleware/repo/context.go +++ b/router/middleware/repo/context.go @@ -12,7 +12,7 @@ const key = "repo" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Repo associated with this context. diff --git a/router/middleware/schedule/context.go b/router/middleware/schedule/context.go index 5c8920d01..411ab109b 100644 --- a/router/middleware/schedule/context.go +++ b/router/middleware/schedule/context.go @@ -12,7 +12,7 @@ const key = "schedule" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Schedule associated with this context. diff --git a/router/middleware/service/context.go b/router/middleware/service/context.go index 4098cdea0..9617f1bec 100644 --- a/router/middleware/service/context.go +++ b/router/middleware/service/context.go @@ -12,7 +12,7 @@ const key = "service" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Service associated with this context. diff --git a/router/middleware/settings/context.go b/router/middleware/settings/context.go index f5aa5fb62..cb04ca579 100644 --- a/router/middleware/settings/context.go +++ b/router/middleware/settings/context.go @@ -12,7 +12,7 @@ const key = "settings" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Settings associated with this context. diff --git a/router/middleware/step/context.go b/router/middleware/step/context.go index ae022c6b6..9ef6da785 100644 --- a/router/middleware/step/context.go +++ b/router/middleware/step/context.go @@ -12,7 +12,7 @@ const key = "step" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Step associated with this context. diff --git a/router/middleware/tracing/context.go b/router/middleware/tracing/context.go index ea457bbf1..28b06d55d 100644 --- a/router/middleware/tracing/context.go +++ b/router/middleware/tracing/context.go @@ -12,7 +12,7 @@ const key = "tracing" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the associated value with this context. diff --git a/router/middleware/user/context.go b/router/middleware/user/context.go index 99a4fc3d7..3e6a583c9 100644 --- a/router/middleware/user/context.go +++ b/router/middleware/user/context.go @@ -12,7 +12,7 @@ const key = "user" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the User associated with this context. diff --git a/router/middleware/worker/context.go b/router/middleware/worker/context.go index 2e9772a9e..2fdce7f2d 100644 --- a/router/middleware/worker/context.go +++ b/router/middleware/worker/context.go @@ -12,7 +12,7 @@ const key = "worker" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the Worker associated with this context. diff --git a/schema/pipeline.go b/schema/pipeline.go index 0daf45115..53313a376 100644 --- a/schema/pipeline.go +++ b/schema/pipeline.go @@ -24,7 +24,8 @@ import ( // The returned value can be marshaled into actual JSON. func NewPipelineSchema() (*jsonschema.Schema, error) { ref := jsonschema.Reflector{ - ExpandedStruct: true, + ExpandedStruct: true, + RequiredFromJSONSchemaTags: true, } s := ref.Reflect(types.Build{}) diff --git a/scm/context.go b/scm/context.go index 25f703db8..f2e1e9d4b 100644 --- a/scm/context.go +++ b/scm/context.go @@ -14,7 +14,7 @@ const key = "scm" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the scm Service diff --git a/scm/github/app_transport.go b/scm/github/app_transport.go index f332d260b..107b1fd99 100644 --- a/scm/github/app_transport.go +++ b/scm/github/app_transport.go @@ -119,7 +119,7 @@ type Transport struct { type accessToken struct { Token string `json:"token"` ExpiresAt time.Time `json:"expires_at"` - Permissions github.InstallationPermissions `json:"permissions,omitempty"` + Permissions github.InstallationPermissions `json:"permissions"` Repositories []github.Repository `json:"repositories,omitempty"` } @@ -242,7 +242,7 @@ func (t *Transport) refreshToken(ctx context.Context) error { } // GetReadWriter converts a body interface into an io.ReadWriter object. -func GetReadWriter(i interface{}) (io.ReadWriter, error) { +func GetReadWriter(i any) (io.ReadWriter, error) { var buf io.ReadWriter if i != nil { diff --git a/scm/github/deployment.go b/scm/github/deployment.go index ccffc87d9..eeba521d1 100644 --- a/scm/github/deployment.go +++ b/scm/github/deployment.go @@ -166,7 +166,7 @@ func (c *Client) CreateDeployment(ctx context.Context, u *api.User, r *api.Repo, // create GitHub OAuth client with user's token client := c.newOAuthTokenClient(ctx, *u.Token) - var payload interface{} + var payload any if d.Payload == nil { payload = make(map[string]string) } else { diff --git a/scm/github/repo.go b/scm/github/repo.go index 890eefb03..eacb166db 100644 --- a/scm/github/repo.go +++ b/scm/github/repo.go @@ -26,7 +26,7 @@ func (c *Client) ConfigBackoff(ctx context.Context, u *api.User, r *api.Repo, re // number of times to retry retryLimit := 5 - for i := 0; i < retryLimit; i++ { + for i := range retryLimit { logrus.Debugf("fetching config file - Attempt %d", i+1) // attempt to fetch the config data, err = c.Config(ctx, u, r, ref) diff --git a/scm/github/status_test.go b/scm/github/status_test.go index 211ec1f0e..686cbcb8b 100644 --- a/scm/github/status_test.go +++ b/scm/github/status_test.go @@ -222,7 +222,7 @@ func TestGithub_Status_PendingApproval_CheckRun_Create(t *testing.T) { resp := httptest.NewRecorder() _, engine := gin.CreateTestContext(resp) - var payload map[string]interface{} + var payload map[string]any // setup mock server engine.POST("/api/v3/repos/:org/:repo/check-runs", func(c *gin.Context) { @@ -282,7 +282,7 @@ func TestGithub_Status_Running_CheckRun_Update(t *testing.T) { resp := httptest.NewRecorder() _, engine := gin.CreateTestContext(resp) - var payload map[string]interface{} + var payload map[string]any // setup mock server engine.PATCH("/api/v3/repos/:org/:repo/check-runs/:id", func(c *gin.Context) { @@ -353,7 +353,7 @@ func TestGithub_StepStatus_Success_CheckRun_Update(t *testing.T) { resp := httptest.NewRecorder() _, engine := gin.CreateTestContext(resp) - var payload map[string]interface{} + var payload map[string]any // setup mock server engine.PATCH("/api/v3/repos/:org/:repo/check-runs/:id", func(c *gin.Context) { diff --git a/scm/github/webhook.go b/scm/github/webhook.go index 630edad70..7d74a2445 100644 --- a/scm/github/webhook.go +++ b/scm/github/webhook.go @@ -205,8 +205,8 @@ func (c *Client) processPushEvent(_ context.Context, h *api.Hook, payload *githu b.SetEvent(constants.EventTag) // set the proper branch from the base ref - if strings.HasPrefix(payload.GetBaseRef(), "refs/heads/") { - b.SetBranch(strings.TrimPrefix(payload.GetBaseRef(), "refs/heads/")) + if after, ok := strings.CutPrefix(payload.GetBaseRef(), "refs/heads/"); ok { + b.SetBranch(after) } } @@ -224,8 +224,8 @@ func (c *Client) processPushEvent(_ context.Context, h *api.Hook, payload *githu // set the proper event for the build b.SetEvent(constants.EventDelete) - if strings.HasPrefix(payload.GetRef(), "refs/tags/") { - b.SetBranch(strings.TrimPrefix(payload.GetRef(), "refs/tags/")) + if after, ok := strings.CutPrefix(payload.GetRef(), "refs/tags/"); ok { + b.SetBranch(after) // set the proper action for the build b.SetEventAction(constants.ActionTag) // set the proper message for the build diff --git a/secret/context.go b/secret/context.go index b1b6eb458..193a69daf 100644 --- a/secret/context.go +++ b/secret/context.go @@ -8,7 +8,7 @@ import ( // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext returns the secret Service diff --git a/secret/vault/count.go b/secret/vault/count.go index e0764ad0c..98ea384b3 100644 --- a/secret/vault/count.go +++ b/secret/vault/count.go @@ -54,7 +54,7 @@ func (c *Client) Count(_ context.Context, sType, org, name string, _ []string) ( } // cast the list of secrets to the expected type - keys, ok := vault.Data["keys"].([]interface{}) + keys, ok := vault.Data["keys"].([]any) if !ok { return 0, fmt.Errorf("not a valid list of secrets from Vault") } diff --git a/secret/vault/create.go b/secret/vault/create.go index f5f520e45..9469aba9e 100644 --- a/secret/vault/create.go +++ b/secret/vault/create.go @@ -61,27 +61,27 @@ func (c *Client) Create(_ context.Context, sType, org, name string, s *api.Secre // createOrg is a helper function to create // the org secret for the provided path. -func (c *Client) createOrg(org, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) createOrg(org, path string, data map[string]any) (*api.Secret, error) { return c.create(fmt.Sprintf("%s/org/%s/%s", c.config.Prefix, org, path), data) } // createRepo is a helper function to create // the repo secret for the provided path. -func (c *Client) createRepo(org, repo, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) createRepo(org, repo, path string, data map[string]any) (*api.Secret, error) { return c.create(fmt.Sprintf("%s/repo/%s/%s/%s", c.config.Prefix, org, repo, path), data) } // createShared is a helper function to create // the shared secret for the provided path. -func (c *Client) createShared(org, team, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) createShared(org, team, path string, data map[string]any) (*api.Secret, error) { return c.create(fmt.Sprintf("%s/shared/%s/%s/%s", c.config.Prefix, org, team, path), data) } // create is a helper function to create // the secret for the provided path. -func (c *Client) create(path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) create(path string, data map[string]any) (*api.Secret, error) { if strings.HasPrefix("secret/data", c.config.Prefix) { - data = map[string]interface{}{ + data = map[string]any{ "data": data, } } diff --git a/secret/vault/list.go b/secret/vault/list.go index 6011ac7c0..e414087db 100644 --- a/secret/vault/list.go +++ b/secret/vault/list.go @@ -62,7 +62,7 @@ func (c *Client) List(ctx context.Context, sType, org, name string, _, _ int, _ } // cast the list of secrets to the expected type - keys, ok := vault.Data["keys"].([]interface{}) + keys, ok := vault.Data["keys"].([]any) if !ok { return nil, fmt.Errorf("not a valid list of secrets from Vault") } @@ -109,9 +109,9 @@ func (c *Client) listShared(org, team string) (*api.Secret, error) { // list of secrets for the provided path. func (c *Client) list(path string) (*api.Secret, error) { // handle k/v v2 - if strings.HasPrefix(path, "secret/data/") { + if after, ok := strings.CutPrefix(path, "secret/data/"); ok { // remove secret/data/ prefix - path = strings.TrimPrefix(path, "secret/data/") + path = after // add secret/metadata/ prefix path = fmt.Sprintf("secret/metadata/%s", path) } diff --git a/secret/vault/refresh.go b/secret/vault/refresh.go index 47678dff2..fdfe64ce5 100644 --- a/secret/vault/refresh.go +++ b/secret/vault/refresh.go @@ -74,7 +74,7 @@ func (c *Client) getAwsToken(ctx context.Context) (string, time.Duration, error) // generateAwsAuthHeader will generate the necessary data // to send to the Vault server for generating a token. -func (c *Client) generateAwsAuthHeader(ctx context.Context) (map[string]interface{}, error) { +func (c *Client) generateAwsAuthHeader(ctx context.Context) (map[string]any, error) { c.Logger.Trace("generating AWS auth headers for vault") if c.AWS.Presigner == nil { @@ -91,7 +91,7 @@ func (c *Client) generateAwsAuthHeader(ctx context.Context) (map[string]interfac return nil, err } - loginData := map[string]interface{}{ + loginData := map[string]any{ "role": c.AWS.Role, "iam_http_request_method": presignedReq.Method, "iam_request_url": base64.StdEncoding.EncodeToString([]byte(presignedReq.URL)), diff --git a/secret/vault/update.go b/secret/vault/update.go index bdbe83551..13b4d0ae5 100644 --- a/secret/vault/update.go +++ b/secret/vault/update.go @@ -92,27 +92,27 @@ func (c *Client) Update(ctx context.Context, sType, org, name string, s *api.Sec // updateOrg is a helper function to update // the org secret for the provided path. -func (c *Client) updateOrg(org, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) updateOrg(org, path string, data map[string]any) (*api.Secret, error) { return c.update(fmt.Sprintf("%s/%s/%s/%s", c.config.Prefix, constants.SecretOrg, org, path), data) } // updateRepo is a helper function to update // the repo secret for the provided path. -func (c *Client) updateRepo(org, repo, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) updateRepo(org, repo, path string, data map[string]any) (*api.Secret, error) { return c.update(fmt.Sprintf("%s/%s/%s/%s/%s", c.config.Prefix, constants.SecretRepo, org, repo, path), data) } // updateShared is a helper function to update // the shared secret for the provided path. -func (c *Client) updateShared(org, team, path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) updateShared(org, team, path string, data map[string]any) (*api.Secret, error) { return c.update(fmt.Sprintf("%s/%s/%s/%s/%s", c.config.Prefix, constants.SecretShared, org, team, path), data) } // update is a helper function to update // the secret for the provided path. -func (c *Client) update(path string, data map[string]interface{}) (*api.Secret, error) { +func (c *Client) update(path string, data map[string]any) (*api.Secret, error) { if strings.HasPrefix("secret/data", c.config.Prefix) { - data = map[string]interface{}{ + data = map[string]any{ "data": data, } } diff --git a/secret/vault/vault.go b/secret/vault/vault.go index 770e4f000..a9e20b08d 100644 --- a/secret/vault/vault.go +++ b/secret/vault/vault.go @@ -148,10 +148,10 @@ func NewWithContext(ctx context.Context, opts ...ClientOpt) (*Client, error) { func secretFromVault(vault *api.Secret) *velaAPI.Secret { s := new(velaAPI.Secret) - var data map[string]interface{} + var data map[string]any // handle k/v v2 if _, ok := vault.Data["data"]; ok { - data = vault.Data["data"].(map[string]interface{}) + data = vault.Data["data"].(map[string]any) } else { data = vault.Data } @@ -173,7 +173,7 @@ func secretFromVault(vault *api.Secret) *velaAPI.Secret { if ok { allowEventsMask := int64(0) - for _, element := range events.([]interface{}) { + for _, element := range events.([]any) { event, ok := element.(string) if ok { switch event { @@ -200,7 +200,7 @@ func secretFromVault(vault *api.Secret) *velaAPI.Secret { // set images if found in Vault secret v, ok = data["images"] if ok { - images, ok := v.([]interface{}) + images, ok := v.([]any) if ok { for _, element := range images { image, ok := element.(string) @@ -353,7 +353,7 @@ func secretFromVault(vault *api.Secret) *velaAPI.Secret { // vaultFromSecret is a helper function to convert a Vela secret to a HashiCorp Vault secret. func vaultFromSecret(s *velaAPI.Secret) *api.Secret { - data := make(map[string]interface{}) + data := make(map[string]any) vault := new(api.Secret) vault.Data = data diff --git a/secret/vault/vault_test.go b/secret/vault/vault_test.go index 54718b4cf..15d2949f5 100644 --- a/secret/vault/vault_test.go +++ b/secret/vault/vault_test.go @@ -101,17 +101,17 @@ func TestVault_secretFromVault(t *testing.T) { } inputV2 := &api.Secret{ - Data: map[string]interface{}{ + Data: map[string]any{ "data": testVaultSecretData(), }, } // test vault secret from pre-v0.23 release inputLegacy := &api.Secret{ - Data: map[string]interface{}{ - "data": map[string]interface{}{ - "events": []interface{}{"push", "tag", "deployment"}, - "images": []interface{}{"foo", "bar"}, + Data: map[string]any{ + "data": map[string]any{ + "events": []any{"push", "tag", "deployment"}, + "images": []any{"foo", "bar"}, "name": "bar", "org": "foo", "repo": "*", @@ -189,7 +189,7 @@ func TestVault_vaultFromSecret(t *testing.T) { s.SetUpdatedBy("octocat2") want := &api.Secret{ - Data: map[string]interface{}{ + Data: map[string]any{ "allow_events": int64(1), "images": []string{"foo", "bar"}, "name": "bar", @@ -217,9 +217,7 @@ func TestVault_vaultFromSecret(t *testing.T) { } func TestVault_AccurateSecretFields(t *testing.T) { - testSecret := velaAPI.Secret{} - - tSecret := reflect.TypeOf(testSecret) + tSecret := reflect.TypeFor[velaAPI.Secret]() vaultSecret := testVaultSecretData() @@ -243,10 +241,10 @@ func TestVault_AccurateSecretFields(t *testing.T) { } // helper function to return a test Vault secret data. -func testVaultSecretData() map[string]interface{} { - return map[string]interface{}{ +func testVaultSecretData() map[string]any { + return map[string]any{ "allow_events": json.Number("8195"), - "images": []interface{}{"foo", "bar"}, + "images": []any{"foo", "bar"}, "name": "bar", "org": "foo", "repo": "*", diff --git a/storage/context.go b/storage/context.go index 4f215b192..b63c3a9e8 100644 --- a/storage/context.go +++ b/storage/context.go @@ -13,7 +13,7 @@ const key = "minio" // Setter defines a context that enables setting values. type Setter interface { - Set(string, interface{}) + Set(any, any) } // FromContext retrieves minio service from the context. diff --git a/storage/context_test.go b/storage/context_test.go index 025f35274..071eeae8c 100644 --- a/storage/context_test.go +++ b/storage/context_test.go @@ -52,7 +52,7 @@ func TestExecutor_FromGinContext(t *testing.T) { // setup tests tests := []struct { context *gin.Context - value interface{} + value any want Storage }{ { diff --git a/version/version.go b/version/version.go index efc7a68ae..890ad8cab 100644 --- a/version/version.go +++ b/version/version.go @@ -43,7 +43,7 @@ type Version struct { // PreRelease represents unstable changes that might not be compatible. PreRelease string `json:"pre_release,omitempty"` // Metadata represents extra information surrounding the application version. - Metadata Metadata `json:"metadata,omitempty"` + Metadata Metadata `json:"metadata"` } // Meta implements a formatted string containing only metadata for the Version type. From dbd5965a46b47e77728f87fcad08e9a9e38bbcff Mon Sep 17 00:00:00 2001 From: ecrupper Date: Tue, 24 Feb 2026 16:31:25 -0600 Subject: [PATCH 5/5] update swagger --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b0cd83a9b..eb3a13b23 100644 --- a/Makefile +++ b/Makefile @@ -282,7 +282,7 @@ spec-install: @sudo apt-get update @sudo apt-get install -y jq moreutils @echo "### Installing go-swagger" - @go install github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0 + @go install github.com/go-swagger/go-swagger/cmd/swagger@v0.33.1 # The `spec-gen` target is intended to create an api-spec # using go-swagger (https://goswagger.io)