awslabs / aws-codedeploy-plugin

Jenkins plugin for AWS CodeDeploy
Apache License 2.0
153 stars 131 forks source link

Add Github deploy #81

Closed NoodlesNZ closed 6 years ago

NoodlesNZ commented 6 years ago

I'm submitting this PR under the Apache 2.0 License. I have built this plugin and deployed it to our Jenkins server and it's working as expected using Github deployments in Pipeline mode.

E.g.

stage('Deploy') {
      steps {
        input "Deploy?"

        withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'AWSCreds',
                        accessKeyVariable: 'awsAccessKey', secretKeyVariable: 'awsSecretKey']]) {

          step([$class: 'AWSCodeDeployPublisher',
            applicationName: 'site.com',
            awsAccessKey: env.awsAccessKey,
            awsSecretKey: env.awsSecretKey,
            credentials: 'awsAccessKey',
            deploymentGroupAppspec: false,
            deploymentGroupName: 'Production-site.com',
            deploymentConfig: 'CodeDeployDefault.OneAtATime',
            deploymentMethod: 'deploy',
            includes: '**',
            region: 'us-east-1',
            githubRepository: 'example/site',
            githubCommitId: env.GIT_COMMIT,
            waitForCompletion: true])
        }
      }
    }