使用命令行自动启动Jenkins的job

1 自动启动jenkins 的job:
启动不带参数的job:
curl --user USER:PASSWORD  JENKINS_URL/job/JOBNAME/build


启动带参数的job:
curl --user USER:PASSWORD  JENKINS_URL/job/JOBNAME/buildWithParameters


2 自动disable Project:
curl   --user ${UserName}:${PASSWORD} -o /dev/null --data disable JENKINS_URL/job/JOBNAME/disable


3 查询job的状态
curl --silent ${JENKINS_SERVER}/job/JOB_NAME/lastBuild/api/json


4)获取build的num
curl --silent ${JENKINS_SERVER}/job/JOB_NAME/lastBuild/buildNumber


5)获取最近成功的build的num
curl --silent ${JENKINS_SERVER}/job/JOB_NAME/lastStableBuild/buildNumber

你可能感兴趣的:(Jenkins)