Create Artifactory plugin procedures

7 minute readExtensibilityDeveloper productivity

Plugin procedures can be used in procedure steps, process steps, and pipeline tasks, allowing you to orchestrate third-party tools at the appropriate time in your component, application process, or pipeline.

Depending on your plugin configuration and how you run procedures, the Input parameters  Configuration name field may behave differently in the CloudBees CD/RO UI. For more information, refer to Differences in plugin UI behavior.

Get Latest Artifact Version

Performs a GAVC search in Artifactory for the specified artifact and saves the latest version to a property.

Input parameters

Table 1. Get Latest Artifact Version input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Repository package type

Required. The type of repository. NuGet, NPM, Maven, PHP, and generic repository types are supported.

Repository key

Required. Repository key. For example, nuget-local, libs-snapshot-local.

Organization path

Represents the Organization field, where the levels are separated by path separators (/), similar to Maven. For example, org/slf4j. This parameter is required if the path is mandatory for the layout. For example, in the layout [orgPath]/[module].[ext], the organization path is mandatory, but in the layout ([orgPath])/[module], it is not mandatory.

Artifact

Required. A sequence of literals that identifies the artifact’s module.

Classifier

A sequence of literals that identifies the artifact’s classifier. This parameter is required if the Repository Package Type is Maven.

Result Property

Required. Name or the property where the latest version is saved. The default is /myJob/ArtifactVersion.

Publish Artifact To Artifactory

Publishes a single artifact to the Artifactory instance. NuGet, NPM, Maven, PHP, and generic repository types are supported.

Input parameters

Table 2. Publish Artifact To Artifactory input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Repository package type

Required. The type of repository. NuGet, NPM, Maven, PHP, and generic repository types are supported.

Repository key

Required. Repository key. For example, nuget-local, libs-snapshot-local.

Use custom repository layout

If selected, custom repository layouts are used.

Organization path

Represents the organization path, separated by /, depending on the layout used. Required if you do not use custom repository layouts. For example, the layout [orgPath]/[module].[ext] expects an organization path, whereas the layout ([orgPath])/[module] does not. For example, org/slf4j.

Module

Required if you do not use custom repository layouts. A sequence of literals that identifies the artifact’s module. For example, slf4j-api.

Base revision

Required if you do not use custom repository layouts. A sequence of literals that identifies the base revision of the artifact version, excluding any integration information. For example, 1.5.10. Or in the case of an integration revision of 1.2-SNAPSHOT, the base revision is 1.2.

Folder integration revision

Required if you do not use custom repository layouts. A sequence of literals that identifies the integration revision used in directory names in the artifact’s path, excluding the base revision. For example, in the case of an integration revision 1.2-SNAPSHOT, the directory integration revision is SNAPSHOT.

File integration revision

Required if you do not use custom repository layouts. A sequence of literals that identifies the integration revision in the artifact’s file name, excluding the base revision. For example, in the case of an integration revision 1.2-20110202.144533-3, the file integration revision is 20110202.144533-3.

Classifier

Required if you do not use custom repository layouts. A sequence of literals that identifies the artifact’s classifier. For example, sources.

Extension

Required if you do not use custom repository layouts. A sequence of literals that identifies the artifact’s extension. For example, zip.

Artifact layout

Required if you use custom repository layouts. Layout path pattern used for artifact resolution and publication paths. For example, [orgPath]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext].

Artifact tokens

Required if you use custom repository layouts. Token path pattern used for artifact resolution. Tokens can consist of a combination of string literals, path separators, parentheses, and punctuation characters. For example, for artifact org/jfrog/test/multi1/3.7-SNAPSHOT/multi1-3.7-20190222.112918-1-sources.jar, the tokens are:

orgPath=org/jfrog/test module=multi1 baseRev=3.7 folderItegRev=SNAPSHOT fileItegRev=20190222.112918-1 classifier=sources ext=jar

Artifact path

Required. Path to the artifact binary on the resource file system. For example, /tmp/myartifact.zip.

Artifact properties

