XML

kind: xml

sourceconditiontarget

Description

source

The XML "source" retrieves an information from a XML file using a XPATH query.

condition

The XML "condition" tests that an information exist in a XML file using a XPATH query.

target

The XML "target" ensures that a XML file content a specific value location in the XPATH location.

Parameters

NameTypeDescriptionRequired
filestring

“file” define the xml file path to interact with.

	compatible:
		* source
		* condition
		* target

	remark:
		* scheme "https://", "http://", and "file://" are supported in path for source and condition
pathstring

“path” defines the xpath query used for retrieving value from a XML document

	compatible:
		* source
		* condition
		* target

	example:
		* path: "/project/parent/version"
		* path: "//breakfast_menu/food[0]/name"
		* path: "//book[@category='WEB']/title"
valuestring

“value” is the value associated with a xpath query.

	compatible:
		* source
		* condition
		* target

	default:
		when used from a condition or a target, the default value is set to linked source output

Xpath

Under construction, some help would be need to document common xpath query that work with Updatecli https://www.w3.org/TR/1999/REC-xpath-19991116/

Example

# updatecli.yaml
name: Show a set of xml resources as a generic example

scms:
  ircbot:
    kind: git
    spec:
      url: https://github.com/olblak/ircbot.git
      branch: master

sources:
  parentVersion:
    name: Get parent version from pom.xml
    scmid: ircbot
    kind: xml
    spec:
      file: pom.xml
      path: "/project/parent/version"

conditions:
  parent-version:
    name: Test if parent version is set to source output
    kind: xml
    sourceid: parentVersion
    scmid: ircbot
    spec:
      file: pom.xml
      path: "/project/parent/version"
  artifactid:
    name: Test if parent artifactId is set to jenkins
    kind: xml
    scmid: ircbot
    disablesourceinput: true
    spec:
      file: pom.xml
      path: "/project/parent/artifactId"
      value: "jenkins"

targets:
  parent-version:
    name: Test if parent version is set to source output
    kind: xml
    sourceid: parentVersion
    scmid: ircbot
    spec:
      file: pom.xml
      path: "/project/parent/version"
  artifactid:
    name: Test if parent artifactId is set to jenkins
    kind: xml
    scmid: ircbot
    disablesourceinput: true
    spec:
      file: pom.xml
      path: "/project/parent/artifactId"
      value: "donotjenkins"

Top