Skip to content

Commit

Permalink
build: detach stg and prod deployment by using 'rc' on tag name
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioribeiro committed Nov 29, 2016
1 parent ac5abad commit 766e434
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
8 changes: 2 additions & 6 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,9 @@ build:
- AWS_SECRET_ACCESS_KEY=$$NP_AWS_SECRET_ACCESS_KEY
- GITHUB_TOKEN=$$NP_GITHUB_TOKEN
- ASG_TOPIC=$$NP_ASG_TOPIC
- COMMIT=$${COMMIT:0:7}
commands:
- git clone --depth=1 https://$GITHUB_TOKEN@github.com/$INFRA_REPO.git $NP_PATH
- go get github.com/${NP_REPO}
- np deploy transcoding-api:stg#$${COMMIT:0:7}
- aws autoscaling put-notification-configuration --auto-scaling-group-name transcoding-api-stg-$${COMMIT:0:7}-web --topic-arn ${ASG_TOPIC} --notification-types "autoscaling:EC2_INSTANCE_LAUNCH" "autoscaling:EC2_INSTANCE_LAUNCH_ERROR"
- np deploy transcoding-api:prd#$${COMMIT:0:7}
- aws autoscaling put-notification-configuration --auto-scaling-group-name transcoding-api-prd-$${COMMIT:0:7}-web --topic-arn ${ASG_TOPIC} --notification-types "autoscaling:EC2_INSTANCE_LAUNCH" "autoscaling:EC2_INSTANCE_LAUNCH_ERROR"
- make live
when:
event: tag
notify:
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
HTTP_ACCESS_LOG ?= access.log
HTTP_PORT ?= 8080
LOG_LEVEL ?= debug
TAG_SUFFIX := $(shell git describe --tags $(shell git rev-list --tags --max-count=1) | tail -c 3)

all: test

Expand Down Expand Up @@ -44,3 +45,13 @@ checkswagger:

runswagger:
go run swagger-ui-server/main.go

live:
git clone --depth=1 https://${GITHUB_TOKEN}@github.com/${INFRA_REPO}.git ${NP_PATH}
go get github.com/${NP_REPO}
np deploy transcoding-api:stg#${COMMIT}
aws autoscaling put-notification-configuration --auto-scaling-group-name transcoding-api-stg-${COMMIT}-web --topic-arn ${ASG_TOPIC} --notification-types "autoscaling:EC2_INSTANCE_LAUNCH" "autoscaling:EC2_INSTANCE_LAUNCH_ERROR"
ifneq ($(TAG_SUFFIX),rc)
np deploy transcoding-api:prd#${COMMIT}
aws autoscaling put-notification-configuration --auto-scaling-group-name transcoding-api-prd-${COMMIT}-web --topic-arn ${ASG_TOPIC} --notification-types "autoscaling:EC2_INSTANCE_LAUNCH" "autoscaling:EC2_INSTANCE_LAUNCH_ERROR"
endif
6 changes: 5 additions & 1 deletion bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ increment_version() {
((arr[2]++))
fi

echo "${arr[0]}.${arr[1]}.${arr[2]}"
if [ "$2" == "major" ]; then
echo "${arr[0]}.${arr[1]}.${arr[2]}"
else
echo "${arr[0]}.${arr[1]}.${arr[2]}-rc"
fi
}

update_changelog() {
Expand Down

0 comments on commit 766e434

Please sign in to comment.