mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
chore(ci): add renovate for golangci-lint, go and node version (#20236)
Signed-off-by: ggjulio <juligonz@student.42.fr>
This commit is contained in:
parent
52d5653c86
commit
d17aafd19a
14 changed files with 179 additions and 166 deletions
3
.github/dependabot.yml
vendored
3
.github/dependabot.yml
vendored
|
|
@ -33,8 +33,7 @@ updates:
|
|||
interval: "daily"
|
||||
ignore:
|
||||
# We use consistent go and node versions across a lot of different files, and updating via dependabot would cause
|
||||
# drift among those files.
|
||||
# Use `make update-go` and `make update-node` to update these versions.
|
||||
# drift among those files, instead we let renovate bot handle them.
|
||||
- dependency-name: "library/golang"
|
||||
- dependency-name: "library/node"
|
||||
|
||||
|
|
|
|||
3
.github/workflows/ci-build.yaml
vendored
3
.github/workflows/ci-build.yaml
vendored
|
|
@ -13,6 +13,7 @@ on:
|
|||
|
||||
env:
|
||||
# Golang version to use across CI steps
|
||||
# renovate: datasource=golang-version packageName=golang
|
||||
GOLANG_VERSION: '1.23.1'
|
||||
|
||||
concurrency:
|
||||
|
|
@ -110,6 +111,7 @@ jobs:
|
|||
- name: Run golangci-lint
|
||||
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
|
||||
with:
|
||||
# renovate: datasource=go packageName=github.com/golangci/golangci-lint versioning=regex:^v(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)?$
|
||||
version: v1.61.0
|
||||
args: --verbose
|
||||
|
||||
|
|
@ -305,6 +307,7 @@ jobs:
|
|||
- name: Setup NodeJS
|
||||
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
|
||||
with:
|
||||
# renovate: datasource=node-version packageName=node versioning=node
|
||||
node-version: '22.8.0'
|
||||
- name: Restore node dependency cache
|
||||
id: cache-dependencies
|
||||
|
|
|
|||
2
.github/workflows/image.yaml
vendored
2
.github/workflows/image.yaml
vendored
|
|
@ -52,6 +52,7 @@ jobs:
|
|||
uses: ./.github/workflows/image-reuse.yaml
|
||||
with:
|
||||
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
|
||||
# renovate: datasource=golang-version packageName=golang
|
||||
go-version: 1.23.1
|
||||
platforms: ${{ needs.set-vars.outputs.platforms }}
|
||||
push: false
|
||||
|
|
@ -68,6 +69,7 @@ jobs:
|
|||
quay_image_name: quay.io/argoproj/argocd:latest
|
||||
ghcr_image_name: ghcr.io/argoproj/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }}
|
||||
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
|
||||
# renovate: datasource=golang-version packageName=golang
|
||||
go-version: 1.23.1
|
||||
platforms: ${{ needs.set-vars.outputs.platforms }}
|
||||
push: true
|
||||
|
|
|
|||
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
|
|
@ -10,6 +10,7 @@ on:
|
|||
permissions: {}
|
||||
|
||||
env:
|
||||
# renovate: datasource=golang-version packageName=golang
|
||||
GOLANG_VERSION: '1.23.1' # Note: go-version must also be set in job argocd-image.with.go-version
|
||||
|
||||
jobs:
|
||||
|
|
@ -23,6 +24,7 @@ jobs:
|
|||
with:
|
||||
quay_image_name: quay.io/argoproj/argocd:${{ github.ref_name }}
|
||||
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
|
||||
# renovate: datasource=golang-version packageName=golang
|
||||
go-version: 1.23.1
|
||||
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
|
||||
push: true
|
||||
|
|
|
|||
42
.github/workflows/update-go.yaml
vendored
42
.github/workflows/update-go.yaml
vendored
|
|
@ -1,42 +0,0 @@
|
|||
# Update golang version on a daily basis and open a PR.
|
||||
name: Update Go
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update-go:
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
if: github.repository == 'argoproj/argo-cd'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: imjasonh/setup-crane@31b88efe9de28ae0ffa220711af4b60be9435f6e # v0.4
|
||||
- name: Update Go
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
make update-go
|
||||
|
||||
# If there are no changes, quit early.
|
||||
if [[ -z $(git status -s) ]]; then
|
||||
echo "No changes detected"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
pr_branch="update-go-$(echo $RANDOM | md5sum | head -c 20)"
|
||||
git checkout -b "$pr_branch"
|
||||
git config --global user.email 'ci@argoproj.com'
|
||||
git config --global user.name 'CI'
|
||||
git add .
|
||||
git commit -m "[Bot] chore(dep): Update Go" --signoff
|
||||
git push --set-upstream origin "$pr_branch"
|
||||
gh pr create -B master -H "$pr_branch" --title '[Bot] chore(dep): Update Go' --body ''
|
||||
42
.github/workflows/update-node.yaml
vendored
42
.github/workflows/update-node.yaml
vendored
|
|
@ -1,42 +0,0 @@
|
|||
# Update Node version on a daily basis and open a PR.
|
||||
name: Update Node
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update-node:
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
if: github.repository == 'argoproj/argo-cd'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: imjasonh/setup-crane@31b88efe9de28ae0ffa220711af4b60be9435f6e # v0.4
|
||||
- name: Update Node
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
make update-node
|
||||
|
||||
# If there are no changes, quit early.
|
||||
if [[ -z $(git status -s) ]]; then
|
||||
echo "No changes detected"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
pr_branch="update-node-$(echo $RANDOM | md5sum | head -c 20)"
|
||||
git checkout -b "$pr_branch"
|
||||
git config --global user.email 'ci@argoproj.com'
|
||||
git config --global user.name 'CI'
|
||||
git add .
|
||||
git commit -m "[Bot] chore(dep): Update Node" --signoff
|
||||
git push --set-upstream origin "$pr_branch"
|
||||
gh pr create -B master -H "$pr_branch" --title '[Bot] chore(dep): Update Node' --body ''
|
||||
8
Makefile
8
Makefile
|
|
@ -631,14 +631,6 @@ snyk-non-container-tests:
|
|||
snyk-report:
|
||||
./hack/snyk-report.sh $(target_branch)
|
||||
|
||||
.PHONY: update-go
|
||||
update-go:
|
||||
./hack/update-go.sh
|
||||
|
||||
.PHONY: update-node
|
||||
update-node:
|
||||
./hack/update-node.sh
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo 'Note: Generally an item w/ (-local) will run inside docker unless you use the -local variant'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -eux -o pipefail
|
||||
|
||||
GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
|
||||
# renovate: datasource=go packageName=github.com/golangci/golangci-lint
|
||||
GOLANGCI_LINT_VERSION=1.61.0
|
||||
|
||||
GO111MODULE=on go install "github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}"
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script is used to update the Go version in the project.
|
||||
# We use this because Dependabot doesn't support updating the Go version in all the places we use Go.
|
||||
|
||||
set -e
|
||||
|
||||
echo "Getting latest Go version..."
|
||||
|
||||
# Get the current stable Go version. This assumes the JSON is sorted newest-to-oldest.
|
||||
GO_VERSION=$(curl -s https://go.dev/dl/?mode=json | jq 'map(select(.stable == true))[0].version' -r)
|
||||
|
||||
# Make sure the version number is semver.
|
||||
if [[ ! "$GO_VERSION" =~ ^go[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Failed to get the latest Go version."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove the 'go' prefix from the version number.
|
||||
GO_VERSION=${GO_VERSION#go}
|
||||
|
||||
# Get the digest of the Go image.
|
||||
DIGEST=$(crane digest "docker.io/library/golang:$GO_VERSION")
|
||||
|
||||
echo "Updating to Go version $GO_VERSION with digest $DIGEST..."
|
||||
|
||||
# Replace the Go image in the Dockerfile.
|
||||
sed -r -i.bak "s/docker\.io\/library\/golang:[0-9.]+@sha256:[0-9a-f]+/docker.io\/library\/golang:$GO_VERSION@$DIGEST/" Dockerfile test/container/Dockerfile test/remote/Dockerfile
|
||||
rm Dockerfile.bak test/container/Dockerfile.bak test/remote/Dockerfile.bak
|
||||
|
||||
# Update the go version in ci-build.yaml, image.yaml, and release.yaml.
|
||||
sed -r -i.bak "s/go-version: [0-9.]+/go-version: $GO_VERSION/" .github/workflows/ci-build.yaml .github/workflows/image.yaml .github/workflows/release.yaml
|
||||
rm .github/workflows/ci-build.yaml.bak .github/workflows/image.yaml.bak .github/workflows/release.yaml.bak
|
||||
|
||||
# Repeat for env var instead of go-version.
|
||||
sed -r -i.bak "s/GOLANG_VERSION: '[0-9.]+'/GOLANG_VERSION: '$GO_VERSION'/" .github/workflows/ci-build.yaml .github/workflows/image.yaml .github/workflows/release.yaml
|
||||
rm .github/workflows/ci-build.yaml.bak .github/workflows/image.yaml.bak .github/workflows/release.yaml.bak
|
||||
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script is used to update the node version in the project.
|
||||
# We use this because Dependabot doesn't support updating the Node version in all the places we use Node.
|
||||
|
||||
set -e
|
||||
|
||||
echo "Getting latest Node version..."
|
||||
|
||||
# Get the current LTS node version. This assumes the JSON is sorted newest-to-oldest.
|
||||
NODE_VERSION=$(curl -s https://nodejs.org/download/release/index.json | jq '.[0].version' -r)
|
||||
|
||||
# Make sure the version number is semver with a preceding 'v'.
|
||||
if [[ ! "$NODE_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Failed to get the latest Node version."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Strip the preceding 'v' from the version number.
|
||||
NODE_VERSION=${NODE_VERSION#v}
|
||||
|
||||
# Get the manifest SHA of the library/node image.
|
||||
DIGEST=$(crane digest "docker.io/library/node:$NODE_VERSION")
|
||||
|
||||
echo "Updating to Node version $NODE_VERSION with digest $DIGEST..."
|
||||
|
||||
# Replace the node image in the Dockerfiles.
|
||||
sed -r -i.bak "s/docker\.io\/library\/node:[0-9.]+@sha256:[0-9a-f]+/docker.io\/library\/node:$NODE_VERSION@$DIGEST/" Dockerfile ui-test/Dockerfile test/container/Dockerfile
|
||||
rm Dockerfile.bak ui-test/Dockerfile.bak test/container/Dockerfile.bak
|
||||
|
||||
# Replace node version in ci-build.yaml.
|
||||
sed -r -i.bak "s/node-version: '[0-9.]+'/node-version: '$NODE_VERSION'/" .github/workflows/ci-build.yaml
|
||||
rm .github/workflows/ci-build.yaml.bak
|
||||
16
renovate-presets/custom-managers/shell.json5
Normal file
16
renovate-presets/custom-managers/shell.json5
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"customManagers": [
|
||||
{
|
||||
"description": "A generic custom manager for updating any shell scripts.",
|
||||
"customType": "regex",
|
||||
"fileMatch": [
|
||||
".+\\.(?:bash|sh|ksh)$"
|
||||
],
|
||||
"matchStrings": [
|
||||
"# renovate: datasource=(?<datasource>.*?)(?: depName=(?<depName>.+?))? packageName=(?<packageName>.+?)(?: versioning=(?<versioning>.*?))?(?: extractVersion=(?<extractVersion>.*?))?\\s.+?_VERSION\\s*=\\s*(?:'|\")(?<currentValue>[^(?:'|\")]+)(?:'|\")",
|
||||
"# renovate: datasource=(?<datasource>.*?)(?: depName=(?<depName>.+?))? packageName=(?<packageName>.+?)(?: versioning=(?<versioning>.*?))?(?: extractVersion=(?<extractVersion>.*?))?\\s.+?_VERSION\\s*=\\s*(?<currentValue>[^'\"\\s]+)"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
16
renovate-presets/custom-managers/yaml.json5
Normal file
16
renovate-presets/custom-managers/yaml.json5
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"customManagers": [
|
||||
{
|
||||
"description": "A generic custom manager for updating any yaml fields ending by *version: case incensitive",
|
||||
"customType": "regex",
|
||||
"fileMatch": [
|
||||
".github\\/workflows.+\\.(?:yml|yaml)$"
|
||||
],
|
||||
"matchStrings": [
|
||||
"# renovate: datasource=(?<datasource>.*?)(?: depName=(?<depName>.+?))? packageName=(?<packageName>.+?)(?: versioning=(?<versioning>.*?))?(?: extractVersion=(?<extractVersion>.*?))?\\s.+?((?i)VERSION)\\s*:\\s*(?:'|\")(?<currentValue>[^(?:'|\")]+)(?:'|\")",
|
||||
"# renovate: datasource=(?<datasource>.*?)(?: depName=(?<depName>.+?))? packageName=(?<packageName>.+?)(?: versioning=(?<versioning>.*?))?(?: extractVersion=(?<extractVersion>.*?))?\\s.+?((?i)VERSION)\\s*:\\s*(?<currentValue>[^'\"\\s]+)"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
22
renovate-presets/fix/openssf-merge-confidence-columns.json5
Normal file
22
renovate-presets/fix/openssf-merge-confidence-columns.json5
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"description": "Merge the output of mergeConfidence:all-badges and security:openssf-scorecard. See https://github.com/renovatebot/renovate/discussions/25125 for rationale.",
|
||||
"packageRules": [
|
||||
{
|
||||
"matchPackagePatterns": [
|
||||
".*"
|
||||
],
|
||||
"prBodyColumns": [
|
||||
"Package",
|
||||
"Type",
|
||||
"Update",
|
||||
"Change",
|
||||
"Age",
|
||||
"Adoption",
|
||||
"Passing",
|
||||
"Confidence",
|
||||
"OpenSSF"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
113
renovate.json
Normal file
113
renovate.json
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"dependencyDashboard": true,
|
||||
"dependencyDashboardOSVVulnerabilitySummary": "all",
|
||||
"osvVulnerabilityAlerts": true,
|
||||
"reviewersFromCodeOwners": true,
|
||||
"extends": [
|
||||
"config:best-practices",
|
||||
"customManagers:dockerfileVersions",
|
||||
"security:openssf-scorecard",
|
||||
"mergeConfidence:all-badges",
|
||||
"github>argoproj/argo-cd//renovate-presets/fix/openssf-merge-confidence-columns.json5",
|
||||
"github>argoproj/argo-cd//renovate-presets/custom-managers/shell.json5",
|
||||
"github>argoproj/argo-cd//renovate-presets/custom-managers/yaml.json5"
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"description": "Disable all updates to avoid conflicts with dependabot, then enable what we want",
|
||||
"matchPackageNames": [
|
||||
"*"
|
||||
],
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"description": "Add label dependencies to all PRs",
|
||||
"matchPackageNames": [
|
||||
"*"
|
||||
],
|
||||
"labels": [
|
||||
"dependencies"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Enable node-version",
|
||||
"matchDatasources": [
|
||||
"node-version"
|
||||
],
|
||||
"addLabels": [
|
||||
"javascript"
|
||||
],
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"description": "Enable golang-version",
|
||||
"matchDatasources": [
|
||||
"golang-version"
|
||||
],
|
||||
"addLabels": [
|
||||
"go"
|
||||
],
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"description": "Enable some go modules",
|
||||
"matchDatasources": [
|
||||
"go"
|
||||
],
|
||||
"matchPackageNames": [
|
||||
"go",
|
||||
"github.com/golangci/golangci-lint"
|
||||
],
|
||||
"addLabels": [
|
||||
"go"
|
||||
],
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"description": "Enable bump of golang version in go.mod",
|
||||
"matchDatasources": [
|
||||
"golang-version"
|
||||
],
|
||||
"rangeStrategy": "bump"
|
||||
},
|
||||
{
|
||||
"description": "Enable some docker images",
|
||||
"matchDatasources": [
|
||||
"docker"
|
||||
],
|
||||
"matchPackageNames": [
|
||||
"docker.io/library/node",
|
||||
"docker.io/library/golang"
|
||||
],
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"description": "Group golang-version packages",
|
||||
"groupName": "golang version",
|
||||
"matchDepNames": [
|
||||
"go",
|
||||
"golang",
|
||||
"docker.io/golang",
|
||||
"docker.io/library/golang"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Group node-version packages",
|
||||
"groupName": "node version",
|
||||
"matchDepNames": [
|
||||
"node",
|
||||
"docker.io/library/node"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "an example to reduce noise by automerging pkgs that are safe to merge, multiple match fields can be used to reduce the scope of this rule...)",
|
||||
"matchUpdateTypes": [
|
||||
"patch",
|
||||
"pin",
|
||||
"digest"
|
||||
],
|
||||
"automerge": false
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in a new issue