-
类型: 错误
-
状态: Resolved
A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">解决 -
解决方法: 完成
-
影响版本/ s: 2.16.1
-
修复版本/ s: 2.16.2
-
组件/ s: 没有一个
-
标签:没有一个
症状:构建作业成功地将工件推送到Artifactory,并且buildinfo已成功发布,但“scanBuilds”事件未能到达Artifactory。
这是由于Artifactory插件没有充分使用Jenkins中的代理设置。
复制步骤:
- 连接x射线和Artifactory
- 有一个工作的Jenkins管道构建,如以下配置:
节点{
def服务器
def buildInfo
def rtMaven
阶段(“克隆”)
{git url: 'https://github.com/jfrogdev/project-examples.git'}阶段('Artifactory configuration')
{//获取一个Artifactory服务器实例,在Jenkins中定义——> Manage: server = Artifactory。服务器'saas-art' rtMaven = Artifactory.newMavenBuild() rtMaven。tool = 'maven' // Jenkins配置中的工具名rtMaven.deployer releaseRepo: 'lib -release-local', snapshotRepo: 'libs-snapshot-local', server: server rtMaven。解析器releasereo: 'lib -release', snapshotRepo: 'lib -snapshot', server: server rtMaven.deployer.deployArtifacts = false //在Maven运行时禁用工件部署buildInfo = Artifactory.newBuildInfo()}阶段(“测试”)
{rtMaven.run pom: 'maven-example/pom.xml',目标:'干净的测试'}阶段(安装)
{rtMaven.run pom: 'maven-example/pom.xml',目标:'安装',buildInfo: buildInfo}阶段(部署)
{rtmaven .deploy . deployartifacts buildInfo}stage('发布构建信息')
{服务器。publishBuildInfo buildInfo}阶段(x射线扫描)
{def scanConfig = ['buildName': buildInfo.name, 'buildNumber': buildInfo.name。number, 'failBuild': false] def scanResult = server。将扫描结果返回为字符串}
3.在Jenkins主机上添加web代理(如squid),并在“Manage Jenkins -> Manage Plugins -> Advanced”中设置代理配置
4.运行构建并注意"/api/xray/scanBuild"事件没有被squid日志记录(在/var/log/squid中找到):
(request.log)
79 | 20180629184627 | | 127.0.0.1请求管理| |把| / libs-snapshot-local / org/jfrog/test/multi3/3.7 snapshot/multi3 - 3.7 snapshot.pom; build.timestamp = 1530297910512; build.name = saas-build; build.number = 8 HTTP / 1.1 | 201 | 2796 |
[…]
| 241 | 20180629184628 |请求10.128.0.37 | x光| | / libs-snapshot-local / org/jfrog/test/multi3/3.7 - snapshot/multi3 - 3.7 - 20180629.184510 - 8. -战争HTTP / 1.1 | 200 | 2533340 |
[…]
| 4749 | 20180629184632 |请求12.244.40.18 |管理|发布| / api / x光/ scanBuild HTTP / 1.1 | 200 | 64 |
(squid.log)
1530297921.912 138 127.0.0.1 tcp_miss /201 1341 puthttp://35.230.87.16:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi3/3.7-SNAPSHOT/multi3-3.7-SNAPSHOT.pom;build.timestamp=1530297910512;build.name=saas-build;build.number=8- HIER_DIRECT/35.230.87.16 application/vnd.org.jfrog.artifactory.storage.ItemCreated+json
1530297922.039 31 127.0.0.1 tcp_miss /200 903 gethttp://35.230.87.16:8081/artifactory/api/system/version- HIER_DIRECT/35.230.87.16 application/vnd.org.jfrog.artifactory.system.Version+json
1530297922.152 108 127.0.0.1 tcp_miss /204 306 puthttp://35.230.87.16:8081/artifactory/api/build- HIER_DIRECT/35.230.87.16 application/json