Automated Job Pipeline

Ultimately automation should trigger on changes in the code repository.
To that end I need a GitHub Webhook to trigger the pipeline.

The entpoint that get the trigger could be either a server that I am running or a service that AWS provides.

If I run my own service I would need to keep that online on my own cost.
Running a t2.nano on AWS costs 60$ per year – really cheap – not cheap enough.

So the next thing I looked into were AWS Code Pipelines. The trigger reaches AWS and I do not need to run anything. After that the code pipeline executed for a few minutes and quits again. So the costs are so low I could not even put a number on it.

Setting up CI / CD was very simple. Effectively AWS automatically connects with the repo and sets up the hooks for you – all you need is to authorize AWS to connect to the Github API in your name.

Since I want to pull my gcc compiler from hub.docker.com I ran into an Issue where docker just would not want to run on the Pipeline Machine. It turns out there are a few configuration options hidden in the Environment section of the Code Pipeline configuration.

Image Override reveals the option to upgrade the pipeline.
I needed:

  • aws/codebuild/standard 2.0
  • Check Priviledged

Checking both these options made my pipeline run and complete successfully.


version: 0.2
phases:
install:
runtime-versions:
docker: 18
pre_build:
commands:
- docker pull gcc
build:
commands:
- docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp gcc make
artifacts:
files:
- ./main

The output artifacs ended up in an S3 bucket

If you just want to hang out you may have a chance to catch me on  twitch .
Get in touch on twitter

Here are all the links I ended up inspecting for this:

S3 Caculator
Amazon CI/CD Practices
Expedia’s Automated CI/CD
How to Deploy a Jenkins Cluster on AWS in a Fully Automated CI/CD Platform
Save up to 90% on CI/CD
Accelerating DevOps Pipelines with AWS
/var/run/docker.sock
Setting up a CICD Pipeline for Containers on AWS
CodePipeline User Guide
CodePipeline Pipeline Structure Reference
How to apply CI/CD by using GitHub, CodeBuild, CodePipeline and ECS
Amazon ECR Sample for CodeBuild
Troubleshooting CodeBuild
Build Specification Reference for CodeBuild
Runtime version selection is not supported by this build image
Change a Build Project’s Settings in CodeBuild
How to run docker-compose on AWS CodeBuild?