k3s-io / kine

Run Kubernetes on MySQL, Postgres, sqlite, dqlite, not etcd.
Apache License 2.0
1.54k stars 231 forks source link

Add goimports config #181

Closed matttrach closed 1 year ago

matttrach commented 1 year ago

This add a config to get the latest goimports release, update the tag name in the comment and update the commit hash in the go get line of the Dockerfile.

matttrach commented 1 year ago

Here is my test data:

command$# updatecli diff -v updatecli/values.yaml -c updatecli/updatecli.d/dockerfile_dapper_goimports.yml 

+++++++++++
+ PREPARE +
+++++++++++

Loading Pipeline "updatecli/updatecli.d/dockerfile_dapper_goimports.yml"

SCM repository retrieved: 2

++++++++++++++++++
+ AUTO DISCOVERY +
++++++++++++++++++

++++++++++++
+ PIPELINE +
++++++++++++

#############################################################
# UPDATE THE VERSION OF GOIMPORTS USED IN DOCKERFILE.DAPPER #
#############################################################

SOURCES
=======

latestGoImportsHash
-------------------
Searching for version matching pattern "^gopls\\/v\\d*\\.\\d*\\.\\d*$"
✔ Git tag "611cff71b9afeb81ae6eb16c5ce9376c051b1828" found matching pattern "^gopls\\/v\\d*\\.\\d*\\.\\d*$"

latestGoImportsTag
------------------
Searching for version matching pattern "^gopls\\/v\\d*\\.\\d*\\.\\d*$"
✔ Git tag "gopls/v0.11.0" found matching pattern "^gopls\\/v\\d*\\.\\d*\\.\\d*$"

CONDITIONS:
===========

testHashShouldMatch
-------------------
✗ Content of the file "Dockerfile.dapper" did not match the pattern "go install golang\\.org\\/x\\/tools\\/cmd\\/goimports@611cff71b9afeb81ae6eb16c5ce9376c051b1828"
✗ Condition on file [] did not pass

TARGETS
========

updateDockerfileTag
-------------------

**Dry Run enabled**

⚠ updated the [dry run] content of the file "/tmp/updatecli/github/k3s-io/kine/Dockerfile.dapper"

--- /tmp/updatecli/github/k3s-io/kine/Dockerfile.dapper
+++ /tmp/updatecli/github/k3s-io/kine/Dockerfile.dapper
@@ -3,7 +3,7 @@
 ARG ARCH=amd64

 RUN apk -U add bash coreutils git gcc musl-dev docker-cli vim less file curl wget ca-certificates
-# go imports version gopls/v0.9.5
+# go imports version gopls/v0.11.0
 # https://github.com/golang/tools/releases/latest
 RUN go install golang.org/x/tools/cmd/goimports@8a9de1b095ae54649c1dc503f4f718779bddb55f
 RUN rm -rf /go/src /go/pkg

updateDockerfileHash
--------------------

**Dry Run enabled**

⚠ updated the [dry run] content of the file "/tmp/updatecli/github/k3s-io/kine/Dockerfile.dapper"

--- /tmp/updatecli/github/k3s-io/kine/Dockerfile.dapper
+++ /tmp/updatecli/github/k3s-io/kine/Dockerfile.dapper
@@ -5,7 +5,7 @@
 RUN apk -U add bash coreutils git gcc musl-dev docker-cli vim less file curl wget ca-certificates
 # go imports version gopls/v0.9.5
 # https://github.com/golang/tools/releases/latest
-RUN go install golang.org/x/tools/cmd/goimports@8a9de1b095ae54649c1dc503f4f718779bddb55f
+RUN go install golang.org/x/tools/cmd/goimports@611cff71b9afeb81ae6eb16c5ce9376c051b1828
 RUN rm -rf /go/src /go/pkg

 RUN if [ "${ARCH}" == "amd64" ]; then \

ACTIONS
========

[Dry Run] An action of kind "github/pullrequest" is expected.

=============================

REPORTS:

⚠ Update the version of goimports used in Dockerfile.dapper:
        Source:
                ✔ [latestGoImportsHash] Get commit hash of latest goimports tag (kind: gittag)
                ✔ [latestGoImportsTag] Get latest goimports tag (kind: gittag)
        Condition:
                ✔ [testHashShouldMatch] Hash should match latest tag's commit hash (kind: file)
        Target:
                ⚠ [updateDockerfileHash] Update the hash in Dockerfile.dapper (kind: file)
                ⚠ [updateDockerfileTag] Update the tag in Dockerfile.dapper (kind: file)

Run Summary
===========
Pipeline(s) run:
  * Changed:    1
  * Failed:     0
  * Skipped:    0
  * Succeeded:  0
  * Total:      1
matttrach commented 1 year ago

When this triggers it will more than likely generate a PR which updates goimports to v0.11.0

matttrach commented 1 year ago

This contributes to https://github.com/k3s-io/k3s/issues/7040