Artifact properties that facilitate searching them through JFrog "Smart Searches" For more information, refer to Property sets. Properties can be added in the following format:

key1=value1 key2=value2;value3;... ... keyN=valueN

Result property sheet

Required. Property sheet where procedure results are saved. Contains a record with the following fields in JSON format:

  • md5_checksum: MD5 checksum of the artifact.

  • sha1_checksum: SHA1 checksum of the artifact.

  • sha256_checksum: SHA256 checksum of the artifact.

  • path: Local path in Artifactory.

  • url: Link for downloading the artifact.

  • webapp_url: Link for browsing the artifact in Artifactory.

For example:

{ "md5_checksum":"c61b83072527864fe7171ea99b017438", "sha1_checksum":"b92e9d18bdb357d98c10c8074d3b9b6f63307efa", "sha256_checksum":"d16c4f6e565a0831c96fe0ce1a62694caba55dd5341b8d50aebf54cdf0effdbf", "path":"libs-snapshot-local/org/jfrog/test/multi1/3.7-SNAPSHOT/multi1-3.7-20190218.153526-1-tests.jar", "url":"http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi1/3.7-SNAPSHOT/multi1-3.7-20190218.153526-1-tests.jar", "webapp_url":"http://localhost:8081/artifactory/webapp/#/artifacts/browse/tree/General/libs-snapshot-local/org/jfrog/test/multi1/3.7-SNAPSHOT/multi1-3.7-20190218.153526-1-tests.jar", }

Output parameters

Table 3. Publish Artifact To Artifactory output parameters
Parameter Description

publishedArtifact

Output field where procedure results are saved and contain JSON-formatted fields.

Publish Multiple Artifacts To Artifactory

Publishes one or more artifacts whose Repository Package Type is Generic to Artifactory.

Input parameters

Table 4. Publish Multiple Artifacts To Artifactory input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Repository package type: Generic

Repository key

Required. Repository key. For example, generic-local, custom-local.

Use custom repository layout

If selected, custom repository layouts are used.

Organization path

Required if you don’t use custom repository layouts. Represents the Organization Path separated by / depending on the layout used. For example, the layout [orgPath]/[module].[ext] expects an organization path, whereas the layout ([orgPath])/[module] does not.

For example, org/slf4j.

For regex, .+?.

Module

Required if you don’t use Custom Repository Layouts. A sequence of literals that identifies the artifact’s module.

For example, slf4j-api.

For regex, [^/]+.

Base revision

Required if you do not use custom repository layouts. A sequence of literals that identifies the base revision part of the artifact version, excluding any integration information.

For example, 1.5.10, or in case of an integration revision 1.2-SNAPSHOT the base revision is 1.2.

For regex, [^/]+?.

Extension

Required if you do not use custom repository layouts. A sequence of literals that identifies the artifact’s extension.

For example, zip.

For regex, (?:(?!\d))[^-/]+|7z.

Artifact layout

Required if you use custom repository layouts. Layout path pattern used for artifact resolution and publication paths. For example, [orgPath]/[module]/[module]-[baseRev].[ext]

Artifact tokens

Required if you use custom repository layouts. Token path pattern used for artifact resolution. Tokens can consist of a combination of string literals, path separators, parentheses, punctuation characters etc. For example, for the layout <code>[orgPath]/[module]/[module]-[baseRev].[ext]</code>, the tokens are:

orgPath=org/jfrog/test module=multi1 baseRev=3.7 ext=jar.

Artifact directory

Required. Path to the artifact binary directory on the resource file system.<br/> For example, /tmp/myartifacts.

Artifact properties

Artifact properties that facilitate searching them through JFrog "Smart Searches" For more information, refer to Property sets. Properties can be added in the following format:

key1=value1 key2=value2;value3;... ... keyN=valueN

Result property sheet

Property sheet where procedure results are saved. Contains a record with the following fields in JSON format:

  • md5_checksum: MD5 checksum of the artifact.

  • sha1_checksum: SHA1 checksum of the artifact.

  • sha256_checksum: SHA256 checksum of the artifact.

  • path: Local path in Artifactory.

  • url: Link for downloading the artifact.

  • webapp_url: Link for browsing the artifact in Artifactory.

