This plan is abandoned.
See https://groups.google.com/d/msg/jenkinsci-dev/2kbMx_wDSbA/6C0Sr2eVDQAJ for more details.
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)
- There's no method to invest causes for unexpected behaviors (JENKINS-16019, JENKINS-16139, JENKINS-17570).
- 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
- Parameter-carrying object (context)
- Copyartifact-2.0 uses context classes (CopyArtifactCommonContext, CopyArtifactPickContext, CopyArtifactOperationContext) to pass parameters to components like build selectors, build filters and copy operations.
- This enables add new parameters in future releases of copyartifact without breaking binary compatibilities.
Compatibility
Automatic configuration migration
- Copyartifact-2.0 tries to interpret and upgrade configurations of copyartifact-1.0 as possible.
Selectors deprecated in copyartifact-2.0 extends Version1BuildSelector and the configuraion will be automatically replaced with a combination of another selector, build filters and copy operations like this:
Deprecated selector
New selector
Filters
Copy operation
TriggeredBuildSelector (without fallback)
TriggeredBuildSelector (with fallback)
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
New in 2.0 | Behavior | |
---|---|---|
x | Tries build selectors (and additional filters) consequently. | |
| Decides a selector to use at runtime from the build parameter. | |
| Specifies a build with a permalink. | |
| Specifies a build with its build number or build name | |
| Selects builds with specific statuses. | |
| Selects builds triggering this build (renamed from TriggeredBuildSelector removing its fallbacking behavior.) |
Build Filter
Standard Build Filter
New in 2.0 | Behavior | |
---|---|---|
x | Accepts builds that are downstream of a specified build. | |
x | Accepts any builds. Does nothing and the default filter. | |
| Accepts builds with specified build parameters. | |
x | Decides a filter to use at runtime from the build parameter. | |
x | Accepts builds marked "keep forever". (was SavedBuildSelector) |
Logical Build Filter
New in 2.0 | Behavior | |
---|---|---|
x | Accepts builds that suffice all of underlying filters. | |
x | Reverts the result of another filter. | |
x | Accepts builds that suffice any of underlying filters. |
Copy Operation
Behavior | |
---|---|
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 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 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.
- Doesn't support