@groovy.util.logging.Log class JFrogArtifactory
Operating artifacts with jFrog Artifatory CLI commands or Jenkins Plugin.
def jfrog = new JFrogArtifactory(this)
jfrog.init(
url: 'https://zowe.jfrog.io/zowe',
usernamePasswordCredential: 'my-artifactory-credential'
)
jfrog.upload(
pattern : 'build/result/of/my-project.zip',
target : 'lib-snapshot-local/org/zowe/my-project/0.1.2/my-project-0.1.2-snapshot.zip'
)
| Type | Name and description |
|---|---|
static java.lang.Object |
CLI_CONFIG_NAMECLI config name. |
static java.lang.Object |
REPOSITORY_RELEASERepository name for releases. |
static java.lang.Object |
REPOSITORY_SNAPSHOTRepository name for snapshots. |
java.lang.Object |
stepsReference to the groovy pipeline variable. |
java.lang.String |
urlArtifactory URL. |
java.lang.String |
usernamePasswordCredentialArtifactory username/password credential id defined on Jenkins. |
| Constructor and description |
|---|
JFrogArtifactory
(java.lang.Object steps)Constructs the class. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
java.util.Map |
delete(java.util.Map args = [:])Delete an artifact |
|
java.util.Map |
delete(java.lang.String pattern)Delete an artifact |
|
void |
download(java.util.Map args = [:])Download artifacts |
|
java.util.Map |
getArtifact(java.util.Map args = [:])Get detail information of an artifact. |
|
java.util.Map |
getArtifact(java.lang.String pattern, java.lang.String buildName = '', java.lang.String buildNumber = '')Get detail information of an artifact. |
|
java.lang.Object |
getArtifacts(java.util.Map args = [:])Get list of artifacts match the criteria |
|
java.util.Map |
getBuildInfo(java.util.Map args = [:])Get build information from Artifactory. |
|
java.util.Map |
getBuildInfo(java.lang.String buildName, java.lang.String buildNumber)Get build information from Artifactory. |
|
void |
init(java.util.Map args = [:])Initialize npm registry properties. |
|
java.util.Map |
interpretArtifactDefinition(java.lang.String packageName, java.util.Map definition, java.util.Map defaults = [:])Interpret artifact definition |
|
java.util.Map |
interpretArtifactDefinitions(java.util.Map definitions, java.util.Map defaults = [:])Convert Map of package name - definition to Artifactory download specification |
|
java.lang.String |
promote(java.util.Map args = [:])Promote artifact. |
|
java.lang.String |
promote(java.lang.String source, java.lang.String targetPath, java.lang.String targetName = '')Promote artifact. |
|
void |
upload(java.util.Map args = [:])Upload an artifact |
|
void |
upload(java.lang.String pattern, java.lang.String target, java.util.Map properties = [:])Upload an artifact. |
|
void |
uploadWithCli(java.util.Map args = [:])Upload an artifact. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
CLI config name.
"rt-server-1"Repository name for releases.
"libs-release-local"Repository name for snapshots.
"libs-snapshot-local"Reference to the groovy pipeline variable.
Artifactory URL.
https://zowe.jfrog.io/zoweArtifactory username/password credential id defined on Jenkins.
Constructs the class.
When invoking from a Jenkins pipeline script, the Pipeline must be passed the current environment of the Jenkinsfile to have access to the steps.
def jfrog = new JFrogArtifactory(this)
steps - The workflow steps object provided by the Jenkins pipelineDelete an artifact
my-project.zip from artifactory {@coode lib-snapshot-local} repository.
jfrog.delete(
pattern : 'build/result/of/my-project.zip'
)
pattern - pattern to locate the artifactsDelete an artifact
Download artifacts
jfrog.download(
spec : 'path/to/my/download/spec.json',
expected : 5
)
Or specify download spec in parameter
jfrog.download(
specContent : '[{"file": "lib-snapshot-local/path/to/file.zip"}]',
expected : 1
)
spec - jfrog cli download specification file. optional.specContent - jfrog cli download specification content text.
Will be ignored if 'spec' is defined, will be .
required if 'spec' is not defined.expected - if we need to check download count. optional.Get detail information of an artifact.
Example output:
path - "libs-snapshot-local/com/project/zowe/0.9.0-SNAPSHOT/zowe-0.9.0-20180918.163158-38.pax"build.name - "zowe-install-packaging :: master"build.number - "38"build.timestamp - "1537287202277"pattern - path pattern to find the artifact. For example: "lib-snapshot-local/path/to/artifacts/*.zip"build-name - limit the search within this build name. Optional.build-number - limit the search within this build number. Optional.path key.Get detail information of an artifact.
Get list of artifacts match the criteria
pattern - path pattern to find the artifact. For example: "lib-snapshot-local/path/to/artifacts/*.zip"build-name - limit the search within this build name. Optional.build-number - limit the search within this build number. Optional.Get build information from Artifactory.
build-name - limit the search within this build name. Required.build-number - limit the search within this build number. Required.Get build information from Artifactory.
Initialize npm registry properties.
args Map.url - the artifactory URL. For example "https://zowe.jfrog.io/zowe".usernamePasswordCredential - Artifactory username/password credential IDInterpret artifact definition
"org.zowe.zlux.zlux-core": {
// no * in the pattern, will pick exact artifact with path
"artifact": "libs-snapshot-local/org/zowe/zlux/zlux-core/1.3.0-RC/zlux-core-1.3.0-20190607.143930.pax"
},
"org.zowe.explorer-jes": {
// still pick exact artifact by release version
// match 0.0.21 in libs-release-local/org/zowe/explorer-jes/0.0.21/*
// and it should only have one artifact in the folder
"version": "0.0.21"
},
"org.zowe.explorer-mvs": {
// pick the most recent patch-level build
// match 0.0.* from libs-snapshot-local/org/zowe/explorer-mvs/0.0.*/*
"version": "~0.0.21",
// optional to specify which artifact to pick from, if more than one in the folder
// with this option, will try to find the artifact with pattern libs-snapshot-local/org/zowe/explorer-mvs/0.0.*/explorer-mvs-special-name-*.pax
"artifact": "explorer-mvs-special-name-*.pax"
},
"org.zowe.another": {
// pick the most recent minor-level build
// match 0.* from libs-snapshot-local/org/zowe/another/0.*/*
"version": "^0.0.21",
},
"license": {
// pick exact artifact defined by artifact
"artifact": "libs-release-local/org/zowe/licenses/1.0.0/zowe_licenses_full.zip"
},
"org.zowe.licenses": {
// another way to define with same effect above
"version": "1.0.0"
}
packageName - package name. For example org.zowe.explorer-jesdefinition - map of definition. Supported keys are: version, artifact, explode, target, repositorydefaults - default values for definition. Supported keys are: target, repositoryConvert Map of package name - definition to Artifactory download specification
definitions - Map of package name - definition pairsdefaults - default values for definition. Supported keys are: target, repositoryPromote artifact.
Requires these environment variables:
my-project-0.1.2-snapshot.zip as formal release of v0.1.2:
String result = jfrog.promote(
source : 'lib-snapshot-local/org/zowe/my-project/0.1.2/my-project-0.1.2-snapshot.zip',
targetPath : 'lib-release-local/org/zowe/my-project/0.1.2/',
targetName : 'my-project-0.1.2.zip'
)
assert result == 'lib-release-local/org/zowe/my-project/0.1.2/my-project-0.1.2.zip'
source - information of the artifact will be promoted.targetPath - target path on remote ArtifactorytargetName - target artifact name. Optional, default to original name.Promote artifact.
Upload an artifact
You can choose one of three ways to upload:
spec which pointing to a filespecContent which is upload specification textpattern and target, these information will be rendered into upload specificationmy-project.zip to artifactory {@coode lib-snapshot-local} repository.
jfrog.upload(
pattern : 'build/result/of/my-project.zip',
target : 'lib-snapshot-local/org/zowe/my-project/0.1.2/my-project-0.1.2-snapshot.zip'
)
spec - jfrog cli upload specification file. optional.specContent - jfrog cli upload specification content text.pattern - pattern to find local artifact(s)target - target path on remote Artifactoryproperties - a map of extra properties we want to add to the artifactUpload an artifact.
Upload an artifact.
Requires these environment variables:
pattern - pattern to find local artifact(s)target - target path on remote ArtifactoryGroovy Documentation