Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Configure Shared Library in Jenkins UI

  • Go to Manage Jenkins > Configure System.

  • Scroll to Global Pipeline Libraries.

  • Add a new library with:

Create a jenkins pipeline type is pipeline and pass below info according to your service.

  • There are five shared library functions.

    1. branchBaseBuildDeployECS In this function six stages are there Git Checkout, ECR Login, Docker Build, Docker Push, Deploy to ECS, Cleanup.
    @Library('jenkins-shared-lib') _  // Name configured in Jenkins > Global Pipeline Libraries
    branchBaseBuildDeployECS(
        agentLabel: 'docker-builder',                     // Optional if your shared lib supports it
        bitbucketRepoUrl: 'https://github.com/singhragvendra503/myapplication-service.git',
        ecrRegistry: '112233445566.dkr.ecr.ap-south-1.amazonaws.com',
        imageName: 'myapplication-service',
        imageTag: 'prod',                                  // Optional if handled internally
        clusterName: 'my-production-cluster',
        serviceName: 'prod-myapplication-service'
    )
    1. branchBaseBuildECS In this function five stages are there Git Checkout, ECR Login, Docker Build, Docker Push, Cleanup.
    @Library('jenkins-shared-lib') _  // Name configured in Jenkins > Global Pipeline Libraries
    branchBaseBuildDeployECS(
        agentLabel: 'docker-builder',                     // Optional if your shared lib supports it
        bitbucketRepoUrl: 'https://github.com/singhragvendra503/myapplication-service.git',
        ecrRegistry: '112233445566.dkr.ecr.ap-south-1.amazonaws.com',
        imageName: 'myapplication-service',
        imageTag: 'prod'
    )
    1. tagBaseBuildDeployECS Similer as branchBaseBuildDeployECS
    @Library('jenkins-shared-lib') _  // Name configured in Jenkins > Global Pipeline Libraries
    branchBaseBuildDeployECS(
        agentLabel: 'docker-builder',                     // Optional if your shared lib supports it
        bitbucketRepoUrl: 'https://github.com/singhragvendra503/myapplication-service.git',
        ecrRegistry: '112233445566.dkr.ecr.ap-south-1.amazonaws.com',
        imageName: 'myapplication-service',
        imageTag: 'prod',                                  // Optional if handled internally
        clusterName: 'my-production-cluster',
        serviceName: 'prod-myapplication-service'
    )
    1. tagBaseBuildECS Similer as branchBaseBuildECS
    @Library('jenkins-shared-lib') _  // Name configured in Jenkins > Global Pipeline Libraries
    branchBaseBuildDeployECS(
        agentLabel: 'docker-builder',                     // Optional if your shared lib supports it
        bitbucketRepoUrl: 'https://github.com/singhragvendra503/myapplication-service.git',
        ecrRegistry: '112233445566.dkr.ecr.ap-south-1.amazonaws.com',
        imageName: 'myapplication-service',
        imageTag: 'prod'
    )
    1. branchBaseBuildDeployECSWithGradle6.5Tool Similer as branchBaseBuildDeployECS, Gradle Build but using gradle 6.5.
    @Library('jenkins-shared-lib') _
    
    branchBaseBuildDeployECS(
        agentLabel: 'docker-builder',
        bitbucketRepoUrl: 'https://github.com/singhragvendra503/myapplication-service.git',
        ecrRegistry: '112233445566.dkr.ecr.ap-south-1.amazonaws.com',
        imageName: 'myapplication-service',
        imageTag: 'prod',
        clusterName: 'my-production-cluster',
        serviceName: 'prod-myapplication-service',
        mavenTool: 'Maven 3.8.6'
    )

These tools currently in use

tools {
            gradle 'Gradle6.5'
        }

Note:- You can make these shared library more dynamic like pass Dockerfile name if you are using different file for different environments.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages