Jenkins Pipelines on AWS
AWS Setup
| Criteria | Meet Specification |
|---|---|
|
Set up IAM credentials properly. |
A new user with EC2 and S3 access is created that is not the root/admin user in AWS. A screenshot with the unique AWS URL showing should be provided. |
|
Launch EC2 instance. |
An Ubuntu 18.04 t2.micro is launched and can be accessed via SSH using the PEM file. A screenshot with the unique AWS URL showing should be provided. |
Running Jenkins
| Criteria | Meet Specification |
|---|---|
|
Jenkins is installed and running |
The Jenkins instance can be reached over HTTP publicly, a login screen should show if not logged in. A screenshot with unique AWS url should be provided. |
|
‘Blue Ocean’ is enabled |
The ‘Blue Ocean’ link should show in the sidebar and should load its interface, which is completely different from the standard Jenkins. A screenshot with unique AWS url should be provided. |
|
Barebones Pipeline is added |
The GitHub repository is added and shows in the BlueOcean dashboard, automatically recognizing the Jenkinsfile and setting up the initial pipeline that has 1 stage. A screenshot with unique AWS url should be provided. |
Working Pipeline
| Criteria | Meet Specification |
|---|---|
|
Publishes the static site to S3 |
The index.html file is published to the correct bucket in the right region, and the url is accessible via HTTP from anywhere. A screenshot with unique AWS url should be provided. |
|
Linter catches issues with HTML |
After adding a linter, it catches HTML problems with the sample index.html, after addressing the problems with the html, the job passes and publishes the contents once again - build is passing. A screenshot with unique AWS url should be provided. |
|
Jenkinsfile is demonstrated |
A Jenkinsfile exists, that has the stages and steps defined that match how the pipeline looks in the Jenkins dashboard. For example ‘stage(‘Lint HTML’)’ should show as ‘Lint HTML’ in the pipeline. The AWS credentials and bucket name should all map to an existing S3 bucket that is publicly accessible and that it displays the contents of the index.html file. A screenshot with the S3 URL should be provided. |
Tips to make your project standout:
- The Jenkinsfile can be extended easily, we added a linting stage, other steps can be added like ensuring content is up with a curl command.
- “Steps” have useful features like a ‘retry’, anything that can be added to make it a robust deployment is great. See the reference guide.
3.The project was created with a “poll” to check for Github changes. A webhook can be added instead that makes Github tell Jenkins to start building automatically. Github has a good guide on how to do this. - Another option that can be done is using Canary Deployments. A Canary deployment is a more involved setup, and would require to progressively route users to the new version deployed, and fully transitioning over when confidence is high, otherwise reverting the release to the older version.
More info about canary deployments at: https://martinfowler.com/bliki/CanaryRelease.html - A blue/green deployment, is similar to the canary deployment where two deployments exist and when the new version is available and passes certain conditions, it can be ‘swapped’ for the new one, and otherwise reverting to the older version. Amazon has a guide for CodePipeline that can be used as a reference: https://aws.amazon.com/quickstart/architecture/blue-green-deployment/