Skip to content

emerald-squad/jfrog-artifactory-resource

 
 

Repository files navigation

Artifactory Resource

A Concourse resource to deploy and retrieve artifacts from a JFrog Artifactory server.

Overview

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.

Configuration

Resource Configuration

To use the artifactory-resource you must declare it in the resource_types section of your pipeline.yml file:

Resource configuration
resource_types:
- name: artifactory-resource
  type: docker-image
  source:
    repository: springio/artifactory-resource
    tag: latest

Source Configuration

  • 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

Source configuration
resources:
- name: artifacts
  type: artifactory-resource
  source:
    uri: http://repo.example.com
    username: admin
    password: secret
    build_name: my-build

Environment variables

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}

Environment variable reference
jobs:
- name: build
  plan:
  - put: artifactory
    params:
      build_url: https://my.concourse.url/builds/${BUILD_ID}

Example

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.

Example pipeline
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]

Behavior

check: Check for new builds

Queries the artifactory repository for builds runs for the given build_name. Returns a list of associated build_numbers ordered by date.

in: Fetches build artifacts

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.

Parameters

  • generate_maven_metadata: If maven meta-data should be generated. This is required if you with to use timestamp based SNAPSHOT artifacts with Maven.

out: Deploy build artifacts

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.

Params

  • 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 or none) used to generate build-info module information (defaults to maven).

  • 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 to true).

  • 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:

Artifact sets
params:
  artifact_set:
  - include:
    - "/**/*.zip"
    exclude:
    - "/**/foo.zip"
    properties:
      zip-type: docs
      zip-deployed: false

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.2%
  • Other 0.8%