Skip to content

Scanning with the CodeLogic JavaScript Agent (Docker)

The CodeLogic JavaScript Agent for Docker provides an easy way to integrate CodeLogic scanning into your build process.

Run the Docker Image

Pull and run the JavaScript agent image from your CodeLogic server registry:

docker run --pull always --rm --interactive                              \
     --env AGENT_UUID="your-agent-uuid"                                    \
     --env AGENT_PASSWORD="your-agent-password"                            \
     --volume /path/to/scan:/scan                                          \
     yourinstance.app.codelogic.com/codelogic_javascript:latest analyze    \
     --host https://yourinstance.app.codelogic.com                         \
     --application "Your Application"                                      \
     -p /scan

Docker options:

  • --pull always — ensures that you always get the newest image
  • --env AGENT_UUID / --env AGENT_PASSWORD — agent credentials
  • --volume — mounts the host directory to scan into the container
  • See Docker Documentation for more docker options.

Tip

You can copy and paste the command directly into your Jenkins file.

Adding Custom Certificate Authorities

When running a server with a self-signed certificate or internal certificate authority the following options can be used to add the certificate authority to the docker image.

  • --volume "/home/<user_dir>/cacerts/:/opt/codelogic/certs" - mounts the directory containing your ca certificates into the docker image.
  • --env NODE_EXTRA_CA_CERTS="/opt/codelogic/certs/your-certificate.pem" - loads the certificate authorities from the pem file into the docker image.

CI/CD Scanning

Using the Docker agent with Jenkins

The CodeLogic Java Agent for Docker can be used to scan artifacts in Jenkins pipelines.

Example:

stage('CodeLogic Scan with latest AWS image') {
    when {
        expression { BRANCH_NAME ==~ /(integration|v.*|feature\/.*)/ }
    }
    steps {
        catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
            // Publish CodeLogic Scan
            sh('''
            docker run --pull always --rm --interactive                              \
                 --env "AGENT_UUID=${AGENT_UUID}"                                    \
                 --env "AGENT_PASSWORD=${AGENT_PASSWORD}"                            \
                 --volume ${PWD}:/scan                                               \
                 yourinstance.app.codelogic.com/codelogic_javascript:latest analyze  \
                 --host https://yourinstance.app.codelogic.com                       \
                 --application "Your Application"                                    \
                 -p /scan                                                            \
                 --scan-space-name "Development"                                     \
                 -e
           ''')
        }
    }
}