Skip to content

Instantly share code, notes, and snippets.

@StevenACoffman
Last active December 28, 2019 23:49
Show Gist options
  • Save StevenACoffman/1b950dc7fd215b14f83eee7a515fa708 to your computer and use it in GitHub Desktop.
Save StevenACoffman/1b950dc7fd215b14f83eee7a515fa708 to your computer and use it in GitHub Desktop.
Continuous Delivery Ideas

Hackathon Requirements

In order to organize a hackathon, we have to describe:

  • What the hackathon is about
  • What the benefits are
  • How the results/benefits will be reported
  • then talk to the resource managers and product managers with that stuff

General Requirements

We want per-branch automatic k8s deploys in our staging environment. Each github branch of a repo has an instance of <app-name>-<branch> running. Deployments self-destruct after 4 hours if the branch is not master. Anyone can trigger a new build with a comment on a pull request (or new commit).

Stuff:

  • Slack
  • Github
  • Sagoku
  • Kubernetes

Sigh. Jenkins.

  • Declarative pipelines

ArgoCD

ArgoCD

Concourse

More AWS Lambda, Codebuild, CodePipeline, and CodeDeploy resources

AWS CodePipeline and CodeBuild

You can specify an alternate buildspec location in the buildspec or buildspecOverride parameter to Create/UpdateProject or StartBuild.

The buildspec path is relative to the root of your Git repo. So you can use, e.g., ./subdir/buildspec.yml

You can find the documentation here: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-name-storage

CodePipeline
CodeBuild
CodeDeploy:

Kubernetes

We can use my home grown kube-deploy-cleaner: https://github.com/StevenACoffman/kube-deploy-cleaner

At docker build time, putting a git ignored file in the docker container that contains the git sha1 that generated it and other information lets you reliably discover what source code generated it.

IMAGE            = stevenacoffman/kube-deploy-cleaner
VERSION          = $(git describe --tags --always --dirty)
TAG              = ${VERSION}
GITHEAD          = $(git rev-parse --short HEAD)
GITURL           = $(git config --get remote.origin.url)
GITSTATUS        = $(git status --porcelain || echo "no changes")
echo '{"url": "git:${GITURL}", "revision": "${GITHEAD}", "author": "${USER}", "status": "${GITSTATUS}"}' > scm-source.json`

This allows you to look at it via: kubectl cp <some-namespace>/<some-pod>:/scm-source.json /tmp/bar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment