Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add In Review, Verified

...

  • It makes a new job from an existing job.
    • You can copy multiple jobs in one build execution with specifying multiple Copy Job build steps.
    • Can be applied to any type of jobs.
  • You specify following parameters.
    • From Job Name
      • Variable expressions can be used.
    • To Job Name
      • Variable expressions can be used.
    • Overwrite
      • Specifies whether to overwrite the destination job if it already exists.
  • Additional operations can be performed when copying.
    • Enable Job: Enabling the destination job if the source job is disabled.
    • Disable Job: Disabling the destination job if the source job is enabled. ( >= 1.3.0)
    • Replace String: Replace strings in a job configuration.
      • Source and destination strings can contain variable expressions.
  • Additional operation can be extended by using Extension Points.

Limitations

...

Screenshots

  1. You can add "Copy Job

...

Screenshots

TODO

  1. " build step.
    Image Added
  2. "Copy Job" performs additional operations. Replacing strings in the configuration, enabling a disabled job.
    • The job copied from
      Image Added
    • The job copied to. String "VERSION" is replaced, and the job is enabled.
      Image Added
  3. Replacing strings can be applied to any part of configurations, including that of plugins. This is a example that the branch field of Git plugin is replaced.
    • The job copied from.
      Image Added
    • The job copied to. String "VERSION" is replaced.
      Image Added

How does this work?

This plugin works as following:

...

A new way to provide choices can be added with implementing JobcopyOperation, overriding the following method:

Code Block

public String perform(String xmlString, String encoding, EnvVars env, PrintStream logger);

or, with extending AbstractXmlJobcopyOperation, overriding the following method:

Code Block

abstract public Document perform(Document doc, EnvVars env, PrintStream logger);

Change Log

TODO

Used with promoted builds

When used with Promoted Builds Plugin, the configurations of promotions are not copied for they are not stored in config.xml.
Do as followings:

  • Click "Advanced" in "copy Job"
  • Add "Additional File Sets", specify "promotions/*/config.xml" in "Files".

Permissions to copy jobs

  • "Copy Job" build step requires following permissions.

    Target Job

    Required permissions

    Notes

    Item to copy from

    Job/Read, Job/ExtendedRead

    Job/ExtendedRead is displayed only when you install Extended Read Permission Plugin. You can grant it by granting Job/Configure instead.

    Item to copy to (when create)

    Job/Create

     

    Item to copy to (when overwrite)

    Job/Read, Job/Configure

     

  • "Copy Job" is run as ANONYMOUS as default.

Issues

To report a bug or request an enhancement to this plugin please create a ticket in JIRA (you need to login or to sign up for an account). Also have a look on How to report an issue

Jira
serverJenkins JIRA
columnskey,type,priority,summary
maximumIssues1000
jqlQueryproject = JENKINS AND status in (Open, "In Progress", Reopened, "In Review", Verified) AND component = 'jobcopy-builder-plugin'
serverIddd058dce-0c66-3b77-8b09-71b1d7728747

Change Log

Version 1.4.0 (Jul 24, 2016)

  • Targets Jenkins 1.532. (was 1.480.3 till 1.3.0)
  • Improved permission checks (JENKINS-36672)
    • Jobcopy build step is authorized as anonymous when the build is run as SYSTEM (that is, if not authorization for the job is not configured)
    • Requires EXTENTED_READ (or CONFIGURE) permission to read job configurations.
    • See #Permissions to copy jobs for details.

Version 1.3.0 (May 24, 2015)

Version 1.2.0 (Sep 11, 2014)

Version 1.1.2 (Dec 22, 2013)

  • FIXED: Build results page shows wrong link for Copied To and Copied From (JENKINS-21080)

Version 1.1.1 (Aug 31, 2013)

  • Fixed a problem with overwriting multi-configuration projects.
    • combination filter was not removed even when it is removed in the source project.

Version 1.1.0 (Feb 27, 2013)

  • Added advanced configuration to copy additional files.
    • Useful for plugins that does not store configurations in config.xml of the job.
    • For example, you can copy configurations of Promoted Builds Plugin.

Version 1.0.1 (Feb 06, 2013)

  • Improved overwrite behavior
    • Version 1.0.0: delete the old job, and create a new job. Also builds are deleted.
    • Version 1.0.1 and later: update the configuration. Builds are preserved.
  • expand "From Job Name" field

Version 1.0.0 (Jan 14, 2013)

  • Initial release.