Last active
December 6, 2019 13:17
-
-
Save jacepark12/cddf7cb66ec76ca8b68dc741aec38378 to your computer and use it in GitHub Desktop.
Example circleci config with aws-ecr orbs usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: 2.1 | |
| orbs: | |
| aws-ecr: circleci/aws-ecr@0.0.2 | |
| initWorkingDir: &initWorkingDir | |
| 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 | |
| integrationDefaults: &integrationDefaults | |
| machine: | |
| image: ubuntu-1604:201903-01 | |
| working_directory: ~/go/src/${CIRCLE_PROJECT_USERNAME}/coredns | |
| buildCoreDNSImage: &buildCoreDNSImage | |
| - run: | |
| name: Build latest CoreDNS Docker image | |
| command: | | |
| cd ~/go/src/${CIRCLE_PROJECT_USERNAME}/coredns | |
| make coredns SYSTEM="GOOS=linux" && \ | |
| docker build . -t coredns | |
| jobs: | |
| coredns-tests: | |
| <<: *integrationDefaults | |
| steps: | |
| - run: *initWorkingDir | |
| - checkout | |
| - <<: *buildCoreDNSImage | |
| - 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