# Jenkins<no value>

// <!-- Required for asciidoctor -->
:toc:
// Set toclevels to be at least your hugo [markup.tableOfContents.endLevel] config key
:toclevels: 4

[cols="1^,1^,1^",options=header]
|===
| source | condition | target
| &#10004; | &#10004; | &#10007;
|===

== Description

The `jenkins` resource reads the Jenkins release metadata from `https://repo.jenkins-ci.org/releases/org/jenkins-ci/main/jenkins-war/maven-metadata.xml` and returns a version from it.

**source**::
Returns the latest version of the requested release line.

**condition**::
Checks that `version` exists *and* that it belongs to the release line named by `release`.

**target**::
Not supported - a target fails with `Target not supported for the plugin Jenkins`.

NOTE: An `scm` attached to a condition is ignored, with the warning `SCM configuration is not supported for Jenkins condition`.

== Parameters

{{< resourceparameters "sources" "jenkins" >}}

`release`:: Either `stable` or `weekly`.
`version`:: Condition only - the version being checked.

== Release lines

The release line is derived from the *shape* of the version number, by counting dot-separated components:

[cols="1,1,2",options=header]
|===
| Components | Release | Example
| 2 | `weekly` | `2.426`
| 3 | `stable` (LTS) | `2.426.1`
|===

Anything else is rejected (a non-numeric component gives `in version '<v>', component '<c>' is not a valid integer`, and any other count gives `version <v> contains <n> component(s) which doesn't correspond to any valid release type`).

This is what makes the condition useful: it does not merely check that a version was published, it checks that you are not about to install a weekly where you meant an LTS.

== Example

In the following example we want to update a Jenkins Docker image tag inside a YAML file each time a new Jenkins weekly release is published, but only after validating that:

. a matching Docker image has been published;
. the infrastructure uses the expected image name;
. the version really is a weekly release.

[source,shell]
----
updatecli apply --config updatecli.yaml --values values.yaml
----

[source,yaml]
----
# updatecli.yaml
{{<include "assets/code_example/docs/plugins/resources/jenkins/updatecli.d/default.yaml">}}
----

[source,yaml]
----
# values.yaml
{{<include "assets/code_example/docs/plugins/resources/jenkins/values.yaml">}}
----

== Links

* link:https://www.jenkins.io/download/lts/[Jenkins LTS release line]
