Skip to content

Instantly share code, notes, and snippets.

@jacepark12
Created December 6, 2019 13:25
Show Gist options
  • Select an option

  • Save jacepark12/693be9c14174d52236978e68fc0a0083 to your computer and use it in GitHub Desktop.

Select an option

Save jacepark12/693be9c14174d52236978e68fc0a0083 to your computer and use it in GitHub Desktop.
Sample circleci config.yml
version: 2.1
orbs:
aws-ecr: circleci/[email protected]
jobs:
coredns-tests:
machine:
image: ubuntu-1604:201903-01
working_directory: ~/go/src/${CIRCLE_PROJECT_USERNAME}/coredns
steps:
- run:
type: shell
name: Initialize Working Directory
pwd: /
command: |
mkdir -p ~/go/src/${CIRCLE_PROJECT_USERNAME}/coredns
sudo chown -R circleci ~/go
mkdir -p ~/go/out/tests
mkdir -p ~/go/out/logs
mkdir -p /home/circleci/logs
GOROOT=$(go env GOROOT)
sudo rm -r $(go env GOROOT)
sudo mkdir $GOROOT
LATEST=$(curl -s https://golang.org/VERSION?m=text)
curl https://dl.google.com/go/${LATEST}.linux-amd64.tar.gz | sudo tar xz -C $GOROOT --strip-components=1
- checkout
- run:
name: Build latest CoreDNS Docker image
command: |
cd ~/go/src/${CIRCLE_PROJECT_USERNAME}/coredns
make coredns SYSTEM="GOOS=linux" && \
docker build . -t coredns
- run:
name: Run Go tests
command: |
cd ~/go/src/${CIRCLE_PROJECT_USERNAME}/coredns/test
go test
workflows:
integration-tests:
jobs:
- coredns-tests
- aws-ecr/build_and_push_image:
requires:
- coredns-tests
account-url: "${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com"
repo: "${AWS_RESOURCE_NAME_PREFIX}"
region: ${AWS_DEFAULT_REGION}
tag: latest
filters:
branches:
only: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment