Skip to content

Help securingdevops #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
44 changes: 44 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: 2
jobs:
build:
# Variable expansion in working_directory not supported at this time
# You will need to modify the code below to reflect your github account/repo setup
working_directory: /go/src/github.com/Securing-DevOps/deployer
docker:
- image: circleci/golang:latest
environment:
GO15VENDOREXPERIMENT: 1
branches:
only:
- master
steps:
- checkout
- setup_remote_docker

- run: echo 'export GOPATH_HEAD="$(echo ${GOPATH}|cut -d ':' -f 1)"' >> $BASH_ENV
- run: echo 'export GOPATH_BASE="${GOPATH_HEAD}/src/github.com/${CIRCLE_PROJECT_USERNAME}"' >> $BASH_ENV
- run: echo 'export DOCKER_REPO="$(if [ ${CIRCLE_PROJECT_USERNAME} == 'securingdevops' ]; then echo securingdevops; else echo $DOCKER_USER; fi)"' >> $BASH_ENV
- run: mkdir -p "${GOPATH_BASE}"
- run: mkdir -p "${GOPATH_HEAD}/bin"
- run: go get github.com/govend/govend
- run: sudo apt-get -y install awscli

- run:
name: Build application container
command: |
go install --ldflags '-extldflags "-static"' github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME};
[ ! -e bin ] && mkdir bin;
cp "${GOPATH_HEAD}/bin/${CIRCLE_PROJECT_REPONAME}" bin/deployer;
chmod +x deploymentTests/*
docker build -t ${DOCKER_REPO}/${CIRCLE_PROJECT_REPONAME} .;

- deploy:
# Push application container to dockerhub
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
echo ${DOCKER_PASS} | docker login -u ${DOCKER_USER} --password-stdin;
echo ${DOCKER_USER}/${CIRCLE_PROJECT_REPONAME}:${CIRCLE_TAG};
docker images --no-trunc | awk '/^app/ {print $3}' | sudo tee $CIRCLE_ARTIFACTS/docker-image-shasum256.txt;
docker push ${DOCKER_REPO}/${CIRCLE_PROJECT_REPONAME};
fi
aws elasticbeanstalk update-environment --region us-east-1 --application-name invoicer201707071231 --environment-id e-h4vyur8nup --version-label deployer-api
60 changes: 0 additions & 60 deletions circle.yml

This file was deleted.