Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
This page describes the required configuration for Jenkins to invoke AWS CodeBuild, which in turn invokes Synopsys Detect.
The procedure described here references the AWS CodeBuild project that was created and verified in the Calling Synopsys Detect from AWS CodeBuild page.

...

  1. Set up Jenkins. If you already have a Jenkins server set up to use the AWS CodeBuild plugin,

...

  1. go to Step 2

...

  1. (If not, you can do either

...

  1. step).
    1. Download Jenkins
  2. at 
    1. at jenkins.io
  3.  and
    1. and run it directly
  4. with 
    1. with java -jar jenkins.war.
    2. Create a Jenkins server on Amazon EC2
  5. within the 
    1. in the AWS Marketplace.

...

  1. Download and install the AWS CodeBuild plugin.
    The AWS CodeBuild plugin

...

  1. enables Jenkins to launch AWS CodeBuild.

...


  1. There are two

...

  1. methods (a or b) that you can use to download and install the AWS CodeBuild plugin

...

  1. :
    1. Download and Install AWS CodeBuild Plugin
    through
    1. by using the Plugin Manager
    .  This
    1. , which is the
     
    1. recommended option.
      1. In Jenkins,
    click 
      1. click Manage Jenkins
     > 
      1. > Manage Plugins
     >
      1. > Available.
     
      1. In the Filter text box, type AWS CodeBuild.
     
    Check Manually download
      1. Select the AWS CodeBuild plugin.
      2. Click Download now and install after restart.
      3. Restart Jenkins.
    Image Removed 
      1. Image Added
    1. Download the AWS CodeBuild plugin manually.
      1. Build the AWS CodeBuild Jenkins plugin locally by
    running 
      1. running mvn install
     to generate 
      1. to generate aws-codebuild.hpi
     in the 
      1. in the target
     directory
      1. directory,
        or
    :

      1. Download the
    latest 
      1. latest aws-codebuild.hpi
     directly
      1. from
    the 
      1. the Jenkins plugin repository.
      2. In Jenkins,
    choose 
      1. click Manage Jenkins
     > 
      1. > Manage
    Plugins > 
      1. Plugins > Advanced
     > 
      1. > Upload Plugin
     > Browse (select the 
      1. > Browse to find and select the aws-codebuild.hpi
     file) > Upload 
      1. file > Upload to install the AWS CodeBuild plugin.

...


  1. Configure Jenkins Environment Variables.
    1. Configure

...

    1. the AWS Access Key ID and Secret Access Key in the Jenkins Environment variables area.

...


    1. Click here to see information

...

    1. about creating and obtaining the access and secret access key IDs for an IAM user.

...

    1. In Jenkins, click Manage Jenkins > Configure System > Global Properties > Environment Variables > Add > Save.

...

  1. Invoke the AWS CodeBuild plugin

...

  1. in Jenkins

...

  1. by using either of the following methods described in steps a. and b.
    1. Use the AWS CodeBuild plugin with the Jenkins Pipeline plugin.
        Create
          1. To create the Pipeline job
        .
          1. , type an item name in the Enter an item name text box, select Pipeline, and then click OK.
        Image Removed
          1. Image Added
          2. Invoke the AWS CodeBuild plugin by using a pipeline script.
          3. Click the created pipeline job

      ...

          1. > Configure

      ...

          1. > Pipeline.

      ...


          1. This invokes the AWS CodeBuild through a pipeline script. The following script

      ...

          1. is a sample script

      ...

          1. :
            The AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are retrieved from the Jenkins environment variables that were configured in Step 3.

      ...


          1. Code Block
            themeRDark
            node {
            stage('Build') {
            // Invoke the AWS CodeBuild
            awsCodeBuild artifactLocationOverride: '', artifactNameOverride: '', artifactNamespaceOverride: '', artifactPackagingOverride: '', artifactPathOverride: '', artifactTypeOverride: '', awsAccessKey: env.AWS_ACCESS_KEY_ID, awsSecretKey: env.AWS_SECRET_ACCESS_KEY, buildSpecFile: '', buildTimeoutOverride: '', credentialsId: '', credentialsType: 'keys', envVariables: '', projectName: '<project name>', proxyHost: '', proxyPort: '', region: 'us-east-1', sourceVersion: '', sseAlgorithm: ''
            }
            }


          2. Build the Pipeline job.

      ...

        1. Use the AWS CodeBuild plugin with the Jenkins build step.

          ...

              1. To create a Freestyle job

          ...

              1. type an item name in the Enter an item name

          ...

              1. text box; select Freestyle project, and then click OK.

          ...

              1. Image Added

          ...

              1. To invoke the AWS CodeBuild plugin by using a Jenkins build step

          ...

              1. , click the created freestyle job

          ...

              1. > Configure

          ...

              1. > Build

          ...

              1. > Add build step > Select AWS CodeBuild.
              2. Click AWS Configuration > Manually specify access and secret keys > Add your AWS Access Key and

          ...

              1. AWSSecret Key.
              2. Configure the region, project name, and source; either Use Project source or Use Jenkins source.

          ...

              1. Provide other properties as appropriate.
              2. Click Save.
              3. Build the freestyle job.

          ...

              1. Image Added
          1. Download and view the artifacts from S3 following a successful build.
            The artifacts are pushed to S3. As part of the artifact, it contains the built artifact and the risk profile report in PDF file format.

          Image Removed

          ...

          1. Image Added
          2. View more details about the scan results

          ...

          1. in your

          ...

          1. Black Duck Hub instance.

          Image Removed

          ...

          1. Image Added

          2. To view the console logs

          ...

          1. in Jenkins, click the created pipeline or freestyle job > finished build job # > CodeBuild:

          ...

          1. <project name> to view the CodeBuild Dashboard.

          ...

          1. Image Added