我确定我在这里错过了一个把戏。这是我的post-commit
Git Hook:
#!/bin/sh
#
# Run a build on commit.
CRUMB=$(curl -s 'http://admin:1qaz@localhost:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)')
curl -d "delay=0sec" -H ${CRUMB} -X POST http://localhost:8080/job/MYPROJECT/build
我正在尝试从终端手动测试它。当我运行CRUMB分配行并回显$ CRUMB时,我得到了预期的结果:
Jenkins-Crumb:95836aaf08889c06f0abe7a417cd65d9
但是从命令行,当我尝试步骤2时,我得到了Error 403 No valid crumb was included in the request
。怎么回事?
忘了我问!
很显然,我是个白痴……答案缺少凭据。
#
# Run a build on commit.
CRUMB=$(curl -s 'http://admin:1qaz@localhost:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)')
curl -d "delay=0sec" -H ${CRUMB} -X POST http://admin:1qaz@localhost:8080/job/web-frontend/build