Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add goimports config #181

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions updatecli/updatecli.d/dockerfile_dapper_goimports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# This file updates the version of goimports used in Dockerfile.dapper
---
name: "Update the version of goimports used in Dockerfile.dapper"
scms:
kine:
kind: "github"
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
username: "{{ requiredEnv .github.username }}"
token: '{{ requiredEnv .github.token }}'
owner: "k3s-io"
repository: "kine"
branch: "master"
golang-tools:
kind: "github"
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
username: "{{ requiredEnv .github.username }}"
token: '{{ requiredEnv .github.token }}'
owner: "golang"
repository: "tools"
branch: "master"

sources:
latestGoImportsHash:
name: "Get commit hash of latest goimports tag"
kind: "gittag"
scmid: "golang-tools"
spec:
versionfilter:
kind: "regex"
pattern: '^gopls\/v\d*\.\d*\.\d*$' # ex. gopls/v0.11.0
key: "hash"
latestGoImportsTag:
name: "Get latest goimports tag"
kind: "gittag"
scmid: "golang-tools"
spec:
versionfilter:
kind: "regex"
pattern: '^gopls\/v\d*\.\d*\.\d*$' # ex. gopls/v0.11.0

# continue to targets when file doesn't match source
conditions:
testHashShouldMatch:
name: "Hash should match latest tag's commit hash"
kind: file
disablesourceinput: true
spec:
file: "Dockerfile.dapper"
matchpattern: 'go install golang\.org\/x\/tools\/cmd\/goimports@{{ source `latestGoImportsHash` }}'
failwhen: true

targets:
updateDockerfileHash:
name: "Update the hash in Dockerfile.dapper"
kind: "file"
scmid: "kine"
disablesourceinput: true
spec:
file: "Dockerfile.dapper"
matchpattern: 'go install golang\.org\/x\/tools\/cmd\/goimports@(.*)'
replacepattern: 'go install golang.org/x/tools/cmd/goimports@{{ source `latestGoImportsHash` }}'
updateDockerfileTag:
name: "Update the tag in Dockerfile.dapper"
kind: "file"
scmid: "kine"
disablesourceinput: true
spec:
file: "Dockerfile.dapper"
matchpattern: '# go imports version gopls\/v\d*\.\d*\.\d*'
replacepattern: '# go imports version {{ source `latestGoImportsTag` }}'

# create a pull request which isn't allowed to automerge
actions:
github:
kind: "github/pullrequest"
scmid: "kine"
spec:
automerge: false
draft: false
mergemethod: squash