Justin Seiser
2018-11-20 14:21:23 UTC
I want to run ZAP as a proxy in my pipeline, and run my selenium tests
through the proxy. Im just using curl in a container in place of selenium
for my testing and was able to make this work locally using docker.
In my pipeline, zap starts up, but the pipeline just sits in the zap
container after that, never progressing to the second container. I
understand why, Ive launched a process as a daemon, its never going to
finish, so the step never finished. I just dont understand how to
accomplish what I need in jenkins.
stage('Run Zap Proxy'){
docker.image('owasp/zap2docker-weekly').withRun('-p 8090:8090') { c
->
docker.image('owasp/zap2docker-weekly').inside("-v
$WORKSPACE:/zap/wrk:rw") {
/* Wait until mysql service is up */
sh """
zap.sh -daemon -port 8090 -host 0.0.0.0 -newsession
testing -config api.addrs.addr.name=.* -config api.addrs.addr.regex=true
-config api.disablekey=true
"""
}
docker.image('cfmanteiga/alpine-bash-curl-jq').inside("--link
${c.id}:proxy") {
sh 'curl -k -x http://proxy:8090 https://my.fqdn.net'
sh """
curl -k -x http://proxy:8090 \
-X POST https://my.fqdn.net/api/rest/sessions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"username":"username","password":"password"}'
"""
sh 'sleep 2m'
sh 'curl -o report.html http://zap/UI/core/other/htmlreport'
stash includes: 'report.html', name: 'report'
}
}
}
I essentially need to start zap with the command im using in the 'inside',
and only kill the container when the second containers steps are complete.
through the proxy. Im just using curl in a container in place of selenium
for my testing and was able to make this work locally using docker.
In my pipeline, zap starts up, but the pipeline just sits in the zap
container after that, never progressing to the second container. I
understand why, Ive launched a process as a daemon, its never going to
finish, so the step never finished. I just dont understand how to
accomplish what I need in jenkins.
stage('Run Zap Proxy'){
docker.image('owasp/zap2docker-weekly').withRun('-p 8090:8090') { c
->
docker.image('owasp/zap2docker-weekly').inside("-v
$WORKSPACE:/zap/wrk:rw") {
/* Wait until mysql service is up */
sh """
zap.sh -daemon -port 8090 -host 0.0.0.0 -newsession
testing -config api.addrs.addr.name=.* -config api.addrs.addr.regex=true
-config api.disablekey=true
"""
}
docker.image('cfmanteiga/alpine-bash-curl-jq').inside("--link
${c.id}:proxy") {
sh 'curl -k -x http://proxy:8090 https://my.fqdn.net'
sh """
curl -k -x http://proxy:8090 \
-X POST https://my.fqdn.net/api/rest/sessions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"username":"username","password":"password"}'
"""
sh 'sleep 2m'
sh 'curl -o report.html http://zap/UI/core/other/htmlreport'
stash includes: 'report.html', name: 'report'
}
}
}
I essentially need to start zap with the command im using in the 'inside',
and only kill the container when the second containers steps are complete.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a14d9f19-f4f2-4fd3-adc8-1dded5c40e9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a14d9f19-f4f2-4fd3-adc8-1dded5c40e9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.