This plugin enables you to manage artifacts in Artifactory in a Vela pipeline.
Source Code: https://github.com/go-vela/vela-artifactory
Registry: https://hub.docker.com/r/target/vela-artifactory
NOTE:
Users should refrain from using latest as the tag for the Docker image.
It is recommended to use a semantically versioned tag instead.
Sample of copying an artifact:
steps:
- name: copy_artifacts
image: target/vela-artifactory:latest
pull: always
parameters:
action: copy
path: libs-snapshot-local/foo.txt
target: libs-snapshot-local/bar.txt
url: http://localhost:8081/artifactorySample of deleting an artifact:
steps:
- name: delete_artifacts
image: target/vela-artifactory:latest
pull: always
parameters:
action: delete
path: libs-snapshot-local/foo.txt
url: http://localhost:8081/artifactorySample of setting properties on an artifact:
steps:
- name: set_properties_artifacts
image: target/vela-artifactory:latest
pull: always
parameters:
action: set-prop
path: libs-snapshot-local/foo.txt
props:
- name: single
value: foo
- name: multiple
values:
- bar
- baz
url: http://localhost:8081/artifactorySample of uploading an artifact:
steps:
- name: upload_artifacts
image: target/vela-artifactory:latest
pull: always
parameters:
action: upload
path: libs-snapshot-local/
sources:
- foo.txt
- target/*.jar
- dist/**/*.js
url: http://localhost:8081/artifactorySample of uploading an artifact using regexp:
steps:
- name: upload_artifacts
image: target/vela-artifactory:latest
pull: always
parameters:
action: upload
path: libs-snapshot-local/
regexp: true
sources:
- dist/([a-z]+).js
url: http://localhost:8081/artifactoryImportant
As the JFrog docs call out: If you have specified that you are using regular expressions, then the beginning of the expression must be enclosed in parenthesis. For example: a/b/c/(.*)/file.zip
Sample of uploading an artifact using build props (matrix parameters):
steps:
- name: upload_artifacts
image: target/vela-artifactory:latest
pull: always
parameters:
action: upload
path: libs-snapshot-local/file
sources:
- file.txt
build_props: build.name=buildName;build.number=17;build.timestamp=1600856623553
url: http://localhost:8081/artifactorySample of pretending to upload an artifact:
steps:
- name: upload_artifacts
image: target/vela-artifactory:latest
pull: always
parameters:
action: upload
+ dry_run: true
path: libs-snapshot-local/
sources:
- foo.txt
- target/*.jar
- dist/**/*.js
url: http://localhost:8081/artifactorySample of using docker-promote on an artifact:
steps:
- name: docker_promote_artifacts
image: target/vela-artifactory:latest
pull: always
parameters:
action: docker-promote
target_repo: libs-snapshot-local
docker_registry: octocat/hello-world
tag: latest
target_docker_registry: octocat/hello-world
target_tags: "${VELA_BUILD_COMMIT:0:8}"NOTE: Users should refrain from configuring sensitive information in your pipeline in plain text.
The plugin accepts the following parameters for authentication:
| Parameter | Environment Variable Configuration |
|---|---|
api_key |
PARAMETER_API_KEY, ARTIFACTORY_API_KEY |
password |
PARAMETER_PASSWORD, ARTIFACTORY_PASSWORD |
username |
PARAMETER_USERNAME, ARTIFACTORY_USERNAME |
Users can use Vela internal secrets to substitute these sensitive values at runtime:
steps:
- name: copy_artifacts
image: target/vela-artifactory:latest
pull: always
+ secrets: [ artifactory_username, artifactory_password ]
parameters:
action: copy
path: libs-snapshot-local/foo.txt
target: libs-snapshot-local/bar.txt
url: http://localhost:8081/artifactory
- username: octocat
- password: superSecretPasswordThis example will add the secrets to the
copy_artifactsstep as environment variables:
ARTIFACTORY_USERNAME=<value>ARTIFACTORY_PASSWORD=<value>
The plugin accepts the following files for authentication:
| Parameter | File Configuration |
|---|---|
api_key |
/vela/parameters/artifactory/api_key, /vela/secrets/artifactory/api_key, /vela/secrets/managed-auth/api_key |
password |
/vela/parameters/artifactory/password, /vela/secrets/artifactory/password, /vela/secrets/managed-auth/password |
username |
/vela/parameters/artifactory/username, /vela/secrets/artifactory/username, /vela/secrets/managed-auth/username |
Users can use Vela external secrets to substitute these sensitive values at runtime:
steps:
- name: copy_artifacts
image: target/vela-artifactory:latest
pull: always
parameters:
action: copy
path: libs-snapshot-local/foo.txt
target: libs-snapshot-local/bar.txt
url: http://localhost:8081/artifactory
- username: octocat
- password: superSecretPasswordThis example will read the secret values in the build workspace stored at
/vela/secrets/artifactory/*
NOTE:
The plugin supports reading all parameters via:
- environment variables -
PARAMETER_*ORARTIFACTORY_*- files -
/vela/parameters/artifactory/*OR/vela/secrets/artifactory/*Any values set from a file takes precedence over values set from the environment.
The following parameters are used to configure the image:
| Name | Description | Required | Default | Environment Variables |
|---|---|---|---|---|
action |
action to perform against Artifactory | true |
N/A |
PARAMETER_ACTIONARTIFACTORY_ACTION |
api_key |
API key for communication with Artifactory | false |
N/A |
PARAMETER_API_KEYARTIFACTORY_API_KEY |
dry_run |
enables pretending to perform the action | false |
false |
PARAMETER_DRY_RUNARTIFACTORY_DRY_RUN |
log_level |
set the log level for the plugin | true |
info |
PARAMETER_LOG_LEVELARTIFACTORY_LOG_LEVEL |
password |
password for communication with Artifactory | false |
N/A |
PARAMETER_PASSWORDARTIFACTORY_PASSWORD |
url |
Artifactory instance to communicate with | true |
N/A |
PARAMETER_URLARTIFACTORY_URL |
username |
user name for communication with Artifactory | false |
N/A |
PARAMETER_USERNAMEARTIFACTORY_USERNAME |
http_client_retries |
number of times to retry failed http attempts | false |
3 |
PARAMETER_HTTP_CLIENT_RETRIESARTIFACTORY_HTTP_CLIENT_RETRIES |
http_client_retry_wait |
amount of milliseconds to wait between failed http attempts | false |
500 |
PARAMETER_HTTP_CLIENT_RETRY_WAIT_MILLISECONDSARTIFACTORY_HTTP_CLIENT_RETRY_WAIT_MILLISECONDS |
http_client_cert |
file path to the client certificate to use for TLS communication | false |
N/A |
PARAMETER_HTTP_CLIENT_CERTARTIFACTORY_HTTP_CLIENT_CERT |
http_client_cert_key |
file path to the client certificate key to use for TLS communication | false |
N/A |
PARAMETER_HTTP_CLIENT_CERT_KEYARTIFACTORY_HTTP_CLIENT_CERT_KEY |
http_client_insecure_tls |
enable insecure TLS communication | false |
false |
PARAMETER_HTTP_CLIENT_INSECURE_TLSARTIFACTORY_HTTP_CLIENT_INSECURE_TLS |
The following parameters are used to configure the copy action:
| Name | Description | Required | Default | Environment Variables |
|---|---|---|---|---|
flat |
enables removing source directory hierarchy | false |
false |
PARAMETER_FLATARTIFACTORY_FLAT |
path |
source path to copy artifact(s) from | true |
N/A |
PARAMETER_PATHARTIFACTORY_PATH |
recursive |
enables copying sub-directories for the artifact(s) | false |
false |
PARAMETER_RECURSIVEARTIFACTORY_RECURSIVE |
target |
target path to copy artifact(s) to | true |
N/A |
PARAMETER_TARGETARTIFACTORY_TARGET |
The following parameters are used to configure the delete action:
| Name | Description | Required | Default | Environment Variables |
|---|---|---|---|---|
path |
target path to delete artifact(s) from | true |
N/A |
PARAMETER_PATHARTIFACTORY_PATH |
recursive |
enables removing sub-directories for the artifact(s) | false |
false |
PARAMETER_RECURSIVEARTIFACTORY_RECURSIVE |
The following parameters are used to configure the docker-promote action:
| Name | Description | Required | Default | Environment Variables |
|---|---|---|---|---|
copy |
set to copy instead of moving the image | false |
true |
PARAMETER_COPYARTIFACTORY_COPY |
docker_registry |
path to image in docker registry | true |
N/A |
PARAMETER_DOCKER_REGISTRYARTIFACTORY_DOCKER_REGISTRY |
promote_props |
enables setting properties on the promoted artifact | false |
false |
PARAMETER_PROMOTE_PROPSARTIFACTORY_PROMOTE_PROPS |
tag |
name of the tag for promoting | true |
N/A |
PARAMETER_TAGARTIFACTORY_TAG |
target_docker_registry |
path for target image in docker registry | true |
N/A |
PARAMETER_TARGET_DOCKER_REGISTRYARTIFACTORY_TARGET_DOCKER_REGISTRY |
target_repo |
name of the docker registry containing the image | true |
N/A |
PARAMETER_TARGET_REPOARTIFACTORY_TARGET_REPO |
target_tags |
name of the final tags after promotion | true |
N/A |
PARAMETER_TARGET_TAGSARTIFACTORY_TARGET_TAGS |
The following parameters are used to configure the set-prop action:
| Name | Description | Required | Default | Environment Variables |
|---|---|---|---|---|
path |
target path to artifact(s) | true |
N/A |
PARAMETER_PATHARTIFACTORY_PATH |
props |
properties to set on the artifact(s) | true |
N/A |
PARAMETER_PROPSARTIFACTORY_PROPS |
The following parameters are used to configure the upload action:
| Name | Description | Required | Default | Environment Variables |
|---|---|---|---|---|
build_props |
build props (matrix parameters) to apply | false |
N/A |
PARAMETER_BUILD_PROPSARTIFACTORY_BUILD_PROPS |
flat |
enables removing source directory hierarchy | false |
false |
PARAMETER_FLATARTIFACTORY_FLAT |
include_dirs |
enables including sub-directories for the artifact(s) | false |
false |
PARAMETER_INCLUDE_DIRSARTIFACTORY_INCLUDE_DIRS |
path |
target path to upload artifact(s) to | true |
N/A |
PARAMETER_PATHARTIFACTORY_PATH |
recursive |
enables uploading sub-directories for the artifact(s) | false |
false |
PARAMETER_RECURSIVEARTIFACTORY_RECURSIVE |
regexp |
enables reading the sources as a regular expression | false |
false |
PARAMETER_REGEXPARTIFACTORY_REGEXP |
sources |
list of artifact(s) to upload | true |
N/A |
PARAMETER_SOURCESARTIFACTORY_SOURCES |
COMING SOON!
You can start troubleshooting this plugin by tuning the level of logs being displayed:
steps:
- name: copy_artifacts
image: target/vela-artifactory:latest
pull: always
parameters:
action: copy
+ log_level: trace
path: libs-snapshot-local/foo.txt
target: libs-snapshot-local/bar.txt
url: http://localhost:8081/artifactoryBelow are a list of common problems and how to solve them: