Workflow

Whenever the latest code pushed in master branch, Jenkins will get triggered and it will pick up the Jenkinsfile. In the Jenkinsfile, the following things will be mentioned:

  • Pull the repository in the Jenkins server
  • Then it will build the image of the application
  • It will upload the image to ECR
  • The next step depends upon the value on parameter, that whether we want to deploy the latest image in Kubernetes cluster or simply want to push the image to ECR
  • Then, it will ssh to the Kubernetes cluster and update the latest image in the deployment

Now, we have to implement the workflow in Jenkinsfile:

  1. Let's start with the agent section. Agent will be the Jenkins master only:
    pipeline {     agent any    }
  1. Let's talk about the parameter. The ...

Get AWS Automation Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.