Golang go.mod

kind: golang/gomod

Description

The golang/gomod Autodiscovery plugin allows to automatically search and update go.mod files. It handles golang version update and golang module version update.

Manifests

Parameters

NameTypeDescriptionRequired
ignorearrayignore allows to specify “rule” to ignore autodiscovery a specific go.mod rule
    goversionstringGoVersions specifies a list of version pattern.
    modulesobjectModules specifies a list of module pattern.
    pathstringPath specifies a go.mod path pattern, the pattern requires to match all of name, not just a substring.
onlyarrayonly allows to specify rule to “only” autodiscover manifest for a specific golang rule
    goversionstringGoVersions specifies a list of version pattern.
    modulesobjectModules specifies a list of module pattern.
    pathstringPath specifies a go.mod path pattern, the pattern requires to match all of name, not just a substring.
rootdirstringrootDir defines the root directory used to recursively search for golang go.mod
versionfilterobject

versionfilter provides parameters to specify the version pattern to use when generating manifest.

	kind - semver
		versionfilter of kind `semver` uses semantic versioning as version filtering
		pattern accepts one of:
			`patch` - patch only update patch version
			`minor` - minor only update minor version
			`major` - major only update major versions
			`a version constraint` such as `>= 1.0.0`

	kind - regex
		versionfilter of kind `regex` uses regular expression as version filtering
		pattern accepts a valid regular expression

	example:
	```
		versionfilter:
			kind: semver
			pattern: minor
	```

	and its type like regex, semver, or just latest.
    kindstringspecifies the version kind such as semver, regex, or latest
    patternstringspecifies the version pattern according the version kind
    strictbooleanstrict enforce strict versioning rule. Only used for semantic versioning at this time
⚠ This table is generated from the Updatecli codebase and may contain inaccurate data. Feel free to report them on github.com/updatecli/updatecli

Example

Golang update only

In the following example, we want to automate minor version update of Golang, such as from "1.19" to "1.20" If Updatecli detects a change, then it opens a new pullrequest with the propose version update.

# updatecli.d/default.yaml
name: "Bump Golang Version"
scms:
  default:
    kind: github
    spec:
      owner: olblak
      repository: updatecli
      token: {{ requiredEnv "GITHUB_TOKEN" }}
      username: {{ requiredEnv "GITHUB_ACTOR" }}
      branch: main

actions:
    default:
        kind: github/pullrequest
        scmid: default
        spec:
          labels:
            - "dependencies"

autodiscovery:
  scmid: default
  actionid:  default
  crawlers:
    golang/gomod:
      versionfilter:
        kind: semver
        pattern: minor
      only:
        - goversion: "*" 

Semantic version patch update only

In this example, Updatecli is looking for all version that can have a patch version update. If at least one version needs to be updated, then it opens a single pullrequest with all the version bump.

# updatecli.d/default.yaml
name: "Bump Patch version for Golang module"
scms:
  default:
    kind: github
    spec:
      owner: olblak
      repository: updatecli
      token: {{ requiredEnv "GITHUB_TOKEN" }}
      username: {{ requiredEnv "GITHUB_ACTOR" }}
      branch: main

actions:
    default:
        # The action title is used to define the pullrequest title
        # Since we use the groupby set to all we need to be sure that the pullrequest title
        # is the same for all the pipeline generated by autodiscovery.
        title: Bump Patch version for Golang module
        kind: github/pullrequest
        scmid: default
        spec:
          labels:
            - "dependencies"

autodiscovery:
  scmid: default
  actionid:  default
  groupby: all 
  crawlers:
    golang/gomod:
      versionfilter:
        kind: semver
        pattern: patch
      ignore:
        - modules:
            # Ignoring the following modules as they do not publish release
            github.com/ProtonMail/go-crypto:
            # Ignoring the following modules as they do not publish release
            github.com/shurcooL/githubv4:
            # Ignore module using version matching constraint 1.x
            helm.sh/helm/v3: "1.x"
            # The remote version uses the version v0.0.0-20190318233801-ac98e3ecb4b0 which do not exists anymore
            # the patch version will try to fetch the version matching 0.0.x and finds nothing 
            github.com/iancoleman/orderedmap:
            # Same for https://pkg.go.dev/golang.org/x/time?tab=versions
            golang.org/x/time:

Top