使用 CLI 对远程 jenkins 进行身份验证

Authenticate with remote jenkins using CLI

我运行这个:

curl "$JENKINS_URL/job/simple_starter/build?token=$TOKEN_NAME" 

但我收到了这条消息:

Authentication required You are authenticated as: anonymous Groups that you are in: Permission you need to have (but didn't): hudson.model.Hudson.Read ... which is implied by: hudson.security.Permission.GenericRead ... which is implied by: hudson.model.Hudson.Administer

我想我可以使用这样的方式登录:

java -jar jenkins-cli.jar --password x --username y

但是如何使用 curl 命令传递我的凭据以便我可以手动触发 Jenkins 作业?

我所要做的就是将我的 Jenkins username/password 添加到 curl 命令中,如下所示:

curl -u "${jenkins_username}:${jenkins_password}" "$JENKINS_URL/xyz"