Skip to content

Instantly share code, notes, and snippets.

Created Jun 15, 2018
What would you like to do?
modern Makefile for CI/CD, etc, w/AWS ECR. "WA" is 2-letter country-code for Wakanda
# System setup
SHELL = bash
AWS_ACCOUNT_ID ?= 100000000001
AWS_REGION ?= wa-north-7
AWS_SECRET_ACCESS_KEY ?= Z9xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+
test: ## Run a basic test suite, currently just the PEP8 style check
pycodestyle *py --show-source
ecr_login: ## Login to the ECR using credentials
@eval $$(AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID) AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY) aws --region $(AWS_REGION) ecr get-login --no-include-email)
python_install: ## Set up Python virtualenv and install dependencies
virtualenv -p $$(which python3) ./venv && ./venv/bin/pip install -r requirements.txt
help: ## Show This Help
@for line in $$(cat Makefile | grep "##" | grep -v "grep" | sed "s/:.*##/:/g" | sed "s/\ /!/g"); do verb=$$(echo $$line | cut -d ":" -f 1); desc=$$(echo $$line | cut -d ":" -f 2 | sed "s/!/\ /g"); printf "%-30s--%s\n" "$$verb" "$$desc"; done
travis_setup: ## Setup the travis environment
@echo "Unshallowing repo"
@git fetch --unshallow
@git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
@git fetch origin
@sudo pip install awscli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment