Description
Creating a job jenkins given an existing job
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| sourceJobName | string | Name of the source jenkins item | |
| targetJobName | string | Name of the target jenkins item |
Output Schema
No output schema defined for this action.
Usage Examples
Copy a seed Jenkins job for a new microservice pipeline
Create a Jenkins pipeline for a new service by copying a curated seed job. After fetching project files with fetch:template, this step copies seed-node-pipeline to a target named from the componentId.
steps:
- id: fetch-skeleton
action: fetch:template
input:
url: ./skeleton
targetPath: ./
values:
name: ${{ parameters.componentId }}
owner: ${{ parameters.owner }}
- id: copy-jenkins-job
action: jenkins:job:copy
input:
sourceJobName: seed-node-pipeline
targetJobName: ${{ parameters.componentId }}-pipelineCreate a branch-specific Jenkins job from a template
Copy a template job to provision a branch-specific build. Use this when setting up a pipeline for a repo’s default branch or a long-lived release branch as part of the scaffolding flow with fetch:template.
steps:
- id: fetch-base
action: fetch:template
input:
url: ./skeleton
targetPath: ./
values:
name: ${{ parameters.componentId }}
defaultBranch: ${{ parameters.defaultBranch }}
- id: copy-jenkins-job
action: jenkins:job:copy
input:
sourceJobName: ${{ parameters.jobTemplateName }}
targetJobName: ${{ parameters.componentId }}-${{ parameters.defaultBranch }}