A Concourse resource to deploy and retrieve artifacts from a JFrog Artifactory server.
This Concourse resource can be used to check, deploy and retrieve artifacts from a JFrog artifactory server. It makes use of the "builds" and "artifact properties" features of Artifactory to link deployed artifacts to their builds.
To use the artifactory-resource
you must declare it in the resource_types
section of your pipeline.yml
file:
resource_types:
- name: artifactory-resource
type: docker-image
source:
repository: springio/artifactory-resource
tag: latest
-
uri
: Required. The URI of the artifactory server -
username
: Required. The artifactory username -
password
: Required. The artifactory password -
build_name
: Required. The name of the build
resources:
- name: artifacts
type: artifactory-resource
source:
uri: http://repo.example.com
username: admin
password: secret
build_name: my-build
Environment variables can be referenced in any part of the configuration by using ${…}
notation.
For example, typically the build_url
out
parameter would be built using ${BUILD_ID}
jobs:
- name: build
plan:
- put: artifactory
params:
build_url: https://my.concourse.url/builds/${BUILD_ID}
The following example shows a pipeline with two jobs. The first job deploys built artifacts and the second job retrieves and runs tests against them.
resource_types:
- name: artifactory-resource
type: docker-image
source: {repository: springio/artifactory-resource, tag: latest}
resources:
- name: git-repo
type: git
source:
uri: https://git.example.com/my-org/my-project
branch: master
- name: artifactory
type: artifactory-resource
source:
uri: {{ARTIFACTORY_URI}}
username: {{USERNAME}}
password: {{PASSWORD}}
build_name: my-project-build
jobs:
- name: build
plan:
- get: git-repo
trigger: true
- task: build
file: git-repo/samples/simple/tasks/build.yml
- put: artifactory
params:
repo: libs-snapshot-local
build_number: "${BUILD_ID}"
folder: test
build_uri: "{{CONCOURSE_URI}}/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}"
- name: test
plan:
- get: artifactory
trigger: true
passed: [build]
Queries the artifactory repository for builds runs for the given build_name
.
Returns a list of associated build_numbers
ordered by date.
Fetches artifacts for the build run to the destination folder. The directory structure returned is identical to the one that was originally uploaded.
Fetched artifacts can also have Maven metadata generated so that the resulting folder can be used as a repository.
Files are fetch by querying for artifacts that have build.name
and build.number
properties associated with them.
If you are querying artifacts that were not deployed with this resource, you should ensure such properties exist.
Deploy artifacts from the specified folder and create a new artifactory "Build Run".
Uploaded artifacts will have build.name
and build.number
properties associated with them.
Build modules will be also automatically added when dealing with a Maven style directory structure.
-
repo
: Required. The artifact repository to deploy to (e.g.libs-snapshot-local
) -
build_number
: The build number to save (if not specified, an ID based on the current date/time will be used) -
folder
: The folder to save -
include
: A list of Ant style patterns for the files to include -
exclude
: A list of Ant style patterns for the files to exclude -
module_layout
: The module layout (maven
ornone
) used to generatebuild-info
module information (defaults tomaven
). -
build_uri
: The URL back to the concourse build (e.g.https://my.concourse.url/builds/${BUILD_ID}
) -
strip_snapshot_timestamps
: If snapshot timestamps should be removed to allow artifactory to generate them (defaults totrue
). -
disable_checksum_uploads
: If checksum based uploads should be disabled (useful to prevent artifactory from associating the wrong resource with a snapshot version) -
artifact_set
: Additional configuration for a subset of the artifacts (see below)
The artifact_set
parameter can be used to apply specific additional configuration to a subset of artifacts.
You create sets based on include
and exclude
Ant patterns, then apply any of the following additional configuration:
-
properties
: A map of name/value pairs that will be added as artifactory properties.
Here’s a typical example:
params:
artifact_set:
- include:
- "/**/*.zip"
exclude:
- "/**/foo.zip"
properties:
zip-type: docs
zip-deployed: false