For example:

{ "md5_checksum":"c61b83072527864fe7171ea99b017438", "sha1_checksum":"b92e9d18bdb357d98c10c8074d3b9b6f63307efa", "sha256_checksum":"d16c4f6e565a0831c96fe0ce1a62694caba55dd5341b8d50aebf54cdf0effdbf", "path":"libs-snapshot-local/org/jfrog/test/multi1/3.7-SNAPSHOT/multi1-3.7-20190218.153526-1-tests.jar", "url":"http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi1/3.7-SNAPSHOT/multi1-3.7-20190218.153526-1-tests.jar", "webapp_url":"http://localhost:8081/artifactory/webapp/#/artifacts/browse/tree/General/libs-snapshot-local/org/jfrog/test/multi1/3.7-SNAPSHOT/multi1-3.7-20190218.153526-1-tests.jar", }

Output parameters

Table 5. Publish Multiple Artifacts To Artifactory output parameters
Parameter Description

publishedArtifacts

Output field where procedure results are saved and contains a list of records with JSON-formatted fields.

Retrieve Artifact from Artifactory

Retrieves the latest or a specific version of an artifact from the Artifactory instance. Supports NuGet, NPM, Maven, PHP, and generic repositories.

Input parameters

Table 6. Retrieve Artifact from Artifactory input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Repository package type

Required. The type of repository. NuGet, NPM, Maven, PHP, and generic repository types are supported.

Repository key

Required. Repository key. For example, nuget-local, libs-snapshot-local.

Organization path

Represents the organization path separated by /, depending on the layout used. For example, the layout [orgPath]/[module].[ext] expects an organization path, whereas the layout ([orgPath])/[module] does not.

Organization path

Represents the organization path separated by / depending, on the layout used. For example, the layout [orgPath]/[module].[ext] expects an organization path, whereas the layout ([orgPath])/[module] does not.

Artifact/Module

A sequence of literals that identifies the artifact’s module.

Latest artifact version

Retrieve the latest artifact version from Artifactory.

Exact artifact version

Retrieve specific version from Artifactory.

File integration revision

A sequence of literals that identifies the integration revision part in the artifact’s file name, excluding the base revision.

Folder integration revision

A sequence of literals that identifies the integration revision used in directory names in the artifact’s path, excluding the base revision. For example, in the case of an integration revision 1.2-SNAPSHOT, the directory integration revision is SNAPSHOT.

Classifier

A sequence of literals that identifies the artifact’s classifier.

Repository layout

Artifactory repository layout is used for retrieval.

Repository path

Path to the artifact in the repository.

Type

Represents the Type field.

Use repository layout

If selected, repository layouts are used.

Extension

Required if you select Generic or Maven or PHP repository package type. A sequence of literals that identifies the artifact’s extension. For example, jar.

Retrieve to directory

Download the artifact version to a specific directory. If undefined, the artifact is downloaded into the current directory.

Overwrite?

If selected, the new package overwrites the already existing one.

Uncompress and extract?

If selected, the retrieved package is extracted into a directory named eflow-<module>-<version>, where:

  • <module>: Is the name of the artifact.

  • <version>: Is the retrieved version of the artifact.

Retrieved artifact location property

Required. Name or property sheet path used by the step to create a property sheet. This property sheet stores information about the retrieved artifact version, including its location in the file system.

Retrieve Generic Artifact

Retrieves an artifact from the specified destination, with optional version.

Input parameters

Table 7. Retrieve Generic Artifact input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Repository key

Required. Repository key. For example, generic-local.

Artifact path

Required. Path to the artifact. For example, /path/module/name.ext.

Destination directory

Destination directory for artifact. Default is current job workspace.

Overwrite?

If selected, the existing artifact is overwritten.

Retrieved artifact location property

Retrieval results, such as artifact name and properties, are saved to this property.