Am Dienstag, 20. November 2018 15:33:26 UTC+1 schrieb Justin Seiser:
>
> 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 ->
>
>
withRun starts the container. So you want to add your zap.sh call
as command here.
> docker.image('owasp/zap2docker-weekly').inside("-v
> $WORKSPACE:/zap/wrk:rw") {
> /* Wait until mysql service is up */
>
here you start a second container, that never stops...
> 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
> """
> }
>
So you never arrive here.
> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/e5be8c17-f18c-4d16-bb60-bf4cd6d6d32d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.