Source

Source define the 'what' you want to update

Description

The "source" stage retrieve an information from a third "resource" like a file, an api and then inject that information in later stages.

Parameters

NameRequiredDefaultDescription

kind

-

Define the resource type used for the spec

name

-

Small description used in message, reports, etc.

prefix

-

-

Define the prefix to be added to the retrieved information.

postfix

-

-

Define the postfix to be added to the retrieved information.

replaces

-

-

A list of replacer rules that modify the information retrieved from the resource

scm

-

-

Define source control management parameters, cfr to the scm

spec

-

Define resource parameters, cfr to appropriated resource documentation

Replacer

A replacer rule modify the information by replacing the "from" value by the "to" value.

Parameters

NameRequiredDefaultDescription

from

-

"from" value defines the string that will be replaced

to

-

"to" value defines the string that we want to have

Example

updatecli.yaml
source:
  name: "Retrieve latest jenkins weekly version"
  kind: githubRelease
  prefix: "jenkins/jenkins:"
  postfix: "-jdk11"
  replaces:
    - from: "jenkins-"
      to: ""
  spec:
    owner: "jenkinsci"
    repository: "jenkins"
    token: "{{ requiredEnv .github.token }}"
    username: "{{ .github.username }}"
    version: "latest"

## To be continued

In this example we are 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 useless for later stages, so we replace 'jenkins-' by nothing so the output of the source becomes "jenkins/jenkins:2.275-jdk" which is a valid docker image that can now be used in the later stages.

Edit this page on GitHub