Skip to content

dvyas1/jenkins-pipeline-aws-shared-lib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jenkins-pipeline-aws-shared-lib

This project provides easy AWS shared library which can be used into Jenkins pipeline. References:

Setup instructions

In Jenkins, go to Manage Jenkins → Configure System. Under Global Pipeline Libraries, add a library with the following settings:

Then create a Jenkins job with the following pipeline (note that the underscore _ is not a typo):

@Library('jenkins-pipeline-aws-shared-lib')_

def aws = new com.jenkins.aws.Pipeline()

docker.image('garland/aws-cli-docker').inside {
    withAWS(credentials: 'aws-credentials',region: 'us-east-1'){
                    
        stage('Get or create ECS cluster'){
            ecrLogin = aws.awsECRGetLogin()
            println ecrLogin
        }
    }
}

Or:

@Library('jenkins-pipeline-aws-shared-lib') import com.jenkins.aws.Pipeline

def aws = new Pipeline()

//...

For template utils use:

@Library('jenkins-pipeline-aws-shared-lib') _ 

def template = new com.jenkins.utis.Template()

node {
    stage('Generate worker from template'){
                def binding = [:]
                binding.workerId    = "12345"
                binding.workerName  = "Tomer"

    
                def templateFile = "worker.template"
                def dstFile      = "worker.json"
                template.createFromTemplate(templateFile, binding ,dstFile)
    }
}

About

Jenkins pipeline library for AWS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Groovy 100.0%