Jenkins

kind: jenkins

sourceconditiontarget

Description

source

The jenkins "source" retrieves the latest version for a specific Jenkins release

condition

The jenkins "condition" test that a version exists and also that the version corresponds to a specific release type

Parameters

NameTypeDescriptionRequired
releasestring[s][c] Defines the release name. It accepts “stable” or “weekly”
versionstring[s][c] Defines a specific release version (condition only)

How to create a Github Personal Access Token Doc

Example

In the following example, we want to update a valid Jenkins Docker Image tag inside a yaml each time a new jenkins weekly release is published. But before we do, we need to validate few assumptions:

  1. A valid docker image has been published

  2. Our infrastructure uses the correct docker image name

  3. A that the version we are going to install a weekly release

To apply this update strategy, we can run the following command

updatecli --config updatecli.yaml --values values.yaml

# updatecli.yaml
name: Example with Jenkins resource

scms:
  default:
    kind: git
    spec:
      url: "git@github.com:alice/example.git"
      branch: master
      user: alice
      email: alice@example.com

sources:
  lastWeeklyRelease:
    # Get latest jenkins weekly version with changelog from github
    kind: jenkins
    spec:
      release: weekly

conditions:
  # Test that a specific Jenkins version exists
  jenkinsVersion:
    kind: jenkins
    spec:
      version: "2.275"

  # Test that the version from source is a weekly release
  jenkinsWeekly:
    kind: jenkins
    spec:
      release: weekly

  # Test that our yaml file is correctly set to a jenkins image
  imageTag:
    name: "jenkins/jenkins docker image set"
    kind: yaml
    spec:
      file: "charts/jenkins/values.yaml"
      key: "jenkins.controller.image"
      value: "jenkins/jenkins"
    scmid: default

  # Test that there is a docker image with the correct tag
  # set to "<version>-jdk11"
  dockerimage:
    kind: dockerimage
    spec:
      image: jenkins/jenkins
    transformers:
      - addsuffix: "-jdk11"

targets:
  imageTag:
    name: "jenkins/jenkins docker tag"
    kind: yaml
    spec:
      file: "charts/jenkins/values.yaml"
      key: "jenkins.controller.tag"
    transformers:
      - addsuffix: "-jdk11"
    scmid: default
# updatecli.yaml
---
github:
  token: ENVIRONMENT_VARIABLE_NAME
  username: alice
Top