Search code examples
jenkinscontinuous-integrationjenkins-pipelineartifactoryjenkins-api

How to automate release and staging phases with token using Jenkins and Artifactory?


I want to automate the Artifactory release and staging in jenkins job.

I got this curl command,

curl -X GET "http://localhost:9090/job/artifactory-8.0-release/artifactory/staging?

it is working fine, but it is asking for authentication. When i do automate, i need to call this only using token not with user credentials.

please help.


Solution

  • There are several ways to use tokens for authentication.

    Basic Authentication

    curl -u<USERNAME>:<TOKEN> http://ARTIFACTORY_URL/api/system/ping
    

    Authorization Headers

    curl -H"Authorization: Bearer <TOKEN>" http://ARTIFACTORY_URL/api/system/ping
    

    Source: JFrog Artifactory documenation page 'Access Tokens'