From 9cf062f2d1336361f1840bf221aacb301abc16e5 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 12 Jun 2018 13:13:20 -0700 Subject: [PATCH] Add target to delete helm namespace and trigger codefresh webhook (#60) --- modules/codefresh/Makefile | 15 +++++++++++++++ modules/helm/Makefile | 4 ++++ 2 files changed, 19 insertions(+) create mode 100644 modules/codefresh/Makefile diff --git a/modules/codefresh/Makefile b/modules/codefresh/Makefile new file mode 100644 index 00000000..f9610e4f --- /dev/null +++ b/modules/codefresh/Makefile @@ -0,0 +1,15 @@ +CF_TRIGGER_TYPE ?= build +CF_TRIGGER_REPO_NAME ?= $(CF_REPO_NAME) +CF_TRIGGER_BRANCH ?= $(CF_BRANCH) +CF_TRIGGER_REPO_OWNER ?= $(CF_REPO_OWNER) + +## Trigger a CodeFresh WebHook +codefresh/trigger/webhook: + @curl 'https://g.codefresh.io/api/builds/$(CF_TRIGGER_SERVICE_ID)' \ + --compressed \ + -H 'content-type:application/json; charset=utf-8' \ + -H 'x-access-token: $(CF_ACCESS_TOKEN)' \ + --data-binary \ + '{"serviceId":"$(CF_TRIGGER_SERVICE_ID)","type":"$(CF_TRIGGER_TYPE)","repoOwner":"$(CF_TRIGGER_REPO_OWNER)","branch":"$(CF_TRIGGER_BRANCH)","repoName":"$(CF_TRIGGER_REPO_NAME)"}' + + diff --git a/modules/helm/Makefile b/modules/helm/Makefile index 7cd114e2..20df5103 100644 --- a/modules/helm/Makefile +++ b/modules/helm/Makefile @@ -23,3 +23,7 @@ helm/serve/index: helm/toolbox/upsert: @$(BUILD_HARNESS_PATH)/bin/helm_toolbox.sh upsert +## Delete all releases in a namespace as well as the namespace +helm/delete/namespace: + @helm list --namespace $(NAMESPACE) --short | xargs helm delete --purge + @kubectl delete namespace $(NAMESPACE) --ignore-not-found