https://github.com/awslabs/aws-codebuild-jenkins-plugin

AWS CodeBuild integration as a Jenkins build step.

https://github.com/awslabs/aws-codebuild-jenkins-plugin

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.3%) to scientific vocabulary

Keywords

aws aws-codebuild codebuild continuous-integration devops jenkins-plugin serverless
Last synced: 5 months ago · JSON representation

Repository

AWS CodeBuild integration as a Jenkins build step.

Basic Info
Statistics
  • Stars: 152
  • Watchers: 24
  • Forks: 126
  • Open Issues: 25
  • Releases: 0
Topics
aws aws-codebuild codebuild continuous-integration devops jenkins-plugin serverless
Created about 9 years ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License

README.md

AWS CodeBuild Jenkins Plugin

The AWS CodeBuild plugin for Jenkins provides a build step for your Jenkins project.

Build Status license Build Status

Plugin Installation

If you already have a Jenkins setup and would like to only install the AWS CodeBuild plugin, then the recommended approach would be to search for "AWS CodeBuild" in the Plugin Manager on your Jenkins instance.

Plugin Usage

Using AWS CodeBuild with source available outside of your VPC

  1. Create Project on the AWS CodeBuild console.
    • Switch to the region you would prefer to run the build in.
    • You can optionally set the Amazon VPC configuration to allow CodeBuild build container to access resources within your VPC.
    • Make sure to write down the project's name.
    • (Optional) If your source repository is not natively supported by CodeBuild, you can set the input source type for your project as S3 for the CodeBuild project.
  2. Create AWS IAM user to be used by the Jenkins plugin.
    • Create a policy similar to the one following this section.
    • Go to the IAM console, and create a new user.
      • Access type should be: Programmatic Access.
      • Attach policy to user that you created previously.
  3. Create a freestyle project in Jenkins.

    • On the Configure page, choose Add build step > Run build on AWS AWS CodeBuild.
    • Configure your build step.
      • Enter Region, Credentials from the user created previously, and ProjectName.
      • Select Use Project source.
      • Save the configuration and run a build from Jenkins.
  4. For the Source Code Management make sure to select how you would like to retrieve your source. You may need to install the GitHub Plugin (or the relevant source repository provider's Jenkins plugin) to your Jenkins server.

    • On the Configure page, choose Add build step > Run build on AWS CodeBuild. Configure the build step.
    • Enter Region, Credentials from the user created previously, and Project name.
    • Select Use Jenkins source.
    • Save the configuration and run a build from Jenkins.

Policy sample for IAM user: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Resource": ["arn:aws:logs:{{region}}:{{awsAccountId}}:log-group:/aws/codebuild/{{projectName}}:*"], "Action": ["logs:GetLogEvents"] }, { "Effect": "Allow", "Resource": ["arn:aws:s3:::{{inputBucket}}"], "Action": ["s3:GetBucketVersioning"] }, { "Effect": "Allow", "Resource": ["arn:aws:s3:::{{inputBucket}}/{{inputObject}}"], "Action": ["s3:PutObject"] }, { "Effect": "Allow", "Resource": ["arn:aws:s3:::{{outputBucket}}/*"], "Action": ["s3:GetObject"] }, { "Effect": "Allow", "Resource": ["arn:aws:codebuild:{{region}}:{{awsAccountId}}:project/{{projectName}}"], "Action": ["codebuild:StartBuild", "codebuild:BatchGetBuilds", "codebuild:BatchGetProjects"] } ] }

Using the AWS CodeBuild plugin with the Jenkins Pipeline plugin

Use the snippet generator (click "Pipeline Syntax" on your pipeline project page) to generate the pipeline script that adds CodeBuild as a step in your pipeline. It should generate something like

awsCodeBuild projectName: 'project', credentialsType: 'keys', region: 'us-west-2', sourceControlType: 'jenkins'

Additionally, this returns a result object which exposes the following methods which can be useful to later steps:

  • getBuildId(): returns the build ID of the build (similar to codebuild-project-name:12346789-ffff-0000-aaaa-bbbbccccdddd)
  • getArn(): returns the ARN of the build (similar to arn:aws:codebuild:AWS_REGION:AWS_ACCOUNT_ID:build/CODEBUILD_BUILD_ID, where CODEBUILD_BUILD_ID is the same information returned in getBuildId)
  • getArtifactsLocation(): returns the S3 ARN of the artifacts location (similar to arn:aws:s3:::s3-bucket-name/path/to/my/artifacts)

AWS Credentials in Jenkins

It's recommended to use the Jenkins credentials store for your AWS credentials. Your Jenkins credentials must be of type CodeBuild Credentials to be compatible with the CodeBuild plugin. When creating new CodeBuild Credentials, the plugin will attempt to use the default credentials provider chain if AWS access and secret keys are not defined. You can also specify your AWS access and secret keys and session token in the CodeBuild configuration when using credentialsType: 'keys'. Example:

awsCodeBuild projectName: 'project', credentialsType: 'keys', awsAccessKey: env.AWS_ACCESS_KEY_ID, awsSecretKey: env.AWS_SECRET_ACCESS_KEY, awsSessionToken: env.AWS_SESSION_TOKEN, ...

If the access/secret keys and session token are not specified, the plugin will attempt to use the default credentials provider chain. When running a Jenkins pipeline build, the plugin will attempt to use credentials from the pipeline-aws plugin before falling back to the default credentials provider chain. If you are running Jenkins on an EC2 instance, leave the access and secret key fields blank and specify credentialsType: 'keys'to use credentials from your EC2 instance profile, which is in the default credentials provider chain.

Owner

  • Name: Amazon Web Services - Labs
  • Login: awslabs
  • Kind: organization
  • Location: Seattle, WA

AWS Labs

GitHub Events

Total
  • Issues event: 1
  • Watch event: 4
  • Fork event: 7
Last Year
  • Issues event: 1
  • Watch event: 4
  • Fork event: 7

Issues and Pull Requests

Last synced: almost 2 years ago

All Time
  • Total issues: 68
  • Total pull requests: 32
  • Average time to close issues: 3 months
  • Average time to close pull requests: 10 days
  • Total issue authors: 54
  • Total pull request authors: 12
  • Average comments per issue: 3.99
  • Average comments per pull request: 1.13
  • Merged pull requests: 23
  • Bot issues: 0
  • Bot pull requests: 16
Past Year
  • Issues: 1
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • ikedam (5)
  • caiohasouza (4)
  • cartolari (2)
  • robbinscpcg (2)
  • lkolchin (2)
  • Petezah (2)
  • Vidyapreetha (2)
  • sfernandezf (2)
  • ErmanB (2)
  • krm1 (1)
  • tarantegui (1)
  • justinfalk (1)
  • PiotrSzymczyk (1)
  • emaks (1)
  • YoonjiJang (1)
Pull Request Authors
  • dependabot[bot] (16)
  • ikedam (2)
  • akarnani (2)
  • clareliguori (2)
  • kotaroooo0 (2)
  • Petezah (2)
  • JLLeitschuh (1)
  • uttamk (1)
  • leoherran-aws (1)
  • vgamz (1)
  • shariqmus (1)
  • ghost (1)
Top Labels
Issue Labels
Feature Request (2) question (1) Documentation (1)
Pull Request Labels
dependencies (16)

Dependencies

pom.xml maven
  • org.projectlombok:lombok 1.18.10 provided
  • com.amazon.ion:ion-java 1.5.0
  • com.fasterxml.jackson.core:jackson-databind 2.12.6.1
  • joda-time:joda-time 2.10.4
  • net.lingala.zip4j:zip4j 2.10.0
  • org.jenkins-ci.plugins.workflow:workflow-step-api 2.5
  • org.jenkins-ci.plugins:aws-java-sdk 1.12.80
  • org.jenkins-ci.plugins:cloudbees-folder 6.1.0
  • org.jenkins-ci.plugins:credentials 2.6.1.1
  • org.jenkins-ci.plugins:script-security 1.75
  • org.objenesis:objenesis 3.0.1
  • org.mockito:mockito-core 2.0.42-beta test
  • org.powermock:powermock-api-mockito2 1.6.6 test
  • org.powermock:powermock-module-junit4 1.6.6 test