Jenkins : Abandoned: Preview for Copy Artifact 2.0

 

This page explains new features and changes of copyartifact-2.0 I plan.
The work is in progress at https://github.com/jenkinsci/copyartifact-plugin/pull/71 and https://github.com/ikedam/copyartifact-plugin/tree/feature/JENKINS-24892_CopyArtifact2.0 .

Screenshots

  • The configuration page of copyArtifact 1.x (current)
  • The configuration page of copyArtifact 2.0 (new)

Purpose of copyartifact-2.0

  • New features breaking compatibilities.
    • There are many issues for copyartifact (JIRA), but it's not easy to fix them without breaking compatibilities.
  • Easy to extend
    • Introduces more flexible design to make it easy to extend features (that is, extendable without breaking compatibilities)

Problems in copyartifact-1.x

  • Inconsistent / incomplete permission checks (JENKINS-28247, JENKINS-24888, JENKINS-23475)
    • Checks permissions at configuration time when projects are specified without variables.
    • Checks permissions at runtime when projects are specified with variables.
    • This results following problems:
      • Hard for users to understand the behavior.
      • Cannot check permissions for WorkflowJobs.
      • Can bypass permission checks using WebAPI / CLI.
    • Designed like this as legacy Jenkins doesn't provide authorizing mechanisms for builds.
  • Cannot configure complicated conditions for selecting builds (JENKINS-28206)
    • Cannot use different selectors together.
  • Few diagnostic messages (JENKINS-11336, JENKINS-24889)
  • Doesn't support ArtifactManager (JENKINS-22637, JENKINS-17494)
    • Can copy artifacts only archived with "Archive Artifacts" built in Jenkins core.
  • Difficult to add new features preserving binary compatibilities.
    • Adding new parameters breaks binary compatibilities.
    • There are plugins depending on copyartifact and they gets broken when broken binary compatibilities.

New features of copyartifact-2.0

  • Build-filter based configuration (JENKINS-24890)
    • You can specify additional conditions to builds selected by a build selector.
    • You can use multiple filters together.
    • This enables you to select a build like this: Latest one that is stable, a downstream of build A, and built with a build parameter P=blahblah...
  • Fallback build selector (JENKINS-24886)
    • You can specify to try multiple selectors consequently.
  • You can select a "Copy Operation" which decides what to do for the selected build.
    • This is introduced as ArtifactManager based on VirtualFile is incompatible with the existing artifact mechanism based on FilePath.
    • See #Copy Operation for details.
  • More console outputs.
    • Selectors and filters can output console logs.
    • You can check "Debug output" to enable diagnostic logs.

Design of copyartifact-2.0

Compatibility

Automatic configuration migration

Old-style build selectors

  • Some plugins provide their own build selectors. Those build selectors are based on the design of copyartifact-1.0.
  • Copyartifact-2.0 tries to handle those selectors in the legacy way.
  • Though this should work almost all cases as expected, some selectors doesn't work correctly.
    • Especially for a case a selector specifies to copy files from its own source, like WorkspaceSelector. In that case, the plugin should provide its own Copy Operation.

Built-in Components in copyartifact-2.0

Build Selector

Build Selector

New in 2.0

Behavior

FallbackBuildSelector

x

Tries build selectors (and additional filters) consequently.

ParameterizedBuildSelector

 

Decides a selector to use at runtime from the build parameter.

PermalinkBuildSelector

 

Specifies a build with a permalink.

SpecificBuildSelector

 

Specifies a build with its build number or build name

StatusBiuldSelector

 

Selects builds with specific statuses.

TriggeringBuildSelector

 

Selects builds triggering this build (renamed from TriggeredBuildSelector removing its fallbacking behavior.)

Build Filter

Standard Build Filter

Build Filter

New in 2.0

Behavior

DownstreamBuildFilter

x

Accepts builds that are downstream of a specified build.

NoBuildFilter

x

Accepts any builds. Does nothing and the default filter.

ParametersBuildFilter

 

Accepts builds with specified build parameters.

ParameterizedBuildFilter

x

Decides a filter to use at runtime from the build parameter.

SavedBuildFilter

x

Accepts builds marked "keep forever". (was SavedBuildSelector)

Logical Build Filter

Build Filter

New in 2.0

Behavior

AndBuildFilter

x

Accepts builds that suffice all of underlying filters.

NotBuildFilter

x

Reverts the result of another filter.

OrBuildFilter

x

Accepts builds that suffice any of underlying filters.

Copy Operation

Copy Operation

Behavior

Copy artifact files

copy artifacts from generic ArtifactManager. This doesn't preserver file modes and symbolic links (as VirtualFile doesn't provide that feature). Doesn't support exclude filters.

Copy legacy artifact files

copy artifacts from StandardArtifactManager (works as copyartifact-1.0). This is not exposed in UI. Copy artifact files automatically switches to this internally. Support exclude filters.

Copy files from workspace

copy files from workspace of the selected build (works as WorkspaceSelector in copyartifact-1.0)

Incompatibilities and Known issues

Incompatibilities

For users

  • Permission checks are performed only at runtime.
    • Builds may fail if you don't configure appropreate runtime authorizations.

For plugins and developers

  • Copier is removed.
    • Use CopyArtifactOperation instead.
    • As long as I know, there's no plugins depending on Copier.
  • BuildSelector#getSourceDirectory is removed.
    • Use CopyArtifactOperation instead.
    • As long as I know, there's no plugins depending on BuildSelector#getSourceDirectory.

Known issues

  • TriggeringBuildSelector may cause performance issues.
    • It tracks and lists all upstream builds to enumerate upstream builds.
    • Generator pattern should be useful for this case but I couldn't find common and reliable implementation for that.
    • This would be complicated and I plan to fix this after beta releases.
  • Less compatibility for generic artifact managers (VirtualFile)
    • Doesn't support
      • Exclude filters.
      • Symbolic links.
      • File modes.
    • I plan to contribute core to have VirtualFile support these features.

Attachments:

copyartifact-1.x.png (image/png)
copyartifact-2.0.png (image/png)