Search code examples
artifactory

Artifcatory: Error when using artifactory docker bitbucket pipeline


I am passing the following

      - pipe: JfrogDev/artifactory-docker:0.2.12
        variables:
          ARTIFACTORY_URL: "${JFROG_URL}"
          ARTIFACTORY_USER: "${JFROG_USER}"
          ARTIFACTORY_PASSWORD: "${JFROG_PASSWORD}"
          DOCKER_IMAGE_TAG: "xxxx/web-interface:${BITBUCKET_BUILD_NUMBER}"
          DOCKER_TARGET_REPO: "local-containers"

And I am getting back the following

Status: Downloaded newer image for jfrog-int-docker-open-docker.bintray.io/artifactory-docker:0.2.12
INFO: Starting pipe execution...
jfrog rt config --url=$JFROG_URL --user=$JFROG_USER --password=$JFROG_PASSWORD --interactive=false
[Error] Wrong number of arguments. You can read the documentation at https://www.jfrog.com/confluence/display/CLI/JFrog+CLI

It can’t find anything wrong based on the documentation, it looks like the pipeline makes a cli call and that call is failing


Solution

  • It looks like there is an issue when trying to config the server without the mandatory server-id argument: https://bitbucket.org/JfrogDev/artifactory-docker/src/3b32b5d01d31c07acadb2a0d29a240110f88d59d/pipe/pipe.sh#lines-65

    Instead, you can use the new jfrog-setup-cli pipe. This pipe downloads and configures the JFrog CLI.

    For example, in your case:

    - pipe: jfrog/jfrog-setup-cli:1.0.0
    - source ./jfrog-setup-cli.sh
    - jfrog rt docker-push "xxxx/web-interface:${BITBUCKET_BUILD_NUMBER}" local-containers
    

    It requires to populate one secured environment variable prefixed by JF_ARTIFACTORY_ (i.e. JF_ARTIFACTORY_MYSERVER) with a JFrog CLI server token. This token created locally in your machine using the jfrog rt config export command.

    Read more about this pipe here.

    Read more about the jfrog rt config export command here.