Golang module
| source | condition | target |
|---|---|---|
✔ | ✔ | ✗ |
Description
The golang/module resource queries a Go module proxy for the published versions of a module.
- source
Returns the version matching
versionfilter.- condition
Checks that
versionis published for the module.- target
Not supported - a target fails with
Target not supported for the plugin GO module. To write the version into ago.mod, usegolang/gomod.
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| age | object | “age” defines the minimum or maximum age of a release to be considered valid. compatible:
remark:
example: | |
| maximum | string | “maximum” defines the maximum age a release may have to be considered. remark:
example:
| |
| minimum | string | “minimum” defines the minimum age a release must have to be considered. remark:
example:
| |
| module | string | “module” defines the name of the Go module. compatible:
example:
| |
| proxy | string | “proxy” defines the Go proxy to query, similar to the GOPROXY environment variable. compatible:
default: the GOPROXY environment variable when set, otherwise https://proxy.golang.org remark:
example:
| |
| version | string | “version” defines the module version to check. compatible:
default: the output of the associated source. example:
| |
| versionfilter | object | “versionfilter” defines the version pattern and its type, such as regex, semver or latest. compatible:
default: kind: semver pattern: “*” example: | |
| kind | string | “kind” defines the versioning scheme used to select a version. default: latest remark:
example:
| |
| pattern | string | “pattern” defines the version pattern, according to “kind”. default:
remark:
example:
| |
| regex | string | “regex” defines the regular expression extracting the version from each entry. remark:
example:
| |
| replaceall | object | “replaceall” applies a regular expression replacement to each version before filtering. remark:
example: turns “curl-8_15_0” into “curl-8.15.0”. | |
| strict | boolean | “strict” enforces strict semantic versioning rules when parsing versions. default: false remark:
|
moduleMandatory - the full module path, e.g.
github.com/updatecli/updatecli.proxyOverrides the proxy, the same way
GOPROXYdoes.httpsandhttpschemes are accepted, and a URL without a scheme is assumed to behttps.file://proxies are not supported.versionCondition only.
Pseudo-versions (the v0.0.0-20230101120000-abcdef123456 form Go generates for untagged commits) are understood.
Filtering by release age
age restricts which releases count as valid, which is the usual way to let a release settle before adopting it:
spec:
module: github.com/sirupsen/logrus
age:
minimum: "7d"minimum and maximum accept h, d, w, mo and y; a bare number means hours. An unparsable value fails with invalid MinimumReleaseAge "<value>".
Warning |
Versions whose date cannot be fetched or parsed are skipped silently - visible only with |
Example
# updatecli.yaml
name: "Golang module example"
sources:
default:
kind: golang/module
name: Get the latest Golang module version for github.com/Masterminds/semver/v3
spec:
module: "github.com/Masterminds/semver/v3"
semver:
kind: golang/module
name: Get Golang module version for github.com/Masterminds/semver/v3 matching version 3.2
spec:
module: "github.com/Masterminds/semver/v3"
versionfilter:
kind: semver
pattern: "3.2"
conditions:
default:
# The version is set by the sourceid "default"
kind: golang/module
name: Checks if version v3.2.0 exists for Golang module github.com/Masterminds/semver/v3
sourceid: default
spec:
module: "github.com/Masterminds/semver/v3"
noSourceInput:
disablesourceinput: true
kind: golang/module
name: Checks if version v3.2.0 exists for Golang module github.com/Masterminds/semver/v3
spec:
module: "github.com/Masterminds/semver/v3"
version: "v3.2.0"