Source
Source define the 'what' you want to update
On this page
Description
The "source" stage retrieves information from a third "resource" like a file, or an API and then uses that information in later stages.
Parameters
Name | Type | Description | Required |
---|---|---|---|
dependson | array | "dependson" allows to specify the order of execution of resources It accepts a list of rules like "(resourceType#)resourceId(:booleanOperator)" The resourceType is optional and can be one of "condition", "source" or "target" By default the resourceType is the current resource type The resourceId is the name of the resource to depend on The booleanOperator is optional and can be "AND" or "OR" examples: dependson: - condition#myCondition:and - source#mySource remarks: The parameters "sourceid" and "conditionsids" affect the order of resource execution. To avoid circular dependencies, the depended resource may need to remove any conditionids or set "disablesourceinput to true". | |
kind | string | kind specifies the sources resource kind | |
name | string | name specifies the resource name | |
scmid | string | scmid specifies the scm configuration key associated to the current resource | |
spec | object | spec specifies parameters for a specific sources kind | |
transformers | array | transformers defines how the default input value need to be transformed | |
addprefix | string | AddPrefix adds a prefix to the transformer input value | |
addsuffix | string | AddSuffix adds a suffix to the transformer input value | |
find | string | Find searches for a specific value if it exists and return false if it doesn't | |
findsubmatch | object | Find searches for a specific value if it exists then return the value using regular expression | [pattern] |
replacer | object | Replacer specifies what value needs to be changed and how | [from to] |
replacers | array | Replacers specifies a list of replacer instruction | |
semverinc | string | SemvVerInc specifies a comma separated list semantic versioning component that needs to be upgraded. | |
trimprefix | string | TrimPrefix removes a prefix to the transformer input value | |
trimsuffix | string | TrimSuffix removes the suffix from the transformer input value |
Example
updatecli.yaml
sources:
latestVersion:
name: Get latest Venom release
kind: githubRelease
spec:
owner: ovh
repository: venom
# Value from environment variable '$UPDATECLI_GITHUB_TOKEN'
token: '{{ requiredEnv "UPDATECLI_GITHUB_TOKEN" }}'
# Value from environment variable '$UPDATECLI_GITHUB_ACTOR'
username: '{{ requiredEnv "UPDATECLI_GITHUB_ACTOR" }}'
versioning:
kind: semver
transformers:
- addPrefix: "v"
In this example we’re looking for the latest release tag from https://github.com/jenkinsci/jenkins which is 'jenkins-2.75'. Unfortunately, it contains the prefix "jenkins" which is not required for later stages, so we remove 'jenkins-' so the output of the source becomes "jenkins/jenkins:2.275-jdk" which is a valid docker image name This can now be used in the later stages.