Get job's configuration

get

/v1/yaml/jobs/{jobName}

Returns job configuration in YAML format

Request

Path Parameters
Back to Top

Response

Supported Media Types

200 Response

{job config in YAML}

400 Response

ERROR: Job {jobName} no longer exists

401 Response

ERROR: Access to private job {jobIdentifier} not allowed
Back to Top

Examples

In general, a generated YAML job can be used as a job declaration in the same project, with the following caveats:
  • The job name must be changed or it will conflict with the existing job in the project.
  • Password values, shown in the example as "********", must be replaced.
If the generated YAML is used as a job declaration in a different project, the vm-template may not be available in the new project, and must be replaced.

Two examples are shown. Both return YAML definitions of named jobs. Ordinarily, job attributes are not shown unless they are different than the defaults, but an exception is made for the versions version-map, which displays all settable values.

The first example shows how to get the YAML definition for job AppExtVBDemo-Deploy, by submitting an implicit GET request on the REST resource using curl.

~$ curl -u alex.admin https://myinstance.mycompany.com/myorg/rest/myorg_bobtest_1/cibuild/v1/yaml/jobs/AppExtVBDemo-Deploy
Enter host password for user 'alex.admin':
job: 
  name: AppExtVBDemo-Deploy
  description: "Hand-configured YAML job for deploying an app extension"
  vm-template: free
  params: 
  - string: 
      name: VERSION
      value: 3.3.1
      description: App Extension Version
  before: 
  - copy-artifacts: 
      from-job: AppExtVBDemoYAML-Package
  steps: 
  - oracle-deployment: 
      environment-name: NathanEnv
      service-name: FA Resource ADFCDR03
      user-name: mary.jane
      password: "********"
      build-artifact: extension.vx
  settings: 
  - versions: 
      version-map: 
        Java: 8
        nodejs: 10
        python3: 3.6
        soa: 12.2.1.1

The second example shows how to get the YAML definitions for two related jobs, CopyArtifactsIn and CopyArtifactsOut, by submitting implicit GET requests on the REST resources using two curl commands. In some cases, like this one, the YAML versions of job declarations may be easier to understand than their GUI counterparts, because you can see all of the details of the configuration at once, instead of looking through multiple tabs in more than one job.

~$ curl -u alex.admin https://myinstance.mycompany.com/myorg/rest/myorg_bobtest_1/cibuild/v1/yaml/jobs/CopyArtifactsOut
Enter host password for user 'alex.admin':
job: 
  name: CopyArtifactsOut
  vm-template: free
  steps: 
  - shell: 
      script: "echo \"Hello, World!\" > file.txt"
  after: 
  - artifacts: 
      include: "*.txt"
  settings: 
  - versions: 
      version-map: 
        Java: 8
        nodejs: 10
        python3: 3.6
        soa: 12.2.1.1

~$ curl -u alex.admin https://myinstance.mycompany.com/myorg/rest/myorg_bobtest_1/cibuild/v1/yaml/jobs/CopyArtifactsIn
Enter host password for user 'alex.admin':
job: 
  name: CopyArtifactsIn
  vm-template: free
  before: 
  - copy-artifacts: 
      from-job: CopyArtifactsOut
      which-build: UPSTREAM_BUILD
      last-successful-fallback: false
  steps: 
  - shell: 
      script: "cat file.txt # copied from previous job"
  settings: 
  - versions: 
      version-map: 
        Java: 8
        nodejs: 10
        python3: 3.6
        soa: 12.2.1.1
Back to Top