Maven Repository

kind: maven

sourceconditiontarget

Description

source

The maven "source" retrieves the latest version from a maven repository

condition

The maven "condition" tests if a version exist on a maven repository.

Parameters

NameTypeDescriptionRequired
artifactidstringSpecifies the maven artifact artifactID
groupidstringSpecifies the maven artifact groupID
repositoriesarrayRepositories specifies a list of Maven repository where to look for version. Order matter, version is retrieve from the first repository with the last one being Maven Central.
repositorystringSpecifies the maven repository url + name
urlstringDeprecated, please specify the Maven url in the repository
versionstringSpecifies the maven artifact version
Note
Url can contain Basic Auth credentials following the standard notation: username:password@url

Example

# updatecli.yaml
name: Example with Maven resource

scms:
  default:
    kind: git
    spec:
      url: "git@github.com:olblak/charts.git"
      branch: master
      user: olblak
      email: me@olblak.com
      directory: "/home/olblak/Project/Jenkins-infra/charts"

sources:
  default:
    kind: maven
    spec:
      url: "repo.jenkins-ci.org"
      repository: "releases"
      groupid: "org.jenkins-ci.main"
      artifactid: "jenkins-war"
    transformers:
      - addsuffix: "-jdk11"

conditions:
  docker:
    name: "Test Docker Image Published on Registry with the correct tag"
    kind: "dockerimage"
    spec:
      image: "jenkins/jenkins"
  imageTag:
    name: "Test if jenkins/jenkins docker image used"
    scmid: default
    kind: yaml
    spec:
      file: "charts/jenkins/values.yaml"
      key: "jenkins.master.image"
      value: "jenkins/jenkins"

targets:
  imageTag:
    name: "jenkins/jenkins docker tag"
    kind: yaml
    scmid: default
    spec:
      file: "charts/jenkins/values.yaml"
      key: "jenkins.master.imageTag"

What it says:

Sources

Retrieve the version from a Maven source for the artifactID "jenkins-war" from the group "org.jenkins-ci.org" in the repository "releases" located on "repo.jenkins-ci.org" ⇒ 2.264 Append "jdk11" to it ⇒ 2.264-jdk11

Conditions

Then it tests two conditions:

  1. Do we have a docker image published on Dockerhub for the "jenkins/jenkins" using the tag "2.264-jdk11"? Yes, proceed, No then abort

  2. Do we have a the key jenkins.master.image set to the value "jenkins/jenkins" from the file "charts/jenkins/values.yaml" located on the git repository "git@github.com:olblak/charts.git"? ⇒ Yes, proceed, No then abort

Targets

If conditions are all met then updatecli updates, if necessary, the key "jenkins.master.imageTag" to "2.264-jdk11" for the file "charts/jenkins/values.yaml" from the git repository "git@github.com:olblak/charts.git" then commit the change to the branch master.

Top