Skip to content

HaeyoonJo/devops-handson-jenkins-pipeline-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CICD deployment using Jenkins pipeline to AWS Lambda function

Its README files are written in both, English and Korean. If you'd like to read in Korean, visit README_ko.md.

Jenkins supports for both Declarative and Scripted pipeline syntax. Scripted syntax allows you to write with programmatic flexibly, Declarative Syntax has been support lately with visually concise and aims for easy maintenance.

Due the purpose of this repo is to create and run the pipeline using Jenkins. Issues that I've faced related to Jenkins or Syntax, and advanced features will be managed by Github issue page.

Project description

Dockerized python app is executed in a Lambda function, and CICD pipeline is implemented through configured Jenkinsfile along with the simple branch strategy for testing and deployments.

In the attached architecture image below, you can estimate of what resources is being executes and deploys in each stages by looking at it.

Image should be updated following new Jenkinsfile

Jenkins Pipeline

  1. Agent
  • I specified any agent, so the Jenkins pipeline can be run in any available environment. You can take a look about Agent parameters by visiting Jenkins Agent parameters docs.
  1. Parameters
  • the pipeline gets the parameters from Jenkins job that has configured in the Jenkins configuration, In order to keep the critical data such as credentials in security purpose. By that, I expect making easier to collaborate and reduce security issues that might be incur.
  1. Environment
  • Declared Constants variables to be used in the Jenkinsfile.
  1. Build
  • building docker image using docker.build() by Docker pipeline. You can also take a look other functions for pipeline script in the following pipeline-syntax page
  1. RIE Test
  • Python app is being generated as docker image and upload into Lambda function. In order for running test can be done by RIE (Runtime Interface Emulator), which AWS supports.
  1. Login ECR
  • Using withAWS() of aws-pipeline, you can execute command that logging into and let you able to access its ECR using sh within the withAWS() function. the command you want to insert is on ECR Console, then you can copy from the pop-up page. For instance, you can execute the command as below:
aws ecr get-login-password \
    --region "YOUR_REGION" \
    | docker login \
    --username AWS \
    --password-stdin "YOUR ECR REPO URI"

About

Jenkins-pipeline deploying Lambda function with ECR

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published