From bb4f6f74542249abf307dc0ee28e18d4a117a9ac Mon Sep 17 00:00:00 2001 From: Casey Lee Date: Fri, 21 Sep 2018 15:27:17 -0700 Subject: [PATCH 1/6] enhancements to circleci (v2.1) --- .circleci/config.yml | 54 ++-- .gitignore | 4 +- .goreleaser.yml | 16 ++ CHANGELOG.md | 599 ------------------------------------------- Makefile | 205 +++++++-------- 5 files changed, 141 insertions(+), 737 deletions(-) create mode 100644 .goreleaser.yml delete mode 100644 CHANGELOG.md diff --git a/.circleci/config.yml b/.circleci/config.yml index d5553451..22779eb5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,9 +1,19 @@ -version: 2 +version: 2.1 -jobs: - cfn-nag: +executors: + golang-executor: + docker: + - image: circleci/golang:1.10 + working_directory: /go/src/github.com/stelligent/mu + environment: + AWS_REGION: us-west-2 + ruby-executor: docker: - image: circleci/ruby:2.4.2-jessie-node + +jobs: + cfn-nag: + executor: ruby-executor steps: - checkout - run: @@ -11,11 +21,7 @@ jobs: command: make nag unit-test: - environment: - AWS_REGION: us-west-2 - docker: - - image: circleci/golang:1.10 - working_directory: /go/src/github.com/stelligent/mu + executor: golang-executor steps: - checkout - restore_cache: @@ -36,9 +42,7 @@ jobs: - ~/.cache/go-build release: - docker: - - image: circleci/golang:1.10 - working_directory: /go/src/github.com/stelligent/mu + executor: golang-executor steps: - checkout @@ -65,33 +69,41 @@ jobs: git config --global user.email "cplee+mu@nektos.com" git config --global user.name "mu-ci" - #make release - #make formula + make release - store_artifacts: - path: artifacts + path: dist workflows: version: 2 + test-and-snapshot: + jobs: + - unit-test: + - cfn-nag: + - release: + requires: + - unit-test + - cfn-nag + filters: + branches: + only: + - develop + - master test-and-release: jobs: - unit-test: filters: tags: - ignore: /^v[0-9]/ + only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ - cfn-nag: filters: tags: - ignore: /^v[0-9]/ + only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ - release: requires: - unit-test - cfn-nag filters: tags: - ignore: /^v[0-9]/ - branches: - only: - - develop - - master + only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ diff --git a/.gitignore b/.gitignore index 1c305bd2..4106b75e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ *.iml .idea .vscode -.release/ +.cfn_nag +dist/ vendor/ *~ homebrew-tap/ *-packr.go +CHANGELOG.md diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..62ef5d9a --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,16 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +builds: +- env: + - CGO_ENABLED=0 + goos: + - darwin + - linux + - windows +archive: + format: binary + name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Env.SNAPSHOT_VERSION }}" diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index ffec8b27..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,599 +0,0 @@ -# Change Log - -## [v1.5.3](https://github.com/stelligent/mu/tree/v1.5.3) (2018-09-12) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.5.2...v1.5.3) - -**Fixed bugs:** - -- Namespace with hyphen [\#327](https://github.com/stelligent/mu/issues/327) - -**Closed issues:** - -- Validate config file [\#258](https://github.com/stelligent/mu/issues/258) - -**Merged pull requests:** - -- Issue 258 - Validation [\#325](https://github.com/stelligent/mu/pull/325) ([mneil](https://github.com/mneil)) - -## [v1.5.2](https://github.com/stelligent/mu/tree/v1.5.2) (2018-08-30) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.5.1...v1.5.2) - -**Fixed bugs:** - -- Unable to provision schedule tasks [\#322](https://github.com/stelligent/mu/issues/322) -- Namespace not honored when terminating environments [\#316](https://github.com/stelligent/mu/issues/316) -- AccessDenied when directory's name different from repo's name [\#300](https://github.com/stelligent/mu/issues/300) - -**Closed issues:** - -- Quickstart Basic Guide Fails on mu pipeline up [\#318](https://github.com/stelligent/mu/issues/318) -- Code pipeline error [\#312](https://github.com/stelligent/mu/issues/312) -- Parameterised timeouts for pipeline steps [\#214](https://github.com/stelligent/mu/issues/214) - -**Merged pull requests:** - -- Issue \#214 - Added DeployTimeout to allow pipline timeout override [\#321](https://github.com/stelligent/mu/pull/321) ([mneil](https://github.com/mneil)) -- fix \#316 - Namespace not honored when terminating environments [\#317](https://github.com/stelligent/mu/pull/317) ([cplee](https://github.com/cplee)) - -## [v1.5.1](https://github.com/stelligent/mu/tree/v1.5.1) (2018-08-14) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.4.6...v1.5.1) - -**Fixed bugs:** - -- mu svc restart appears to restart all services, rather than the specified service [\#279](https://github.com/stelligent/mu/issues/279) -- Problems converging a base environment in us-west-1 [\#195](https://github.com/stelligent/mu/issues/195) - -**Closed issues:** - -- Use existing ECS Cluster [\#301](https://github.com/stelligent/mu/issues/301) -- Integrate with new native ECS service discovery [\#299](https://github.com/stelligent/mu/issues/299) -- mu pipeline term not removing the pipeline? [\#288](https://github.com/stelligent/mu/issues/288) -- codepipeline may be making unauthenticated calls to github [\#287](https://github.com/stelligent/mu/issues/287) -- mu-env.sh has a weird string included in 1.4.3 [\#286](https://github.com/stelligent/mu/issues/286) -- Support adding a hosted internal route53 zone [\#252](https://github.com/stelligent/mu/issues/252) -- Support choosing deployment strategy [\#251](https://github.com/stelligent/mu/issues/251) - -**Merged pull requests:** - -- Remove consul [\#314](https://github.com/stelligent/mu/pull/314) ([cplee](https://github.com/cplee)) -- 1.5.1 development [\#313](https://github.com/stelligent/mu/pull/313) ([cplee](https://github.com/cplee)) - -## [v1.4.6](https://github.com/stelligent/mu/tree/v1.4.6) (2018-07-30) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.4.5...v1.4.6) - -**Closed issues:** - -- can i change the pipeline name [\#311](https://github.com/stelligent/mu/issues/311) -- Can I use mu to initiate a rollback? [\#310](https://github.com/stelligent/mu/issues/310) -- period\(.\) in image tag in mu version 1.4.5 [\#308](https://github.com/stelligent/mu/issues/308) -- Update DB Username field in CFN for cfn\_nag F24 [\#306](https://github.com/stelligent/mu/issues/306) -- Logging provider assumptions during push [\#304](https://github.com/stelligent/mu/issues/304) -- Support for Gitlab as pipeline source provider [\#302](https://github.com/stelligent/mu/issues/302) -- Invalid image tag [\#295](https://github.com/stelligent/mu/issues/295) - -**Merged pull requests:** - -- Log provider assumptions [\#305](https://github.com/stelligent/mu/pull/305) ([rmc3](https://github.com/rmc3)) - -## [v1.4.5](https://github.com/stelligent/mu/tree/v1.4.5) (2018-03-15) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.4.4...v1.4.5) - -**Closed issues:** - -- Update README.md [\#294](https://github.com/stelligent/mu/issues/294) - -## [v1.4.4](https://github.com/stelligent/mu/tree/v1.4.4) (2018-03-08) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.4.3...v1.4.4) - -**Fixed bugs:** - -- S3 Revision ID's can begin with a period \(.\) which leads to invalid Docker tags [\#283](https://github.com/stelligent/mu/issues/283) -- \#283 Stripping all ., - and \_ characters from revision ID [\#291](https://github.com/stelligent/mu/pull/291) ([akuma12](https://github.com/akuma12)) - -## [v1.4.3](https://github.com/stelligent/mu/tree/v1.4.3) (2018-02-28) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.4.2...v1.4.3) - -**Fixed bugs:** - -- Need to propagate the namespace from the pipeline into the mu calls [\#281](https://github.com/stelligent/mu/issues/281) -- Fix for issue \#283 [\#284](https://github.com/stelligent/mu/pull/284) ([akuma12](https://github.com/akuma12)) - -**Merged pull requests:** - -- v1.4.3 [\#285](https://github.com/stelligent/mu/pull/285) ([cplee](https://github.com/cplee)) -- add `MU\_NAMESPACE` for mu commands [\#282](https://github.com/stelligent/mu/pull/282) ([cplee](https://github.com/cplee)) - -## [v1.4.2](https://github.com/stelligent/mu/tree/v1.4.2) (2018-02-09) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.4.1...v1.4.2) - -**Closed issues:** - -- Update ASG health check to EC2 when no target group for EC2 provider [\#276](https://github.com/stelligent/mu/issues/276) - -**Merged pull requests:** - -- v1.4.2 [\#278](https://github.com/stelligent/mu/pull/278) ([cplee](https://github.com/cplee)) -- Issue 276 [\#277](https://github.com/stelligent/mu/pull/277) ([cplee](https://github.com/cplee)) - -## [v1.4.1](https://github.com/stelligent/mu/tree/v1.4.1) (2018-01-24) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.3.2...v1.4.1) - -**Implemented enhancements:** - -- Add support for pipeline failure notifications [\#230](https://github.com/stelligent/mu/issues/230) - -**Closed issues:** - -- is it possible to infer the repo path from the local checkout? [\#268](https://github.com/stelligent/mu/issues/268) -- Use codepipeline ecs deploy target, rather than cloudformation? [\#266](https://github.com/stelligent/mu/issues/266) -- prompt for github token near the beginning of "mu pipeline up" [\#263](https://github.com/stelligent/mu/issues/263) -- support discovering subnet values and vpc id by targeting another mu service by name [\#253](https://github.com/stelligent/mu/issues/253) - -**Merged pull requests:** - -- v1.4.1 [\#269](https://github.com/stelligent/mu/pull/269) ([cplee](https://github.com/cplee)) -- Issue 230 [\#264](https://github.com/stelligent/mu/pull/264) ([cplee](https://github.com/cplee)) -- add support for centos7 for env provider [\#262](https://github.com/stelligent/mu/pull/262) ([cplee](https://github.com/cplee)) - -## [v1.3.2](https://github.com/stelligent/mu/tree/v1.3.2) (2018-01-11) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.2.6...v1.3.2) - -**Fixed bugs:** - -- Unable to update Service with target tracking capabilities if they weren't already there [\#259](https://github.com/stelligent/mu/issues/259) -- Issue 259 Added application-autoscaling:DescribeScheduledActions perm… [\#260](https://github.com/stelligent/mu/pull/260) ([akuma12](https://github.com/akuma12)) - -**Merged pull requests:** - -- v1.3.2 [\#261](https://github.com/stelligent/mu/pull/261) ([cplee](https://github.com/cplee)) - -## [v0.2.6](https://github.com/stelligent/mu/tree/v0.2.6) (2018-01-10) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.3.1...v0.2.6) - -**Implemented enhancements:** - -- Add support for CodeBuild's caching feature [\#229](https://github.com/stelligent/mu/issues/229) - -**Closed issues:** - -- Add support for artifact caching in CodeBuild [\#242](https://github.com/stelligent/mu/issues/242) - -## [v1.3.1](https://github.com/stelligent/mu/tree/v1.3.1) (2018-01-08) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.2.3...v1.3.1) - -**Implemented enhancements:** - -- Add support for linking containers [\#244](https://github.com/stelligent/mu/issues/244) -- Add custom KMS key for mu [\#128](https://github.com/stelligent/mu/issues/128) -- Support for extra user data script [\#246](https://github.com/stelligent/mu/pull/246) ([nilsga](https://github.com/nilsga)) - -**Fixed bugs:** - -- Updated the ECSTaskDefinitionOutputKey output key constant to reflect what the templates use [\#256](https://github.com/stelligent/mu/pull/256) ([BrianJakovich](https://github.com/BrianJakovich)) - -**Merged pull requests:** - -- use blue/green deploy as default [\#254](https://github.com/stelligent/mu/pull/254) ([brentley](https://github.com/brentley)) -- v1.3.1 [\#249](https://github.com/stelligent/mu/pull/249) ([cplee](https://github.com/cplee)) -- Issue 128 [\#247](https://github.com/stelligent/mu/pull/247) ([cplee](https://github.com/cplee)) -- Add support for docker links [\#245](https://github.com/stelligent/mu/pull/245) ([nilsga](https://github.com/nilsga)) - -## [v1.2.3](https://github.com/stelligent/mu/tree/v1.2.3) (2017-12-11) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.2.2...v1.2.3) - -## [v1.2.2](https://github.com/stelligent/mu/tree/v1.2.2) (2017-12-09) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.2.1...v1.2.2) - -## [v1.2.1](https://github.com/stelligent/mu/tree/v1.2.1) (2017-12-07) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.1.3...v1.2.1) - -**Implemented enhancements:** - -- Add environment provider for ECS+Fargate [\#234](https://github.com/stelligent/mu/issues/234) - -**Fixed bugs:** - -- Mu files with different names are ignored when generating env.json [\#236](https://github.com/stelligent/mu/issues/236) - -**Merged pull requests:** - -- Release 1.2.1 [\#239](https://github.com/stelligent/mu/pull/239) ([cplee](https://github.com/cplee)) -- add support for fargate as an environment provider [\#238](https://github.com/stelligent/mu/pull/238) ([cplee](https://github.com/cplee)) - -## [v1.1.3](https://github.com/stelligent/mu/tree/v1.1.3) (2017-12-05) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.1.2...v1.1.3) - -**Implemented enhancements:** - -- Externalize S3 Bucket creation [\#216](https://github.com/stelligent/mu/issues/216) -- Dynamic variables in mu.yml [\#209](https://github.com/stelligent/mu/issues/209) -- Add option to set the http proxy the SDK will use [\#223](https://github.com/stelligent/mu/pull/223) ([mince27](https://github.com/mince27)) - -**Merged pull requests:** - -- Fix for issue 236: Added -c flag to env show command to generate env.… [\#237](https://github.com/stelligent/mu/pull/237) ([akuma12](https://github.com/akuma12)) -- Feature/externalize s3 bucket [\#226](https://github.com/stelligent/mu/pull/226) ([cplee](https://github.com/cplee)) -- Issue 209 documentation \(environment variable substitution\) [\#225](https://github.com/stelligent/mu/pull/225) ([timbaileyjones](https://github.com/timbaileyjones)) -- Issue 209 dynamic variables [\#224](https://github.com/stelligent/mu/pull/224) ([timbaileyjones](https://github.com/timbaileyjones)) - -## [v1.1.2](https://github.com/stelligent/mu/tree/v1.1.2) (2017-11-16) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.1.1...v1.1.2) - -**Fixed bugs:** - -- Issue with mu env -f json [\#221](https://github.com/stelligent/mu/issues/221) - -**Merged pull requests:** - -- fix \#221 [\#222](https://github.com/stelligent/mu/pull/222) ([cplee](https://github.com/cplee)) - -## [v1.1.1](https://github.com/stelligent/mu/tree/v1.1.1) (2017-11-15) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.0.6...v1.1.1) - -**Implemented enhancements:** - -- Allow custom AMIs based on OS other than amazon linux to work [\#205](https://github.com/stelligent/mu/issues/205) -- Update environment ASG to use target tracking policies [\#177](https://github.com/stelligent/mu/issues/177) -- Add S3 Source support for CodePipeline [\#176](https://github.com/stelligent/mu/issues/176) -- Service autoscaling [\#171](https://github.com/stelligent/mu/issues/171) -- Allow referencing external files for templates [\#167](https://github.com/stelligent/mu/issues/167) -- Nested mu.yml files [\#162](https://github.com/stelligent/mu/issues/162) -- Scheduled tasks [\#158](https://github.com/stelligent/mu/issues/158) -- Issue 158 scheduled tasks [\#217](https://github.com/stelligent/mu/pull/217) ([timbaileyjones](https://github.com/timbaileyjones)) -- Template splice [\#215](https://github.com/stelligent/mu/pull/215) ([cplee](https://github.com/cplee)) -- issue-176 Added S3 Source option to CodePipeline [\#198](https://github.com/stelligent/mu/pull/198) ([akuma12](https://github.com/akuma12)) - -**Fixed bugs:** - -- Unable to specify branch [\#201](https://github.com/stelligent/mu/issues/201) -- Bug with latest Consul release [\#194](https://github.com/stelligent/mu/issues/194) -- Infinite loop trying to find .git on Windows [\#189](https://github.com/stelligent/mu/issues/189) - -**Merged pull requests:** - -- v1.1.1 [\#218](https://github.com/stelligent/mu/pull/218) ([cplee](https://github.com/cplee)) -- Issue 171 and 177 [\#213](https://github.com/stelligent/mu/pull/213) ([cplee](https://github.com/cplee)) -- Extensions [\#210](https://github.com/stelligent/mu/pull/210) ([cplee](https://github.com/cplee)) -- Only install cfn-nag if needed. Add GOPATH to PATH [\#207](https://github.com/stelligent/mu/pull/207) ([jeremyhahn](https://github.com/jeremyhahn)) -- add conditionals to the userdata and cfn-init based on os type [\#206](https://github.com/stelligent/mu/pull/206) ([cplee](https://github.com/cplee)) -- Issue 201 [\#202](https://github.com/stelligent/mu/pull/202) ([cplee](https://github.com/cplee)) -- Fixed git.go to walk up Windows dirs [\#199](https://github.com/stelligent/mu/pull/199) ([ataylor05](https://github.com/ataylor05)) -- Asg 177 [\#188](https://github.com/stelligent/mu/pull/188) ([danielc2013](https://github.com/danielc2013)) - -## [v1.0.6](https://github.com/stelligent/mu/tree/v1.0.6) (2017-10-17) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.0.5...v1.0.6) - -## [v1.0.5](https://github.com/stelligent/mu/tree/v1.0.5) (2017-10-16) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.0.4...v1.0.5) - -## [v1.0.4](https://github.com/stelligent/mu/tree/v1.0.4) (2017-10-13) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.0.3...v1.0.4) - -**Fixed bugs:** - -- Quotes in RoleNames and !Sub in -iam.yml templates break when custom CloudFormation added to those stacks [\#192](https://github.com/stelligent/mu/issues/192) -- mu-iam-common stack fails if it has already been deployed in another region [\#187](https://github.com/stelligent/mu/issues/187) - -**Merged pull requests:** - -- issue-192 Removed single quotes around RoleNames and changed !Sub ent… [\#193](https://github.com/stelligent/mu/pull/193) ([akuma12](https://github.com/akuma12)) - -## [v1.0.3](https://github.com/stelligent/mu/tree/v1.0.3) (2017-10-11) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.0.2...v1.0.3) - -**Implemented enhancements:** - -- Distribute mu via homebrew [\#132](https://github.com/stelligent/mu/issues/132) - -**Fixed bugs:** - -- pipeline-iam.yml relies on ${namespace}-bucket-codedeploy Export which may not exist [\#186](https://github.com/stelligent/mu/issues/186) - -**Merged pull requests:** - -- fix for \#187 [\#191](https://github.com/stelligent/mu/pull/191) ([cplee](https://github.com/cplee)) -- Issue \#187 - Add namespace to buckets and regions to IAM roles to avo… [\#190](https://github.com/stelligent/mu/pull/190) ([cplee](https://github.com/cplee)) -- Added a formula Makefile target. Resolves \#132. [\#183](https://github.com/stelligent/mu/pull/183) ([juddmon](https://github.com/juddmon)) - -## [v1.0.2](https://github.com/stelligent/mu/tree/v1.0.2) (2017-10-09) -[Full Changelog](https://github.com/stelligent/mu/compare/v1.0.1...v1.0.2) - -**Fixed bugs:** - -- Custom Cloudformation breaks the Pipeline template [\#181](https://github.com/stelligent/mu/issues/181) - -**Closed issues:** - -- Unable to create pipeline with 1.X [\#184](https://github.com/stelligent/mu/issues/184) - -**Merged pull requests:** - -- Bug fixes [\#185](https://github.com/stelligent/mu/pull/185) ([cplee](https://github.com/cplee)) -- Resolve issue with invalid CFN for custom pipeline templates [\#182](https://github.com/stelligent/mu/pull/182) ([cplee](https://github.com/cplee)) - -## [v1.0.1](https://github.com/stelligent/mu/tree/v1.0.1) (2017-10-02) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.2.5...v1.0.1) - -**Closed issues:** - -- Rolling restart [\#164](https://github.com/stelligent/mu/issues/164) -- cfn\_nag [\#163](https://github.com/stelligent/mu/issues/163) -- Add ability to set/get the DB password [\#140](https://github.com/stelligent/mu/issues/140) -- Custom tags on stacks [\#88](https://github.com/stelligent/mu/issues/88) -- Customize stack prefix for namespacing [\#87](https://github.com/stelligent/mu/issues/87) -- Pass existing IAM roles and/or Security Groups [\#86](https://github.com/stelligent/mu/issues/86) -- Target multiple regions/accounts for environments [\#84](https://github.com/stelligent/mu/issues/84) -- Cleanup IAM policies [\#82](https://github.com/stelligent/mu/issues/82) - -**Merged pull requests:** - -- v1.0.1 [\#180](https://github.com/stelligent/mu/pull/180) ([cplee](https://github.com/cplee)) -- IAM refactor [\#179](https://github.com/stelligent/mu/pull/179) ([cplee](https://github.com/cplee)) -- Custom tags 88 [\#175](https://github.com/stelligent/mu/pull/175) ([danielc2013](https://github.com/danielc2013)) -- Add namespace for stacks [\#174](https://github.com/stelligent/mu/pull/174) ([juddmon](https://github.com/juddmon)) -- Rolling restart 164 [\#173](https://github.com/stelligent/mu/pull/173) ([danielc2013](https://github.com/danielc2013)) -- Get and set db password [\#168](https://github.com/stelligent/mu/pull/168) ([juddmon](https://github.com/juddmon)) - -## [v0.2.5](https://github.com/stelligent/mu/tree/v0.2.5) (2017-08-16) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.2.4...v0.2.5) - -**Merged pull requests:** - -- release 0.2.5 [\#161](https://github.com/stelligent/mu/pull/161) ([cplee](https://github.com/cplee)) - -## [v0.2.4](https://github.com/stelligent/mu/tree/v0.2.4) (2017-08-10) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.2.3...v0.2.4) - -**Merged pull requests:** - -- release 0.2.4 [\#160](https://github.com/stelligent/mu/pull/160) ([cplee](https://github.com/cplee)) - -## [v0.2.3](https://github.com/stelligent/mu/tree/v0.2.3) (2017-07-26) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.2.2...v0.2.3) - -**Closed issues:** - -- Skip build/image step in pipeline [\#151](https://github.com/stelligent/mu/issues/151) -- Create Route53 resource record per service [\#150](https://github.com/stelligent/mu/issues/150) -- Support ALB routing via hostname [\#136](https://github.com/stelligent/mu/issues/136) - -**Merged pull requests:** - -- v0.2.3 [\#155](https://github.com/stelligent/mu/pull/155) ([cplee](https://github.com/cplee)) -- issues for v0.2.3 [\#154](https://github.com/stelligent/mu/pull/154) ([cplee](https://github.com/cplee)) - -## [v0.2.2](https://github.com/stelligent/mu/tree/v0.2.2) (2017-07-24) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.2.1...v0.2.2) - -**Merged pull requests:** - -- v0.2.2 [\#153](https://github.com/stelligent/mu/pull/153) ([cplee](https://github.com/cplee)) - -## [v0.2.1](https://github.com/stelligent/mu/tree/v0.2.1) (2017-07-20) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.14...v0.2.1) - -**Fixed bugs:** - -- Unable to determine git revision [\#142](https://github.com/stelligent/mu/issues/142) - -**Closed issues:** - -- Support alternate mu.yml files [\#146](https://github.com/stelligent/mu/issues/146) -- Support defining ec2 as the provider for an environment [\#144](https://github.com/stelligent/mu/issues/144) - -**Merged pull requests:** - -- 0.2.1 [\#152](https://github.com/stelligent/mu/pull/152) ([cplee](https://github.com/cplee)) -- Issue 144 [\#149](https://github.com/stelligent/mu/pull/149) ([cplee](https://github.com/cplee)) -- fix \#142 remove gogit dependency in place of manually opening file [\#148](https://github.com/stelligent/mu/pull/148) ([cplee](https://github.com/cplee)) - -## [v0.1.14](https://github.com/stelligent/mu/tree/v0.1.14) (2017-06-22) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.13...v0.1.14) - -**Fixed bugs:** - -- CodeCommit defects [\#134](https://github.com/stelligent/mu/issues/134) -- Rollback on pipeline command [\#105](https://github.com/stelligent/mu/issues/105) -- Auto increment ALB ListenerRule Priority [\#85](https://github.com/stelligent/mu/issues/85) -- Service build has redundant logs from docker [\#81](https://github.com/stelligent/mu/issues/81) - -**Closed issues:** - -- Variable substitution with single quotes in templates results in failure [\#138](https://github.com/stelligent/mu/issues/138) -- How to configure desired capacity for consul server? [\#137](https://github.com/stelligent/mu/issues/137) -- View ECS cluster instances for a given service [\#131](https://github.com/stelligent/mu/issues/131) -- Progress output for CodeBuild [\#120](https://github.com/stelligent/mu/issues/120) -- Implement Service Discovery [\#116](https://github.com/stelligent/mu/issues/116) -- Determine service name from GitHub repo name [\#112](https://github.com/stelligent/mu/issues/112) -- Add support for CodeCommit [\#107](https://github.com/stelligent/mu/issues/107) -- Improve process for running commands after deployment [\#104](https://github.com/stelligent/mu/issues/104) -- Pipeline manages environment [\#102](https://github.com/stelligent/mu/issues/102) -- Tag CloudFormation stacks with commit id of mu.yml [\#99](https://github.com/stelligent/mu/issues/99) -- Extend/Override Generated CloudFormation [\#97](https://github.com/stelligent/mu/issues/97) -- Version numbers for docker image [\#80](https://github.com/stelligent/mu/issues/80) -- View build logs [\#79](https://github.com/stelligent/mu/issues/79) -- Execute tests from CodePipeline [\#78](https://github.com/stelligent/mu/issues/78) -- Service Log Aggregation [\#77](https://github.com/stelligent/mu/issues/77) -- VPC enhancements [\#76](https://github.com/stelligent/mu/issues/76) -- Cleanup VPC reference [\#63](https://github.com/stelligent/mu/issues/63) -- Add support for HTTPS and DNS [\#62](https://github.com/stelligent/mu/issues/62) -- Vendoring of dependencies [\#60](https://github.com/stelligent/mu/issues/60) -- Blog post announcing mu [\#46](https://github.com/stelligent/mu/issues/46) -- Documentation for installing/using mu [\#43](https://github.com/stelligent/mu/issues/43) -- Terminate pipeline [\#31](https://github.com/stelligent/mu/issues/31) -- Add pipeline status to Show service [\#30](https://github.com/stelligent/mu/issues/30) -- Show pipeline details [\#29](https://github.com/stelligent/mu/issues/29) -- List pipelines [\#28](https://github.com/stelligent/mu/issues/28) -- Create pipeline \(CodePipeline and CodeBuild\) [\#27](https://github.com/stelligent/mu/issues/27) -- Undeploy service [\#26](https://github.com/stelligent/mu/issues/26) -- Set service environment variable [\#25](https://github.com/stelligent/mu/issues/25) -- Add service status to show environment [\#24](https://github.com/stelligent/mu/issues/24) -- Show services [\#23](https://github.com/stelligent/mu/issues/23) -- Create service \(ECS task, ECS service, ALB target group\) [\#22](https://github.com/stelligent/mu/issues/22) -- Terminate environment [\#21](https://github.com/stelligent/mu/issues/21) -- Show environment [\#20](https://github.com/stelligent/mu/issues/20) -- List environments [\#19](https://github.com/stelligent/mu/issues/19) -- Create environment \(VPC, ECS cluster, ASG/LC for ECS instances, ALB\) [\#18](https://github.com/stelligent/mu/issues/18) -- Parse mu.yml file into domain objects [\#17](https://github.com/stelligent/mu/issues/17) - -**Merged pull requests:** - -- 0.1.4 - bug fixes [\#143](https://github.com/stelligent/mu/pull/143) ([cplee](https://github.com/cplee)) -- fixes \#138 [\#139](https://github.com/stelligent/mu/pull/139) ([sumitsarkar](https://github.com/sumitsarkar)) - -## [v0.1.13](https://github.com/stelligent/mu/tree/v0.1.13) (2017-05-12) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.12...v0.1.13) - -**Merged pull requests:** - -- Release 0.1.13 [\#135](https://github.com/stelligent/mu/pull/135) ([cplee](https://github.com/cplee)) -- Added a table to display the container details for service and env sh… [\#133](https://github.com/stelligent/mu/pull/133) ([jblouse](https://github.com/jblouse)) -- Issue 104 [\#130](https://github.com/stelligent/mu/pull/130) ([jblouse](https://github.com/jblouse)) - -## [v0.1.12](https://github.com/stelligent/mu/tree/v0.1.12) (2017-05-03) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.11...v0.1.12) - -**Closed issues:** - -- Use param store for credentials [\#126](https://github.com/stelligent/mu/issues/126) -- Define databases in mu.yml [\#101](https://github.com/stelligent/mu/issues/101) - -**Merged pull requests:** - -- Release 0.1.12 [\#129](https://github.com/stelligent/mu/pull/129) ([cplee](https://github.com/cplee)) -- Add support for databases to mu [\#127](https://github.com/stelligent/mu/pull/127) ([cplee](https://github.com/cplee)) - -## [v0.1.11](https://github.com/stelligent/mu/tree/v0.1.11) (2017-04-19) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.10...v0.1.11) - -**Merged pull requests:** - -- Use STDERR for warnings [\#125](https://github.com/stelligent/mu/pull/125) ([cplee](https://github.com/cplee)) - -## [v0.1.10](https://github.com/stelligent/mu/tree/v0.1.10) (2017-04-10) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.9...v0.1.10) - -**Merged pull requests:** - -- v0.10.0 final [\#124](https://github.com/stelligent/mu/pull/124) ([cplee](https://github.com/cplee)) -- Issue 120 [\#122](https://github.com/stelligent/mu/pull/122) ([cplee](https://github.com/cplee)) -- disable progess spinner if not running in terminal [\#121](https://github.com/stelligent/mu/pull/121) ([cplee](https://github.com/cplee)) -- Add tags to CloudFormation stacks for repo name and revision [\#119](https://github.com/stelligent/mu/pull/119) ([jesseadams](https://github.com/jesseadams)) -- Added support for viewing logs from CLI [\#118](https://github.com/stelligent/mu/pull/118) ([cplee](https://github.com/cplee)) -- Service Discovery via Consul [\#117](https://github.com/stelligent/mu/pull/117) ([cplee](https://github.com/cplee)) -- Default service name to git repo name [\#113](https://github.com/stelligent/mu/pull/113) ([jesseadams](https://github.com/jesseadams)) -- Retrieve git revision from CodePipeline [\#109](https://github.com/stelligent/mu/pull/109) ([jesseadams](https://github.com/jesseadams)) - -## [v0.1.9](https://github.com/stelligent/mu/tree/v0.1.9) (2017-03-17) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.8...v0.1.9) - -**Merged pull requests:** - -- CodeCommit support [\#111](https://github.com/stelligent/mu/pull/111) ([cplee](https://github.com/cplee)) -- Add support for CodeCommit [\#110](https://github.com/stelligent/mu/pull/110) ([cplee](https://github.com/cplee)) -- Updating building from source instructions [\#108](https://github.com/stelligent/mu/pull/108) ([jesseadams](https://github.com/jesseadams)) - -## [v0.1.8](https://github.com/stelligent/mu/tree/v0.1.8) (2017-03-08) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.7...v0.1.8) - -**Merged pull requests:** - -- Release 0.1.8 [\#106](https://github.com/stelligent/mu/pull/106) ([cplee](https://github.com/cplee)) -- Pipeline managing environments [\#103](https://github.com/stelligent/mu/pull/103) ([cplee](https://github.com/cplee)) -- Override CFN resources [\#98](https://github.com/stelligent/mu/pull/98) ([cplee](https://github.com/cplee)) -- Execute tests from CodePipeline [\#96](https://github.com/stelligent/mu/pull/96) ([cplee](https://github.com/cplee)) -- Add json formatter for env show. Update pipeline to run tests. [\#95](https://github.com/stelligent/mu/pull/95) ([cplee](https://github.com/cplee)) -- Environment variables [\#94](https://github.com/stelligent/mu/pull/94) ([cplee](https://github.com/cplee)) -- CloudWatch logs aggregation [\#93](https://github.com/stelligent/mu/pull/93) ([cplee](https://github.com/cplee)) - -## [v0.1.7](https://github.com/stelligent/mu/tree/v0.1.7) (2017-02-07) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.6...v0.1.7) - -**Merged pull requests:** - -- v0.1.7 [\#92](https://github.com/stelligent/mu/pull/92) ([cplee](https://github.com/cplee)) -- Config and autogeneration of ELB rule priority [\#91](https://github.com/stelligent/mu/pull/91) ([cplee](https://github.com/cplee)) -- Add support for HTTPS and DNS to ELB [\#90](https://github.com/stelligent/mu/pull/90) ([cplee](https://github.com/cplee)) -- VPC Enhancements [\#89](https://github.com/stelligent/mu/pull/89) ([cplee](https://github.com/cplee)) -- Region and profile [\#75](https://github.com/stelligent/mu/pull/75) ([cplee](https://github.com/cplee)) - -## [v0.1.6](https://github.com/stelligent/mu/tree/v0.1.6) (2017-02-01) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.5...v0.1.6) - -**Merged pull requests:** - -- Bug with stack params [\#74](https://github.com/stelligent/mu/pull/74) ([cplee](https://github.com/cplee)) - -## [v0.1.5](https://github.com/stelligent/mu/tree/v0.1.5) (2017-02-01) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.4...v0.1.5) - -**Closed issues:** - -- Create CONTRIBUTING.md file [\#50](https://github.com/stelligent/mu/issues/50) - -**Merged pull requests:** - -- Pipelines [\#73](https://github.com/stelligent/mu/pull/73) ([cplee](https://github.com/cplee)) -- Pipeline workflows [\#72](https://github.com/stelligent/mu/pull/72) ([cplee](https://github.com/cplee)) -- Create pipeline with CodePipeline and CodeBuild [\#71](https://github.com/stelligent/mu/pull/71) ([cplee](https://github.com/cplee)) -- VPC reference from mu.yml [\#70](https://github.com/stelligent/mu/pull/70) ([cplee](https://github.com/cplee)) -- Contributing guidelines [\#69](https://github.com/stelligent/mu/pull/69) ([cplee](https://github.com/cplee)) -- Pin dependencies with glide [\#67](https://github.com/stelligent/mu/pull/67) ([cplee](https://github.com/cplee)) - -## [v0.1.4](https://github.com/stelligent/mu/tree/v0.1.4) (2017-01-25) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.3...v0.1.4) - -**Merged pull requests:** - -- Migrate to CircleCI [\#66](https://github.com/stelligent/mu/pull/66) ([cplee](https://github.com/cplee)) -- Migrate to CircleCI [\#65](https://github.com/stelligent/mu/pull/65) ([cplee](https://github.com/cplee)) - -## [v0.1.3](https://github.com/stelligent/mu/tree/v0.1.3) (2017-01-24) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.2...v0.1.3) - -**Merged pull requests:** - -- Complete work for supporting deploy/view/undeploy services [\#64](https://github.com/stelligent/mu/pull/64) ([cplee](https://github.com/cplee)) -- Handle viewing services and undeploying [\#59](https://github.com/stelligent/mu/pull/59) ([cplee](https://github.com/cplee)) -- Complete service view [\#58](https://github.com/stelligent/mu/pull/58) ([cplee](https://github.com/cplee)) -- Build/Push/Deploy service [\#57](https://github.com/stelligent/mu/pull/57) ([cplee](https://github.com/cplee)) - -## [v0.1.2](https://github.com/stelligent/mu/tree/v0.1.2) (2017-01-17) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.1...v0.1.2) - -**Merged pull requests:** - -- Release 0.1.2 [\#56](https://github.com/stelligent/mu/pull/56) ([cplee](https://github.com/cplee)) -- Terminate environments [\#55](https://github.com/stelligent/mu/pull/55) ([cplee](https://github.com/cplee)) -- Show environment details [\#54](https://github.com/stelligent/mu/pull/54) ([cplee](https://github.com/cplee)) -- Add support to list environments [\#53](https://github.com/stelligent/mu/pull/53) ([cplee](https://github.com/cplee)) -- Unit testability for issue 18 [\#52](https://github.com/stelligent/mu/pull/52) ([cplee](https://github.com/cplee)) -- Parse mu objects [\#51](https://github.com/stelligent/mu/pull/51) ([cplee](https://github.com/cplee)) - -## [v0.1.1](https://github.com/stelligent/mu/tree/v0.1.1) (2017-01-05) -[Full Changelog](https://github.com/stelligent/mu/compare/v0.1.0...v0.1.1) - -**Implemented enhancements:** - -- Create initial CI job [\#8](https://github.com/stelligent/mu/issues/8) - -**Merged pull requests:** - -- Fix issue with install script picking up from develop branch [\#49](https://github.com/stelligent/mu/pull/49) ([cplee](https://github.com/cplee)) - -## [v0.1.0](https://github.com/stelligent/mu/tree/v0.1.0) (2017-01-05) -**Merged pull requests:** - -- makefile typo [\#16](https://github.com/stelligent/mu/pull/16) ([cplee](https://github.com/cplee)) -- Release version 0.1.0 [\#15](https://github.com/stelligent/mu/pull/15) ([cplee](https://github.com/cplee)) -- update install instructions and created install script [\#14](https://github.com/stelligent/mu/pull/14) ([cplee](https://github.com/cplee)) -- Issue 8 [\#13](https://github.com/stelligent/mu/pull/13) ([cplee](https://github.com/cplee)) -- setup git credentials to deploy [\#12](https://github.com/stelligent/mu/pull/12) ([cplee](https://github.com/cplee)) -- handle situation where version doesn't already exist [\#11](https://github.com/stelligent/mu/pull/11) ([cplee](https://github.com/cplee)) -- Create Makefile and TravisCI for release management [\#10](https://github.com/stelligent/mu/pull/10) ([cplee](https://github.com/cplee)) -- layout initial CLI [\#7](https://github.com/stelligent/mu/pull/7) ([cplee](https://github.com/cplee)) -- CLI commands [\#6](https://github.com/stelligent/mu/pull/6) ([cplee](https://github.com/cplee)) - - - -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/Makefile b/Makefile index 46e9977c..db18f4f5 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,37 @@ ORG := stelligent PACKAGE := mu -TARGET_OS := linux windows darwin SRC_PACKAGES = provider workflows cli common templates e2e +SNAPSHOT_SUFFIX := develop ### -BRANCH := $(or $(TRAVIS_BRANCH), $(shell git rev-parse --abbrev-ref HEAD)) -IS_MASTER := $(filter master, $(BRANCH)) -VERSION := $(shell cat VERSION)$(if $(IS_MASTER),,-$(BRANCH)) SRC_FILES = $(foreach pkg, $(SRC_PACKAGES), ./$(pkg)/...) . +BRANCH := $(shell git rev-parse --abbrev-ref HEAD) +LATEST_VERSION := $(shell git tag -l --sort=creatordate | grep "^v[0-9]*.[0-9]*.[0-9]*$$" | tail -1 | cut -c 2-) +ifeq "$(shell git tag -l v$(LATEST_VERSION) --points-at HEAD)" "v$(LATEST_VERSION)" +### latest tag points to current commit, this is a release build +VERSION ?= $(LATEST_VERSION) +else +### latest tag points to prior commit, this is a snapshot build +MAJOR_VERSION := $(word 1, $(subst ., ,$(LATEST_VERSION))) +MINOR_VERSION := $(word 2, $(subst ., ,$(LATEST_VERSION))) +PATCH_VERSION := $(word 3, $(subst ., ,$(LATEST_VERSION))) +VERSION ?= $(MAJOR_VERSION).$(MINOR_VERSION).$(shell echo $$(( $(PATCH_VERSION) + 1)) )-$(if $(findstring master, $(BRANCH)),$(SNAPSHOT_SUFFIX),$(BRANCH)) +endif +IS_SNAPSHOT = $(if $(findstring -, $(VERSION)),true,false) +TAG_VERSION = v$(VERSION) + ARCH := $(shell go env GOARCH) OS := $(shell go env GOOS) -BUILD_DIR = .release -BUILD_DIR = $(abspath $(if $(CIRCLE_WORKING_DIRECTORY),$(CIRCLE_WORKING_DIRECTORY)/artifacts,.release)) -BUILD_FILES = $(foreach os, $(TARGET_OS), $(BUILD_DIR)/$(PACKAGE)-$(os)-$(ARCH)) -UPLOAD_FILES = $(foreach os, $(TARGET_OS), $(PACKAGE)-$(os)-$(ARCH)) -GOLDFLAGS = "-X main.version=$(VERSION)" -TAG_VERSION = v$(VERSION) GEM := $(shell command -v gem 2> /dev/null) export PATH := $(GOPATH)/bin:$(PATH) + default: all +info: + @echo "VERSION:$(VERSION) IS_SNAPSHOT:$(IS_SNAPSHOT) BRANCH:$(BRANCH)" + deps: @echo "=== dependencies ===" go get "github.com/golang/dep/cmd/dep" @@ -48,11 +58,11 @@ nag: @echo "=== cfn_nag ===" @gem list -i cfn-nag --silent || sudo gem install cfn-nag - @mkdir -p $(BUILD_DIR)/cfn_nag + @mkdir -p .cfn_nag @grep -l AWSTemplateFormatVersion: templates/assets/*.yml | while read -r line; do \ filename=`basename $$line` ;\ - grep -v '{{' $$line > $(BUILD_DIR)/cfn_nag/$$filename ;\ - output=`cfn_nag_scan --input-path $(BUILD_DIR)/cfn_nag/$$filename 2>&1` ;\ + grep -v '{{' $$line > .cfn_nag/$$filename ;\ + output=`cfn_nag_scan --input-path .cfn_nag/$$filename 2>&1` ;\ if [ $$? -ne 0 ]; then \ echo $$filename ;\ echo "$$output\n" ;\ @@ -72,7 +82,7 @@ ifdef GEM test: nag endif -test: lint gen cyclo +test: info lint gen cyclo @echo "=== testing ===" ifneq ($(CIRCLE_WORKING_DIRECTORY),) @mkdir -p $(CIRCLE_WORKING_DIRECTORY)/test-results/unit @@ -82,21 +92,25 @@ else @go test -cover $(filter-out ./e2e/..., $(SRC_FILES)) -short endif -e2e: gen stage keypair - @echo "=== e2e testing ===" - @MU_VERSION=$(VERSION) MU_BASEURL=https://mu-staging-$$(aws sts get-caller-identity --output text --query 'Account').s3.amazonaws.com go test -v ./e2e -timeout 60m -build: gen $(BUILD_FILES) +build: info gen + @go get github.com/goreleaser/goreleaser + $(eval export SNAPSHOT_VERSION=$(VERSION)) + @goreleaser --snapshot --rm-dist -$(BUILD_FILES): - @echo "=== building $(VERSION) - $@ ===" - @mkdir -p $(BUILD_DIR) - GOOS=$(word 2,$(subst -, ,$(notdir $@))) GOARCH=$(word 3,$(subst -, ,$(notdir $@))) go build -ldflags=$(GOLDFLAGS) -o '$@' +install: build + @echo "=== installing $(PACKAGE)-$(OS)-$(ARCH) ===" + @echo cp dist/$(OS)_$(ARCH)/$(PACKAGE) /usr/local/bin/mu + @chmod 755 /usr/local/bin/mu + @mu -v -install: gen $(BUILD_DIR)/$(PACKAGE)-$(OS)-$(ARCH) - @echo "=== installing $(VERSION) - $(PACKAGE)-$(OS)-$(ARCH) ===" - cp $(BUILD_DIR)/$(PACKAGE)-$(OS)-$(ARCH) /usr/local/bin/mu - chmod 755 /usr/local/bin/mu +stage: fmt build + @echo "=== staging to S3 bucket ===" + @export BUCKET_NAME=mu-staging-$$(aws sts get-caller-identity --output text --query 'Account') ;\ + aws s3 mb s3://$$BUCKET_NAME || echo "bucket exists" ;\ + aws s3 website --index-document index.html s3://$$BUCKET_NAME ;\ + aws s3 cp dest/linux_amd64/mu s3://$$BUCKET_NAME/$(TAG_VERSION)/$(PACKAGE)-linux-amd64 --acl public-read ;\ + echo https://$$BUCKET_NAME.s3.amazonaws.com keypair: @aws ec2 describe-key-pairs --key-names mu-e2e > /dev/null 2>&1; \ @@ -106,42 +120,34 @@ keypair: chmod 600 ~/.ssh/mu-e2e-$$(aws sts get-caller-identity --output text --query 'Account').pem; \ fi; -stage: fmt $(BUILD_DIR)/$(PACKAGE)-linux-$(ARCH) - @echo "=== staging to S3 bucket ===" - @export BUCKET_NAME=mu-staging-$$(aws sts get-caller-identity --output text --query 'Account') ;\ - aws s3 mb s3://$$BUCKET_NAME || echo "bucket exists" ;\ - aws s3 website --index-document index.html s3://$$BUCKET_NAME ;\ - aws s3 sync $(BUILD_DIR) s3://$$BUCKET_NAME/v$(VERSION)/ --acl public-read --exclude "*" --include "$(PACKAGE)-linux-*" ;\ - echo https://$$BUCKET_NAME.s3.amazonaws.com - -release-clean: check_github_token -ifeq ($(IS_MASTER),) - @echo "=== clearing old release $(VERSION) ===" - github-release info -u $(ORG) -r $(PACKAGE) -t $(TAG_VERSION) && github-release delete -u $(ORG) -r $(PACKAGE) -t $(TAG_VERSION) || echo "No release to cleanup" - git push --delete origin $(TAG_VERSION) || echo "No tag to delete" -endif +e2e: gen stage keypair + @echo "=== e2e testing ===" + @MU_VERSION=$(VERSION) MU_BASEURL=https://mu-staging-$$(aws sts get-caller-identity --output text --query 'Account').s3.amazonaws.com go test -v ./e2e -timeout 60m -release-create: build release-clean - @echo "=== creating pre-release $(VERSION) ===" - git tag -f $(TAG_VERSION) - git push origin $(TAG_VERSION) - echo "waiting for dust to settle..." && sleep 5 - github-release release -u $(ORG) -r $(PACKAGE) -t $(TAG_VERSION) -p -$(TARGET_OS): release-create - @echo "=== uploading $@ ===" - github-release upload -u $(ORG) -r $(PACKAGE) -t $(TAG_VERSION) -n "$(PACKAGE)-$@-$(ARCH)" -f "$(BUILD_DIR)/$(PACKAGE)-$@-$(ARCH)" +check_github_token: +ifndef GITHUB_TOKEN + @echo GITHUB_TOKEN is undefined + @echo Create one at https://github.com/settings/tokens + @exit 1 +endif -dev-release: $(TARGET_OS) +tag_release: +ifeq ($(IS_SNAPSHOT),true) + @echo "=== creating tag '$(TAG_VERSION)' ===" + @git tag --force -a -m "releasing $(TAG_VERSION)" $(TAG_VERSION) +endif -release: dev-release -ifneq ($(IS_MASTER),) - @echo "=== releasing $(VERSION) ===" - awk -v n=2 '/^##/{n--}; n > 0' CHANGELOG.md | github-release edit -u $(ORG) -r $(PACKAGE) -t $(TAG_VERSION) -d - +changelog: check_github_token + @echo "=== generating changelog ===" + @rm -f CHANGELOG.md + @go get github.com/Songmu/ghch/cmd/ghch + @ghch --format=markdown -w - #github-release info -u $(ORG) -r $(PACKAGE) -t $(TAG_VERSION)-develop && github-release delete -u $(ORG) -r $(PACKAGE) -t $(TAG_VERSION)-develop || echo "No pre-release to cleanup" - #git push --delete origin $(TAG_VERSION)-develop || echo "No pre-release tag to delete" -endif +github_release: check_github_token tag_release changelog + @echo "=== generating github release '$(TAG_VERSION)' ===" + @go get github.com/goreleaser/goreleaser + @goreleaser --skip-publish --skip-validate --rm-dist --release-notes CHANGELOG.md formula: rm -rf homebrew-tap @@ -153,79 +159,46 @@ formula: $(eval LINUX_SHA256 := $(shell curl -L -s $(LINUX_URL) | shasum -a 256 | cut -d' ' -f1)) # Update formula in mu-cli.rb +ifeq ($(IS_SNAPSHOT),true) + $(eval BREW_BRANCH := $(SNAPSHOT_SUFFIX)) +else + $(eval BREW_BRANCH := 'master') +endif + ifeq ($(OS),darwin) - sed -i "" 's|.*\( # The MacOS '$(BRANCH)' url\)| url "'$(MAC_URL)'"\1|g ' homebrew-tap/Formula/mu-cli.rb - sed -i "" 's|.*\( # The MacOS '$(BRANCH)' sha256sum\)| sha256 "'$(MAC_SHA256)'"\1|g' homebrew-tap/Formula/mu-cli.rb - sed -i "" 's|.*\( # The Linux '$(BRANCH)' url\)| url "'$(LINUX_URL)'"\1|g' homebrew-tap/Formula/mu-cli.rb - sed -i "" 's|.*\( # The Linux '$(BRANCH)' sha256sum\)| sha256 "'$(LINUX_SHA256)'"\1|g' homebrew-tap/Formula/mu-cli.rb - sed -i "" 's|\(\s*version\).*\( # The '$(BRANCH)' version\)|\1 "'$(VERSION)'"\2|g' homebrew-tap/Formula/mu-cli.rb + sed -i "" 's|.*\( # The MacOS '$(BREW_BRANCH)' url\)| url "'$(MAC_URL)'"\1|g ' homebrew-tap/Formula/mu-cli.rb + sed -i "" 's|.*\( # The MacOS '$(BREW_BRANCH)' sha256sum\)| sha256 "'$(MAC_SHA256)'"\1|g' homebrew-tap/Formula/mu-cli.rb + sed -i "" 's|.*\( # The Linux '$(BREW_BRANCH)' url\)| url "'$(LINUX_URL)'"\1|g' homebrew-tap/Formula/mu-cli.rb + sed -i "" 's|.*\( # The Linux '$(BREW_BRANCH)' sha256sum\)| sha256 "'$(LINUX_SHA256)'"\1|g' homebrew-tap/Formula/mu-cli.rb + sed -i "" 's|\(\s*version\).*\( # The '$(BREW_BRANCH)' version\)|\1 "'$(VERSION)'"\2|g' homebrew-tap/Formula/mu-cli.rb else - sed -i"" 's|.*\( # The MacOS '$(BRANCH)' url\)| url "'$(MAC_URL)'"\1|g ' homebrew-tap/Formula/mu-cli.rb - sed -i"" 's|.*\( # The MacOS '$(BRANCH)' sha256sum\)| sha256 "'$(MAC_SHA256)'"\1|g' homebrew-tap/Formula/mu-cli.rb - sed -i"" 's|.*\( # The Linux '$(BRANCH)' url\)| url "'$(LINUX_URL)'"\1|g' homebrew-tap/Formula/mu-cli.rb - sed -i"" 's|.*\( # The Linux '$(BRANCH)' sha256sum\)| sha256 "'$(LINUX_SHA256)'"\1|g' homebrew-tap/Formula/mu-cli.rb - sed -i"" 's|\(\s*version\).*\( # The '$(BRANCH)' version\)|\1 "'$(VERSION)'"\2|g' homebrew-tap/Formula/mu-cli.rb + sed -i"" 's|.*\( # The MacOS '$(BREW_BRANCH)' url\)| url "'$(MAC_URL)'"\1|g ' homebrew-tap/Formula/mu-cli.rb + sed -i"" 's|.*\( # The MacOS '$(BREW_BRANCH)' sha256sum\)| sha256 "'$(MAC_SHA256)'"\1|g' homebrew-tap/Formula/mu-cli.rb + sed -i"" 's|.*\( # The Linux '$(BREW_BRANCH)' url\)| url "'$(LINUX_URL)'"\1|g' homebrew-tap/Formula/mu-cli.rb + sed -i"" 's|.*\( # The Linux '$(BREW_BRANCH)' sha256sum\)| sha256 "'$(LINUX_SHA256)'"\1|g' homebrew-tap/Formula/mu-cli.rb + sed -i"" 's|\(\s*version\).*\( # The '$(BREW_BRANCH)' version\)|\1 "'$(VERSION)'"\2|g' homebrew-tap/Formula/mu-cli.rb endif git -C homebrew-tap add Formula/mu-cli.rb git -C homebrew-tap commit -m "auto updated the mu-cli formula for version $(TAG_VERSION) branch $(BRANCH)" git -C homebrew-tap push +release: info github_release #formula + clean: @echo "=== cleaning ===" - rm -rf $(BUILD_DIR) rm -rf vendor + rm -rf .cfn_nag + rm -rf dist all: clean deps test build - -check_github_token: -ifndef GITHUB_TOKEN - @echo GITHUB_TOKEN is undefined - @echo Create one at https://github.com/settings/tokens +promote: info +ifeq (false,$(IS_SNAPSHOT)) + @echo "Unable to promote a non-snapshot" @exit 1 endif - @go get "github.com/aktau/github-release" - -promote: check_github_token - gem list | grep github_changelog_generator || sudo gem install github_changelog_generator - - @echo "=== merge $(BRANCH) -> master ===" - @git fetch origin master - @git checkout origin/master - @git merge --no-edit $(BRANCH) - - @echo "=== generate changelog v$(shell cat VERSION) ===" - @github_changelog_generator --no-verbose -u stelligent -p mu -t $(GITHUB_TOKEN) --exclude-tags-regex develop --future-release v$(shell cat VERSION) - @git add CHANGELOG.md - @git commit -m "update CHANGELOG for v$(shell cat VERSION)" - - @echo "=== push master ===" - @git push origin HEAD:master - @git checkout master - @git pull - - - @echo "=== update develop ===" - @git fetch origin develop - @git checkout origin/develop - @git merge --no-edit origin/master - - @echo "=== bump version ===" - @go get github.com/giantswarm/semver-bump - @semver-bump patch-release - @git add VERSION - @git commit -m "bump version" - - @echo "=== push develop ===" - @git push origin HEAD:develop - @git checkout develop - @git pull - - @echo "=== checkout $(BRANCH) ===" - @git checkout $(BRANCH) - - - + @git tag -a -m "releasing $(TAG_VERSION)" $(TAG_VERSION) + @git push --follow-tags origin -.PHONY: default all lint test e2e build deps gen clean release-clean release-create dev-release release install $(UPLOAD_FILES) $(BUILD_FILES) $(TARGET_OS) keypair stage promote +.PHONY: default all lint test e2e build deps gen clean release install keypair stage promote formula github_release changelog tag_release From 7350f18f5c6ce99586e79b4ad206f44fcf62ad51 Mon Sep 17 00:00:00 2001 From: Casey Lee Date: Fri, 21 Sep 2018 15:28:51 -0700 Subject: [PATCH 2/6] troubleshoot build --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 22779eb5..bea8a63f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -79,8 +79,8 @@ workflows: version: 2 test-and-snapshot: jobs: - - unit-test: - - cfn-nag: + - unit-test + - cfn-nag - release: requires: - unit-test From 429cba028bf4a9e7a9fdeac5d5b90a8d69b102ff Mon Sep 17 00:00:00 2001 From: Casey Lee Date: Fri, 21 Sep 2018 15:32:17 -0700 Subject: [PATCH 3/6] troubleshoot build --- .circleci/config.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index bea8a63f..99d6470c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,10 +96,14 @@ workflows: filters: tags: only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ + branches: + ignore: /.*/ - cfn-nag: filters: tags: only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ + branches: + ignore: /.*/ - release: requires: - unit-test @@ -107,3 +111,5 @@ workflows: filters: tags: only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ + branches: + ignore: /.*/ From a307505f666bee18c32808861e566ef20ce43e11 Mon Sep 17 00:00:00 2001 From: Casey Lee Date: Fri, 21 Sep 2018 15:34:41 -0700 Subject: [PATCH 4/6] troubleshoot build --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 99d6470c..0baa6a5a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,7 +76,6 @@ jobs: workflows: - version: 2 test-and-snapshot: jobs: - unit-test From 253729d40ba90ae1b597dcfdaa971a351aefd4cb Mon Sep 17 00:00:00 2001 From: Casey Lee Date: Fri, 21 Sep 2018 15:38:37 -0700 Subject: [PATCH 5/6] troubleshoot build --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0baa6a5a..1315a572 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,7 +52,7 @@ jobs: # The second key is for the repo homebrew-tap - add_ssh_keys: fingerprints: - - "53:1f:d0:6f:24:2a:bf:cb:92:0f:bc:1e:14:6e:1d:72" + #- "53:1f:d0:6f:24:2a:bf:cb:92:0f:bc:1e:14:6e:1d:72" - "35:fc:cc:f6:12:88:e2:56:24:17:09:36:3e:53:e6:68" ## In order for deploy to work, you need an environment variable set in CircleCI named "GITHUB_TOKEN" that contains From eddfe6eab46f7efd19fabff6f69c95a26840e324 Mon Sep 17 00:00:00 2001 From: Casey Lee Date: Fri, 21 Sep 2018 15:48:05 -0700 Subject: [PATCH 6/6] troubleshoot build --- .circleci/config.yml | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1315a572..b7d355f0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,33 +76,16 @@ jobs: workflows: - test-and-snapshot: - jobs: - - unit-test - - cfn-nag - - release: - requires: - - unit-test - - cfn-nag - filters: - branches: - only: - - develop - - master test-and-release: jobs: - unit-test: filters: tags: - only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ - branches: - ignore: /.*/ + only: /.*/ - cfn-nag: filters: tags: - only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ - branches: - ignore: /.*/ + only: /.*/ - release: requires: - unit-test @@ -111,4 +94,6 @@ workflows: tags: only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ branches: - ignore: /.*/ + only: + - develop + - master \ No newline at end of file