Issue
- I want to get the CJP URI (
cjp:///
) of a particular item in my CJP cluster - I want to get the Jenkins URI (
jenkins://
) of a particular item in my CJP cluster
Environment
- CloudBees Jenkins Enterprise - Managed Master (CJEMM)
- CloudBees Jenkins Enterprise - Operations Center (CJEOC)
- CloudBees Jenkins Platform - Client Master (CJPCM)
- CloudBees Jenkins Platform - Operations Center (CJPOC)
- Operations Center Context Plugin
Resolution
There are currently 2 supported URI scheme in a CJP cluster:
- The
jenkins
scheme:jenkins://instanceId/path/to/folder
- The
cjp
scheme:cjp:///path/from/root/of/cjoc
There are used by cluster-wide operations to locate an item in a CJP cluster. These operations includes:
- Cluster-wide job triggers
- Cluster-wide copy artifacts
- Moving, Copying, or Promoting Items Using the Jenkins CLI
The URI can be constructed by building the names of each item which could be cumbersome and error-prone.
But there is a simpler way to retrieve the URI of an item inside a CJP cluster: the /platform-uri/
action.
Use the /platform-uri
action
An action is provided by the and returns the URI of an item for the scheme specified:
- You can append
/platform-uri?scheme=cjp
to an item URL to get the CJP URI of that item - You can append
/platform-uri?scheme=jenkins
to an item URL to get the Jenkins URI of that item
Example of a path of a specific master:
$ curl -u <user>:<password> -X GET https://my.dev.master.com/platform-uri/?scheme=cjp
cjp:///my-dev-master
$ curl -u <user>:<password> -X GET https://my.dev.master.com/platform-uri/?scheme=jenkins
jenkins://<instanceIdOfMyDevMaster>/
Example of a path of a specific Folder:
$ curl -u <user>:<password> -X GET https://my.dev.master.com/job/projectA/platform-uri/?scheme=cjp
cjp:///my-dev-master/projectA
$ curl -u <user>:<password> -X GET https://my.dev.master.com/job/projectA/platform-uri/?scheme=jenkins
jenkins://<instanceIdOfMyDevMaster>/projectA
Example of a path of a specific Job:
$ curl -u <user>:<password> -X GET https://my.dev.master.com/job/projectA/job/jobA/platform-uri/?scheme=cjp
cjp:///my-dev-master/projectA/jobA
$ curl -u <user>:<password> -X GET https://my.dev.master.com/job/projectA/job/jobA/platform-uri/?scheme=jenkins
jenkins://<instanceIdOfMyDevMaster>/projectA/jobA
0 Comments