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:
- Let's start with the agent section. Agent will be the Jenkins master only:
pipeline { agent any }
- Let's talk about the parameter. The ...