From baadc19a4276db641dd503bf48115891d53f8912 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Fri, 28 Feb 2020 17:46:43 +0200 Subject: [PATCH] build: cleanup makefile --- .circleci/config.yml | 2 +- .gitignore | 3 +- Makefile | 78 ++------------------------------------------ 3 files changed, 6 insertions(+), 77 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1f7ca709..867044a5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -289,4 +289,4 @@ workflows: branches: ignore: /.*/ tags: - ignore: /^chart.*/ \ No newline at end of file + ignore: /^chart.*/ diff --git a/.gitignore b/.gitignore index 20da41e8..257109fc 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ bin/ _tmp/ artifacts/gcloud/ -.idea \ No newline at end of file +.idea +Makefile.dev \ No newline at end of file diff --git a/Makefile b/Makefile index 4bbef9de..9e2dddf3 100644 --- a/Makefile +++ b/Makefile @@ -1,40 +1,11 @@ TAG?=latest VERSION?=$(shell grep 'VERSION' pkg/version/version.go | awk '{ print $$4 }' | tr -d '"') -VERSION_MINOR:=$(shell grep 'VERSION' pkg/version/version.go | awk '{ print $$4 }' | tr -d '"' | rev | cut -d'.' -f2- | rev) -PATCH:=$(shell grep 'VERSION' pkg/version/version.go | awk '{ print $$4 }' | tr -d '"' | awk -F. '{print $$NF}') LT_VERSION?=$(shell grep 'VERSION' cmd/loadtester/main.go | awk '{ print $$4 }' | tr -d '"' | head -n1) -TS=$(shell date +%Y-%m-%d_%H-%M-%S) - -run: - GO111MODULE=on go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=istio -namespace=test-istio \ - -metrics-server=https://prometheus.istio.flagger.dev - -run-appmesh: - GO111MODULE=on go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=appmesh \ - -metrics-server=http://acfc235624ca911e9a94c02c4171f346-1585187926.us-west-2.elb.amazonaws.com:9090 - -run-nginx: - GO111MODULE=on go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=nginx -namespace=nginx \ - -metrics-server=http://prometheus-weave.istio.weavedx.com - -run-smi: - GO111MODULE=on go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=smi:istio -namespace=smi \ - -metrics-server=https://prometheus.istio.weavedx.com - -run-gloo: - GO111MODULE=on go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=gloo -namespace=gloo \ - -metrics-server=https://prometheus.istio.weavedx.com - -run-nop: - GO111MODULE=on go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=none -namespace=bg \ - -metrics-server=https://prometheus.istio.weavedx.com - -run-linkerd: - GO111MODULE=on go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=linkerd -namespace=dev \ - -metrics-server=https://prometheus.linkerd.flagger.dev build: - GIT_COMMIT=$$(git rev-list -1 HEAD) && GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w -X github.com/weaveworks/flagger/pkg/version.REVISION=$${GIT_COMMIT}" -a -installsuffix cgo -o ./bin/flagger ./cmd/flagger/* + GIT_COMMIT=$$(git rev-list -1 HEAD) && CGO_ENABLED=0 GOOS=linux go build \ + -ldflags "-s -w -X github.com/weaveworks/flagger/pkg/version.REVISION=$${GIT_COMMIT}" \ + -a -installsuffix cgo -o ./bin/flagger ./cmd/flagger/* docker build -t weaveworks/flagger:$(TAG) . -f Dockerfile push: @@ -59,16 +30,6 @@ crd: cat artifacts/flagger/crd.yaml > charts/flagger/crds/crd.yaml cat artifacts/flagger/crd.yaml > kustomize/base/flagger/crd.yaml -helm-package: - cd charts/ && helm package ./* - mv charts/*.tgz bin/ - curl -s https://raw.githubusercontent.com/weaveworks/flagger/gh-pages/index.yaml > ./bin/index.yaml - helm repo index bin --url https://flagger.app --merge ./bin/index.yaml - -helm-up: - helm upgrade --install flagger ./charts/flagger --namespace=istio-system --set crd.create=false - helm upgrade --install flagger-grafana ./charts/grafana --namespace=istio-system - version-set: @next="$(TAG)" && \ current="$(VERSION)" && \ @@ -80,47 +41,14 @@ version-set: sed -i '' "s/newTag: $$current/newTag: $$next/g" kustomize/base/flagger/kustomization.yaml && \ echo "Version $$next set in code, deployment, chart and kustomize" -version-up: - @next="$(VERSION_MINOR).$$(($(PATCH) + 1))" && \ - current="$(VERSION)" && \ - sed -i '' "s/$$current/$$next/g" pkg/version/version.go && \ - sed -i '' "s/flagger:$$current/flagger:$$next/g" artifacts/flagger/deployment.yaml && \ - sed -i '' "s/tag: $$current/tag: $$next/g" charts/flagger/values.yaml && \ - sed -i '' "s/appVersion: $$current/appVersion: $$next/g" charts/flagger/Chart.yaml && \ - echo "Version $$next set in code, deployment and chart" - -dev-up: version-up - @echo "Starting build/push/deploy pipeline for $(VERSION)" - docker build -t quay.io/stefanprodan/flagger:$(VERSION) . -f Dockerfile - docker push quay.io/stefanprodan/flagger:$(VERSION) - kubectl apply -f ./artifacts/flagger/crd.yaml - helm upgrade -i flagger ./charts/flagger --namespace=istio-system --set crd.create=false - release: git tag $(VERSION) git push origin $(VERSION) -release-set: fmt version-set helm-package - git add . - git commit -m "Release $(VERSION)" - git push origin master - git tag $(VERSION) - git push origin $(VERSION) - release-notes: cd /tmp && GH_REL_URL="https://github.com/buchanae/github-release-notes/releases/download/0.2.0/github-release-notes-linux-amd64-0.2.0.tar.gz" && \ curl -sSL $${GH_REL_URL} | tar xz && sudo mv github-release-notes /usr/local/bin/ -reset-test: - kubectl delete -f ./artifacts/namespaces - kubectl apply -f ./artifacts/namespaces - kubectl apply -f ./artifacts/canaries - -loadtester-run: loadtester-build - docker build -t weaveworks/flagger-loadtester:$(LT_VERSION) . -f Dockerfile.loadtester - docker rm -f tester || true - docker run -dp 8888:9090 --name tester weaveworks/flagger-loadtester:$(LT_VERSION) - loadtester-build: GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o ./bin/loadtester ./cmd/loadtester/*