Daniel
Daniel

Reputation: 564

How do Publish Build and Artifact to Artifactory using JFrog CLI?

This is what my setup looks like:

JFrog CLI 1.26.2

I have a local directory with the following items:

My spec looks like so this:

{
    "files": [
        {
            "pattern": "myartifact/*",
            "regexp": "false",
            "target": "testrepo-release/testbuilds/",
            "recursive": "true",
            "flat": "false",
            "explode": "false"
        }
    ]
}

Then I run build-add-dependencies:

shell>jfrog rt build-add-dependencies --spec=spec  myartifact 1 
[Info] Running Build Add Dependencies command...
[Info] Adding dependency: myartifact/1.0.0/myartifact-1.0.0-1.txt
{
  "status": "success",
  "totals": {
    "success": 1,
    "failure": 0
  }
}

Finally I run build publish:

shell>jfrog rt build-publish --url=https://server.com/artifactory/ --user=user --password=password --build-url=https://fake myartifact 1
[Info] Deploying build info...
[Info] Build info successfully deployed. Browse it in Artifactory under https://server.com/artifactory/webapp/builds/myartifact/1

I can't figure out why there is nothing (builds or artifacts) at the target testrepo-release/testbuilds/

Thanks for your help!

Upvotes: 0

Views: 3158

Answers (1)

Eyal Ben Moshe
Eyal Ben Moshe

Reputation: 2425

The build-add-dependencies command collects files located on the local file-system and adds them as dependencies to the build-info. It does not upload the files to Artifactory. In order to upload files, you first need to upload the files to Artifactory using the upload command. You can use the same file soec.

Omce the files are uploaded, you can then use the build-add-depedencies command to add the files as dependencies to the build.

Notice that the build-add-depedencies collects the files from the local file-system and not from Artifactory. Future releases of JFrog CLI may add the functionality of also collecting files from Artifactory and adding them to the build as dependencies (the latest release of JFrog when adding this answer is 1.27.0).

Something else to notice: Both the upload and download commands accept two optional flags: --build-name and --build-number. These flags make the command register the uploaded files as build artifacts and the downloaded files as build dependencies.

Upvotes: 6

Related Questions