From aa9446f75279119f84b2b6aeba246330db92ac6d Mon Sep 17 00:00:00 2001 From: David McDonald Date: Tue, 3 Mar 2020 12:04:32 +0000 Subject: [PATCH 1/3] Remove jenkins related code --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 17cfe64fa..4fb07dc9e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,6 @@ GIT_COMMIT ?= $(shell git rev-parse HEAD 2> /dev/null || echo "") DOCKER_IMAGE_TAG := $(shell cat docker/VERSION) DOCKER_BUILDER_IMAGE_NAME = govuk/notify-admin-builder:${DOCKER_IMAGE_TAG} -DOCKER_TTY ?= $(if ${JENKINS_HOME},,t) BUILD_TAG ?= notifications-admin-manual BUILD_NUMBER ?= 0 @@ -124,7 +123,7 @@ prepare-docker-build-image: ## Prepare the Docker builder image make -C docker build define run_docker_container - @docker run -i${DOCKER_TTY} --rm \ + @docker run -it --rm \ --name "${DOCKER_CONTAINER_PREFIX}-${1}" \ -v "`pwd`:/var/project" \ -e UID=$(shell id -u) \ From 162734c7a7e1b5c462390b287e70b0b9be4da75b Mon Sep 17 00:00:00 2001 From: David McDonald Date: Tue, 3 Mar 2020 12:05:15 +0000 Subject: [PATCH 2/3] Remove unused makefile commands These are either not used at all or we have superseeded them with commands written directly into concourse jobs --- Makefile | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 4fb07dc9e..596363ae8 100644 --- a/Makefile +++ b/Makefile @@ -75,22 +75,6 @@ build: dependencies generate-version-file ## Build project npm run build pip install -r requirements.txt -.PHONY: build-paas-artifact -build-paas-artifact: ## Build the deploy artifact for PaaS - rm -rf target - mkdir -p target - zip -y -q -r -x@deploy-exclude.lst target/notifications-admin.zip ./ - -.PHONY: upload-paas-artifact ## Upload the deploy artifact for PaaS -upload-paas-artifact: - $(if ${DEPLOY_BUILD_NUMBER},,$(error Must specify DEPLOY_BUILD_NUMBER)) - $(if ${JENKINS_S3_BUCKET},,$(error Must specify JENKINS_S3_BUCKET)) - aws s3 cp --region eu-west-1 --sse AES256 target/notifications-admin.zip s3://${JENKINS_S3_BUCKET}/build/notifications-admin/${DEPLOY_BUILD_NUMBER}.zip - -.PHONY: upload-static ## Upload the static files to be served from S3 -upload-static: - aws s3 cp --region eu-west-1 --recursive --cache-control max-age=315360000,immutable ./app/static s3://${DNS_NAME}-static - .PHONY: test test: ## Run tests ./scripts/run_tests.sh @@ -187,6 +171,10 @@ generate-manifest: --format=yaml \ <(${DECRYPT_CMD} ${NOTIFY_CREDENTIALS}/credentials/${CF_SPACE}/paas/environment-variables.gpg) 2>&1 +.PHONY: upload-static ## Upload the static files to be served from S3 +upload-static: + aws s3 cp --region eu-west-1 --recursive --cache-control max-age=315360000,immutable ./app/static s3://${DNS_NAME}-static + .PHONY: cf-deploy cf-deploy: ## Deploys the app to Cloud Foundry $(if ${CF_SPACE},,$(error Must specify CF_SPACE)) @@ -209,10 +197,6 @@ cf-deploy-prototype-2: cf-target ## Deploys the second prototype to Cloud Foundr cf-rollback: cf-target ## Rollbacks the app to the previous release cf v3-cancel-zdt-push ${CF_APP} -.PHONY: cf-push -cf-push: - cf push -f <(make -s generate-manifest) - .PHONY: cf-target cf-target: check-env-vars @cf target -o ${CF_ORG} -s ${CF_SPACE} From d3c8b35aa96745b5e9a2302450defdeae7c51c43 Mon Sep 17 00:00:00 2001 From: David McDonald Date: Tue, 3 Mar 2020 12:05:56 +0000 Subject: [PATCH 3/3] Rearrange makefile --- Makefile | 58 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 596363ae8..0fccc7932 100644 --- a/Makefile +++ b/Makefile @@ -26,39 +26,13 @@ $(eval export CF_HOME) NOTIFY_CREDENTIALS ?= ~/.notify-credentials + +## DEVELOPMENT + .PHONY: help help: @cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -.PHONY: check-env-vars -check-env-vars: ## Check mandatory environment variables - $(if ${DEPLOY_ENV},,$(error Must specify DEPLOY_ENV)) - $(if ${DNS_NAME},,$(error Must specify DNS_NAME)) - -.PHONY: sandbox -sandbox: ## Set environment to sandbox - $(eval export DEPLOY_ENV=sandbox) - $(eval export DNS_NAME="cloudapps.digital") - @true - -.PHONY: preview -preview: ## Set environment to preview - $(eval export DEPLOY_ENV=preview) - $(eval export DNS_NAME="notify.works") - @true - -.PHONY: staging -staging: ## Set environment to staging - $(eval export DEPLOY_ENV=staging) - $(eval export DNS_NAME="staging-notify.works") - @true - -.PHONY: production -production: ## Set environment to production - $(eval export DEPLOY_ENV=production) - $(eval export DNS_NAME="notifications.service.gov.uk") - @true - .PHONY: dependencies dependencies: ## Install build dependencies npm set progress=false @@ -150,6 +124,32 @@ clean-docker-containers: ## Clean up any remaining docker containers clean: rm -rf node_modules cache target + +## DEPLOYMENT + +.PHONY: check-env-vars +check-env-vars: ## Check mandatory environment variables + $(if ${DEPLOY_ENV},,$(error Must specify DEPLOY_ENV)) + $(if ${DNS_NAME},,$(error Must specify DNS_NAME)) + +.PHONY: preview +preview: ## Set environment to preview + $(eval export DEPLOY_ENV=preview) + $(eval export DNS_NAME="notify.works") + @true + +.PHONY: staging +staging: ## Set environment to staging + $(eval export DEPLOY_ENV=staging) + $(eval export DNS_NAME="staging-notify.works") + @true + +.PHONY: production +production: ## Set environment to production + $(eval export DEPLOY_ENV=production) + $(eval export DNS_NAME="notifications.service.gov.uk") + @true + .PHONY: cf-login cf-login: ## Log in to Cloud Foundry $(if ${CF_USERNAME},,$(error Must specify CF_USERNAME))