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
githubobject[owner repository token username]
    branchstringBranch specifies which github branch to work on
    commitmessageobjectCommitMessage represents conventional commit metadata as type or scope, used to generate the final commit message.
    directorystringDirectory specifies where the github repository is cloned on the local disk
    emailstringEmail specifies which emails to use when creating commits
    forcebooleanForce is used during the git push phase to run `git push --force`.
    gpgobjectGPG key and passphrased used for commit signing
    ownerstringOwner specifies repository owner
    pullrequestobjectDeprecated since https://github.com/updatecli/updatecli/issues/260, must be clean up
    repositorystringRepository specifies the name of a repository for a specific owner
    tokenstringToken specifies the credential used to authenticate with
    urlstringURL specifies the default github url in case of GitHub enterprise
    userstringUser specifies the user of the git commit messages
    usernamestringUsername specifies the username used to authenticate with Github API
releasestringDefines the release name like latest or weekly
versionstringDefines 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
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