redhat-cop/containers-quickstarts

Zap Jenkins issue - Failed to run docker - is it on your path?

Closed this issue · 0 comments

Hi There,

I have built the owasp-zap-openshift and integrated to my jenkins. I am getting this error in my jenkins logs...

  • /zap/zap-baseline.py -r index.html -t http://dev-app.mydomain.com
    2020-11-21 22:05:53,264 Failed to run docker - is it on your path?
    2020-11-21 22:05:53,264 Failed to start ZAP in docker :(
    [Pipeline] publishHTML

My Jenkins pipeline looks like this:

def owaspPodLabel = "jenkins-agent-zap"
podTemplate(
    label: owaspPodLabel, 
    name: owaspPodLabel, 
    serviceAccount: 'jenkins', 
    cloud: 'openshift', 
    containers: [ containerTemplate(
        name: 'jenkins-agent-zap',
        image: 'image-registry.openshift-image-registry.svc:5000/5c0dde-tools/jenkins-agent-zap:latest',
        resourceRequestCpu: '500m',
        resourceLimitCpu: '1000m',
        resourceRequestMemory: '3Gi',
        resourceLimitMemory: '4Gi',
        workingDir: '/home/jenkins',
        command: '',
        args: '${computer.jnlpmac} ${computer.name}'
    )]
) {
    node(owaspPodLabel) {
        stage('ZAP Security Scan') {          
            def retVal = sh (
                returnStatus: true, 
                script: "/zap/zap-baseline.py -r index.html -t http://dev-app.mydomain.com"
            )
            publishHTML([
                allowMissing: false, 
                alwaysLinkToLastBuild: false, 
                keepAll: true, 
                reportDir: '/zap/wrk', 
                reportFiles: 'index.html', 
                reportName: 'OWASP Zed Attack Proxy', 
            ])
            echo "Return value is: ${retVal}"

            script {
                if (retVal != 0) {
                    echo "MARKING BUILD AS UNSTABLE"
                    currentBuild.result = 'UNSTABLE'
                }
            }
        }
    }
  }

Any help would be appreciated :)