From c6866300eeb4b996912f974fcd0e31bddc0a000b Mon Sep 17 00:00:00 2001 From: Andrew Krug Date: Thu, 4 Apr 2019 11:03:08 -0700 Subject: [PATCH 1/3] modify CI to fall inline with standard IAM practices --- .travis.yml | 2 +- Makefile | 11 +++++++++++ README.md | 2 ++ buildspec.yml | 2 +- deploy.sh | 17 +++++++++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 Makefile create mode 100644 deploy.sh diff --git a/.travis.yml b/.travis.yml index 8eb377a7..b9ef7288 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,4 @@ language: python python: - 3.6 script: - - python -m unittest discover tests + - make test \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..b3b5e9d0 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) +S3_BUCKET := ${S3_BUCKET} + +.PHONY: test +test: + pip install pyyaml + python -m unittest discover tests + +.PHONY: deploy +deploy: test + aws s3 sync . s3://$(S3_BUCKET) \ No newline at end of file diff --git a/README.md b/README.md index bb0c7c3c..630e7661 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ [![Build Status](https://travis-ci.org/mozilla-iam/sso-dashboard-configuration.svg?branch=master)](https://travis-ci.org/mozilla-iam/sso-dashboard-configuration) +[![Codebuild Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiUWVHQlJNT2FjckNEcUFtUzI4VVR3ZlBTYjRCYnl4SWhWcUx0TTFEMUMzWmFMM3N2eGdLOFJMTUl6NkNtQTFkRVdXa2RzSEQ5SGYvZWRZMW01Q2cvcXhRPSIsIml2UGFyYW1ldGVyU3BlYyI6IjZjWmVyRWdkRDFFVTllRksiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master) + # How it works... `apps.yml` is used both for first stage access control and SSO Dashboard visibility settings. diff --git a/buildspec.yml b/buildspec.yml index 0fb04d97..30aa0c00 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -9,7 +9,7 @@ phases: - echo Nothing to do in the pre_build phase... build: commands: - - aws s3 sync . s3://$S3_BUCKET + - ./deploy.sh post_build: commands: - echo Build completed on `date` diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 00000000..5a1b23d6 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Begin deploy of the apps.yml file." +echo "$CODEBUILD_WEBHOOK_TRIGGER" + +if [[ "branch/master" == "$CODEBUILD_WEBHOOK_TRIGGER" ]] + then + echo "Deploying to the development CDN cdn.sso.allizom.org" + make deploy S3_BUCKET=sso-dashboard.configuration +elif [[ "$CODEBUILD_WEBHOOK_TRIGGER" =~ ^tag\/[0-9]\.[0-9]\.[0-9](\-(prod))?$ ]] + then + echo "Deploying to the production CDN cdn.sso.mozilla.com" + make deploy S3_BUCKET=sso-dashboard.configuration-prod +fi + +echo "$CODEBUILD_WEBHOOK_TRIGGER" +echo "End deploy of the apps.yml." From 00e76e2132bb67578020424f3013fc72df2ac4d6 Mon Sep 17 00:00:00 2001 From: Andrew Krug Date: Thu, 4 Apr 2019 11:04:29 -0700 Subject: [PATCH 2/3] mark deploy executable --- deploy.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 deploy.sh diff --git a/deploy.sh b/deploy.sh old mode 100644 new mode 100755 From 77910be70b2ad139eda943ac74b0710c1a0ed0ee Mon Sep 17 00:00:00 2001 From: Andrew Krug Date: Thu, 4 Apr 2019 11:05:05 -0700 Subject: [PATCH 3/3] remove extra bracket from codebuild badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 630e7661..1afbe867 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.org/mozilla-iam/sso-dashboard-configuration.svg?branch=master)](https://travis-ci.org/mozilla-iam/sso-dashboard-configuration) -[![Codebuild Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiUWVHQlJNT2FjckNEcUFtUzI4VVR3ZlBTYjRCYnl4SWhWcUx0TTFEMUMzWmFMM3N2eGdLOFJMTUl6NkNtQTFkRVdXa2RzSEQ5SGYvZWRZMW01Q2cvcXhRPSIsIml2UGFyYW1ldGVyU3BlYyI6IjZjWmVyRWdkRDFFVTllRksiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master) +![Codebuild Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiUWVHQlJNT2FjckNEcUFtUzI4VVR3ZlBTYjRCYnl4SWhWcUx0TTFEMUMzWmFMM3N2eGdLOFJMTUl6NkNtQTFkRVdXa2RzSEQ5SGYvZWRZMW01Q2cvcXhRPSIsIml2UGFyYW1ldGVyU3BlYyI6IjZjWmVyRWdkRDFFVTllRksiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master) # How it works...