2019-06-05 19:58:11 +00:00
|
|
|
PACKAGE=github.com/argoproj/argo-cd/common
|
2018-02-15 00:53:07 +00:00
|
|
|
CURRENT_DIR=$(shell pwd)
|
|
|
|
|
DIST_DIR=${CURRENT_DIR}/dist
|
2018-04-23 07:18:59 +00:00
|
|
|
CLI_NAME=argocd
|
2018-02-15 00:53:07 +00:00
|
|
|
|
|
|
|
|
VERSION=$(shell cat ${CURRENT_DIR}/VERSION)
|
|
|
|
|
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
|
|
|
|
|
GIT_COMMIT=$(shell git rev-parse HEAD)
|
|
|
|
|
GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
|
|
|
|
|
GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)
|
2020-05-27 06:04:09 +00:00
|
|
|
PACKR_CMD=$(shell if [ "`which packr`" ]; then echo "packr"; else echo "go run github.com/gobuffalo/packr/packr"; fi)
|
2020-05-15 21:43:12 +00:00
|
|
|
VOLUME_MOUNT=$(shell if test "$(go env GOOS)" = "darwin"; then echo ":delegated"; elif test selinuxenabled; then echo ":Z"; else echo ""; fi)
|
2018-02-15 00:53:07 +00:00
|
|
|
|
2020-03-27 18:36:20 +00:00
|
|
|
GOPATH?=$(shell if test -x `which go`; then go env GOPATH; else echo "$(HOME)/go"; fi)
|
|
|
|
|
GOCACHE?=$(HOME)/.cache/go-build
|
|
|
|
|
|
|
|
|
|
DOCKER_SRCDIR?=$(GOPATH)/src
|
|
|
|
|
DOCKER_WORKDIR?=/go/src/github.com/argoproj/argo-cd
|
|
|
|
|
|
|
|
|
|
ARGOCD_PROCFILE?=Procfile
|
|
|
|
|
|
|
|
|
|
# Configuration for building argocd-test-tools image
|
|
|
|
|
TEST_TOOLS_NAMESPACE?=argoproj
|
|
|
|
|
TEST_TOOLS_IMAGE=argocd-test-tools
|
2020-05-21 02:24:25 +00:00
|
|
|
TEST_TOOLS_TAG?=v0.5.0
|
2020-03-27 18:36:20 +00:00
|
|
|
ifdef TEST_TOOLS_NAMESPACE
|
|
|
|
|
TEST_TOOLS_PREFIX=${TEST_TOOLS_NAMESPACE}/
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# You can change the ports where ArgoCD components will be listening on by
|
|
|
|
|
# setting the appropriate environment variables before running make.
|
|
|
|
|
ARGOCD_E2E_APISERVER_PORT?=8080
|
|
|
|
|
ARGOCD_E2E_REPOSERVER_PORT?=8081
|
|
|
|
|
ARGOCD_E2E_REDIS_PORT?=6379
|
|
|
|
|
ARGOCD_E2E_DEX_PORT?=5556
|
|
|
|
|
ARGOCD_E2E_YARN_HOST?=localhost
|
|
|
|
|
|
|
|
|
|
ARGOCD_IN_CI?=false
|
|
|
|
|
ARGOCD_TEST_E2E?=true
|
|
|
|
|
|
2020-04-19 07:05:26 +00:00
|
|
|
ARGOCD_LINT_GOGC?=20
|
2020-04-16 15:55:13 +00:00
|
|
|
|
2020-03-27 18:36:20 +00:00
|
|
|
# Runs any command in the argocd-test-utils container in server mode
|
|
|
|
|
# Server mode container will start with uid 0 and drop privileges during runtime
|
|
|
|
|
define run-in-test-server
|
|
|
|
|
docker run --rm -it \
|
|
|
|
|
--name argocd-test-server \
|
|
|
|
|
-e USER_ID=$(shell id -u) \
|
|
|
|
|
-e HOME=/home/user \
|
|
|
|
|
-e GOPATH=/go \
|
|
|
|
|
-e GOCACHE=/tmp/go-build-cache \
|
|
|
|
|
-e ARGOCD_IN_CI=$(ARGOCD_IN_CI) \
|
|
|
|
|
-e ARGOCD_E2E_TEST=$(ARGOCD_E2E_TEST) \
|
|
|
|
|
-e ARGOCD_E2E_YARN_HOST=$(ARGOCD_E2E_YARN_HOST) \
|
|
|
|
|
-v ${DOCKER_SRCDIR}:/go/src${VOLUME_MOUNT} \
|
2020-05-26 16:15:38 +00:00
|
|
|
-v ${GOPATH}/pkg/mod:/go/pkg/mod${VOLUME_MOUNT} \
|
2020-03-27 18:36:20 +00:00
|
|
|
-v ${GOCACHE}:/tmp/go-build-cache${VOLUME_MOUNT} \
|
|
|
|
|
-v ${HOME}/.kube:/home/user/.kube${VOLUME_MOUNT} \
|
|
|
|
|
-v /tmp:/tmp${VOLUME_MOUNT} \
|
|
|
|
|
-w ${DOCKER_WORKDIR} \
|
|
|
|
|
-p ${ARGOCD_E2E_APISERVER_PORT}:8080 \
|
|
|
|
|
-p 4000:4000 \
|
|
|
|
|
$(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE):$(TEST_TOOLS_TAG) \
|
|
|
|
|
bash -c "$(1)"
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
# Runs any command in the argocd-test-utils container in client mode
|
|
|
|
|
define run-in-test-client
|
|
|
|
|
docker run --rm -it \
|
|
|
|
|
--name argocd-test-client \
|
|
|
|
|
-u $(shell id -u) \
|
|
|
|
|
-e HOME=/home/user \
|
|
|
|
|
-e GOPATH=/go \
|
|
|
|
|
-e ARGOCD_E2E_K3S=$(ARGOCD_E2E_K3S) \
|
|
|
|
|
-e GOCACHE=/tmp/go-build-cache \
|
2020-04-16 15:55:13 +00:00
|
|
|
-e ARGOCD_LINT_GOGC=$(ARGOCD_LINT_GOGC) \
|
2020-03-27 18:36:20 +00:00
|
|
|
-v ${DOCKER_SRCDIR}:/go/src${VOLUME_MOUNT} \
|
2020-05-26 16:15:38 +00:00
|
|
|
-v ${GOPATH}/pkg/mod:/go/pkg/mod${VOLUME_MOUNT} \
|
2020-03-27 18:36:20 +00:00
|
|
|
-v ${GOCACHE}:/tmp/go-build-cache${VOLUME_MOUNT} \
|
|
|
|
|
-v ${HOME}/.kube:/home/user/.kube${VOLUME_MOUNT} \
|
|
|
|
|
-v /tmp:/tmp${VOLUME_MOUNT} \
|
|
|
|
|
-w ${DOCKER_WORKDIR} \
|
|
|
|
|
$(TEST_TOOLS_NAMESPACE)/$(TEST_TOOLS_IMAGE):$(TEST_TOOLS_TAG) \
|
|
|
|
|
bash -c "$(1)"
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
define exec-in-test-server
|
|
|
|
|
docker exec -it -u $(shell id -u) -e ARGOCD_E2E_K3S=$(ARGOCD_E2E_K3S) argocd-test-server $(1)
|
2019-08-06 07:24:03 +00:00
|
|
|
endef
|
|
|
|
|
|
2019-05-23 00:21:56 +00:00
|
|
|
PATH:=$(PATH):$(PWD)/hack
|
|
|
|
|
|
2019-02-01 21:12:52 +00:00
|
|
|
# docker image publishing options
|
2019-05-22 22:59:30 +00:00
|
|
|
DOCKER_PUSH?=false
|
2019-10-11 20:42:02 +00:00
|
|
|
IMAGE_NAMESPACE?=
|
2019-02-01 21:12:52 +00:00
|
|
|
# perform static compilation
|
2019-05-22 22:59:30 +00:00
|
|
|
STATIC_BUILD?=true
|
2019-02-01 21:12:52 +00:00
|
|
|
# build development images
|
2019-05-22 22:59:30 +00:00
|
|
|
DEV_IMAGE?=false
|
2019-02-01 21:12:52 +00:00
|
|
|
|
2018-02-15 00:53:07 +00:00
|
|
|
override LDFLAGS += \
|
|
|
|
|
-X ${PACKAGE}.version=${VERSION} \
|
|
|
|
|
-X ${PACKAGE}.buildDate=${BUILD_DATE} \
|
|
|
|
|
-X ${PACKAGE}.gitCommit=${GIT_COMMIT} \
|
|
|
|
|
-X ${PACKAGE}.gitTreeState=${GIT_TREE_STATE}
|
|
|
|
|
|
2019-02-01 21:12:52 +00:00
|
|
|
ifeq (${STATIC_BUILD}, true)
|
|
|
|
|
override LDFLAGS += -extldflags "-static"
|
|
|
|
|
endif
|
|
|
|
|
|
2018-02-15 00:53:07 +00:00
|
|
|
ifneq (${GIT_TAG},)
|
|
|
|
|
IMAGE_TAG=${GIT_TAG}
|
|
|
|
|
LDFLAGS += -X ${PACKAGE}.gitTag=${GIT_TAG}
|
2020-02-02 04:47:25 +00:00
|
|
|
else
|
|
|
|
|
IMAGE_TAG?=latest
|
2018-02-15 00:53:07 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifeq (${DOCKER_PUSH},true)
|
|
|
|
|
ifndef IMAGE_NAMESPACE
|
|
|
|
|
$(error IMAGE_NAMESPACE must be set to push images (e.g. IMAGE_NAMESPACE=argoproj))
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifdef IMAGE_NAMESPACE
|
|
|
|
|
IMAGE_PREFIX=${IMAGE_NAMESPACE}/
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
.PHONY: all
|
2018-11-17 02:14:52 +00:00
|
|
|
all: cli image argocd-util
|
2018-02-15 00:53:07 +00:00
|
|
|
|
2020-04-06 19:13:50 +00:00
|
|
|
.PHONY: gogen
|
|
|
|
|
gogen:
|
2020-05-26 16:15:38 +00:00
|
|
|
export GO111MODULE=off
|
2020-04-06 19:13:50 +00:00
|
|
|
go generate ./util/argo/...
|
|
|
|
|
|
2018-02-15 00:53:07 +00:00
|
|
|
.PHONY: protogen
|
|
|
|
|
protogen:
|
2020-05-26 16:15:38 +00:00
|
|
|
export GO111MODULE=off
|
2018-02-15 00:53:07 +00:00
|
|
|
./hack/generate-proto.sh
|
|
|
|
|
|
2019-04-07 00:18:00 +00:00
|
|
|
.PHONY: openapigen
|
|
|
|
|
openapigen:
|
2020-05-26 16:15:38 +00:00
|
|
|
export GO111MODULE=off
|
2019-04-07 00:18:00 +00:00
|
|
|
./hack/update-openapi.sh
|
|
|
|
|
|
2018-02-17 01:34:13 +00:00
|
|
|
.PHONY: clientgen
|
|
|
|
|
clientgen:
|
2020-05-26 16:15:38 +00:00
|
|
|
export GO111MODULE=off
|
2018-02-16 23:18:37 +00:00
|
|
|
./hack/update-codegen.sh
|
|
|
|
|
|
2019-07-23 18:24:59 +00:00
|
|
|
.PHONY: codegen-local
|
2020-05-26 16:15:38 +00:00
|
|
|
codegen-local: mod-vendor-local gogen protogen clientgen openapigen manifests-local
|
2019-07-23 18:24:59 +00:00
|
|
|
|
2018-02-17 01:34:13 +00:00
|
|
|
.PHONY: codegen
|
2020-03-31 17:33:59 +00:00
|
|
|
codegen:
|
2020-03-27 18:36:20 +00:00
|
|
|
$(call run-in-test-client,make codegen-local)
|
2019-06-27 21:44:49 +00:00
|
|
|
|
2018-02-18 21:16:24 +00:00
|
|
|
.PHONY: cli
|
2018-06-15 21:29:20 +00:00
|
|
|
cli: clean-debug
|
2019-02-01 21:12:52 +00:00
|
|
|
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${CLI_NAME} ./cmd/argocd
|
2018-04-23 07:18:59 +00:00
|
|
|
|
2020-03-27 18:36:20 +00:00
|
|
|
.PHONY: cli-docker
|
|
|
|
|
go build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${CLI_NAME} ./cmd/argocd
|
|
|
|
|
|
2018-11-27 21:39:06 +00:00
|
|
|
.PHONY: release-cli
|
|
|
|
|
release-cli: clean-debug image
|
|
|
|
|
docker create --name tmp-argocd-linux $(IMAGE_PREFIX)argocd:$(IMAGE_TAG)
|
|
|
|
|
docker cp tmp-argocd-linux:/usr/local/bin/argocd ${DIST_DIR}/argocd-linux-amd64
|
|
|
|
|
docker cp tmp-argocd-linux:/usr/local/bin/argocd-darwin-amd64 ${DIST_DIR}/argocd-darwin-amd64
|
2020-01-24 07:18:00 +00:00
|
|
|
docker cp tmp-argocd-linux:/usr/local/bin/argocd-windows-amd64.exe ${DIST_DIR}/argocd-windows-amd64.exe
|
2018-04-23 07:18:59 +00:00
|
|
|
docker rm tmp-argocd-linux
|
|
|
|
|
|
SSO Support (#152)
This change implements SSO support.
dex is run as a sidecar to the ArgoCD API server, which fronts dex using a reverse proxy. The end result is that the ArgoCD acts as an OIDC provider serving under /api/dex. The login flow begins at /auth/login, which redirects to the Dex's OAuth2 consent page and ultimately directed to the IdP provider's login page, where they enter their credentials. After logging in, the OAuth2 redirect flows back to the client app, ultimately reaching /auth/callback, where the OIDC token claims are signed, and persisted in the users's cookie.
The dex configuration YAML is formulated during startup (through the argocd-util utility), with the configuration values taken from the argocd-cm configmap and the argocd-secret.
The build process was refactored to build argocd-util statically, so that it could be run inside off-the-shelf dex, which is built from alpine. Also, build speed was improved by expanding the default make targets in the Dockerfile, to avoid rebuilding each binary from scratch
Session management was refactored to use more bare-bones jwt library constructs, so we could reuse code from the user/password flow vs. OAuth2 flow.
* Initial SSO support. Run dex as sidecar. Generate dex config from ArgoCD cm and secret
* Sign and write SSO claims to JWT cookie during SSO login. Refactor session manager
* Build argo-util statically so it can run in dex sidecar. Redirect after SSO login
* Simplify app creation process to not require communication to dex gRPC server
2018-05-03 05:02:26 +00:00
|
|
|
.PHONY: argocd-util
|
2018-06-15 21:29:20 +00:00
|
|
|
argocd-util: clean-debug
|
2018-11-29 20:57:31 +00:00
|
|
|
# Build argocd-util as a statically linked binary, so it could run within the alpine-based dex container (argoproj/argo-cd#844)
|
2019-07-29 17:21:19 +00:00
|
|
|
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-util ./cmd/argocd-util
|
SSO Support (#152)
This change implements SSO support.
dex is run as a sidecar to the ArgoCD API server, which fronts dex using a reverse proxy. The end result is that the ArgoCD acts as an OIDC provider serving under /api/dex. The login flow begins at /auth/login, which redirects to the Dex's OAuth2 consent page and ultimately directed to the IdP provider's login page, where they enter their credentials. After logging in, the OAuth2 redirect flows back to the client app, ultimately reaching /auth/callback, where the OIDC token claims are signed, and persisted in the users's cookie.
The dex configuration YAML is formulated during startup (through the argocd-util utility), with the configuration values taken from the argocd-cm configmap and the argocd-secret.
The build process was refactored to build argocd-util statically, so that it could be run inside off-the-shelf dex, which is built from alpine. Also, build speed was improved by expanding the default make targets in the Dockerfile, to avoid rebuilding each binary from scratch
Session management was refactored to use more bare-bones jwt library constructs, so we could reuse code from the user/password flow vs. OAuth2 flow.
* Initial SSO support. Run dex as sidecar. Generate dex config from ArgoCD cm and secret
* Sign and write SSO claims to JWT cookie during SSO login. Refactor session manager
* Build argo-util statically so it can run in dex sidecar. Redirect after SSO login
* Simplify app creation process to not require communication to dex gRPC server
2018-05-03 05:02:26 +00:00
|
|
|
|
2020-03-27 18:36:20 +00:00
|
|
|
# .PHONY: dev-tools-image
|
|
|
|
|
# dev-tools-image:
|
|
|
|
|
# docker build -t $(DEV_TOOLS_PREFIX)$(DEV_TOOLS_IMAGE) . -f hack/Dockerfile.dev-tools
|
|
|
|
|
# docker tag $(DEV_TOOLS_PREFIX)$(DEV_TOOLS_IMAGE) $(DEV_TOOLS_PREFIX)$(DEV_TOOLS_IMAGE):$(DEV_TOOLS_VERSION)
|
|
|
|
|
|
|
|
|
|
.PHONY: test-tools-image
|
|
|
|
|
test-tools-image:
|
|
|
|
|
docker build -t $(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE) -f test/container/Dockerfile .
|
|
|
|
|
docker tag $(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE) $(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE):$(TEST_TOOLS_TAG)
|
2019-07-23 18:24:59 +00:00
|
|
|
|
2019-08-06 07:24:03 +00:00
|
|
|
.PHONY: manifests-local
|
|
|
|
|
manifests-local:
|
2018-07-30 23:13:54 +00:00
|
|
|
./hack/update-manifests.sh
|
2018-07-17 01:37:41 +00:00
|
|
|
|
2019-08-06 07:24:03 +00:00
|
|
|
.PHONY: manifests
|
2020-03-27 18:36:20 +00:00
|
|
|
manifests: test-tools-image
|
|
|
|
|
$(call run-in-test-client,make manifests-local IMAGE_TAG='${IMAGE_TAG}')
|
2019-08-06 07:24:03 +00:00
|
|
|
|
|
|
|
|
|
2018-11-27 21:39:06 +00:00
|
|
|
# NOTE: we use packr to do the build instead of go, since we embed swagger files and policy.csv
|
|
|
|
|
# files into the go binary
|
2018-02-16 01:13:47 +00:00
|
|
|
.PHONY: server
|
2018-06-15 21:29:20 +00:00
|
|
|
server: clean-debug
|
2019-03-19 21:25:19 +00:00
|
|
|
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-server ./cmd/argocd-server
|
2019-05-16 18:05:35 +00:00
|
|
|
|
2018-03-07 06:05:07 +00:00
|
|
|
.PHONY: repo-server
|
|
|
|
|
repo-server:
|
2019-07-29 17:21:19 +00:00
|
|
|
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-repo-server ./cmd/argocd-repo-server
|
2018-03-07 06:05:07 +00:00
|
|
|
|
2018-02-22 18:56:14 +00:00
|
|
|
.PHONY: controller
|
|
|
|
|
controller:
|
2019-03-19 21:25:19 +00:00
|
|
|
CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-application-controller ./cmd/argocd-application-controller
|
2018-02-23 23:12:11 +00:00
|
|
|
|
2019-02-01 21:12:52 +00:00
|
|
|
.PHONY: packr
|
|
|
|
|
packr:
|
2020-05-27 06:04:09 +00:00
|
|
|
go build -o ${DIST_DIR}/packr github.com/gobuffalo/packr/packr/
|
2019-02-01 21:12:52 +00:00
|
|
|
|
2018-11-15 11:46:10 +00:00
|
|
|
.PHONY: image
|
2019-02-01 21:12:52 +00:00
|
|
|
ifeq ($(DEV_IMAGE), true)
|
|
|
|
|
# The "dev" image builds the binaries from the users desktop environment (instead of in Docker)
|
|
|
|
|
# which speeds up builds. Dockerfile.dev needs to be copied into dist to perform the build, since
|
|
|
|
|
# the dist directory is under .dockerignore.
|
2019-09-17 07:48:35 +00:00
|
|
|
IMAGE_TAG="dev-$(shell git describe --always --dirty)"
|
2019-02-01 21:12:52 +00:00
|
|
|
image: packr
|
|
|
|
|
docker build -t argocd-base --target argocd-base .
|
2019-09-17 07:48:35 +00:00
|
|
|
docker build -t argocd-ui --target argocd-ui .
|
2019-02-01 21:12:52 +00:00
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-server ./cmd/argocd-server
|
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-application-controller ./cmd/argocd-application-controller
|
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-repo-server ./cmd/argocd-repo-server
|
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-util ./cmd/argocd-util
|
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd ./cmd/argocd
|
|
|
|
|
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-darwin-amd64 ./cmd/argocd
|
2020-01-24 07:18:00 +00:00
|
|
|
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-windows-amd64.exe ./cmd/argocd
|
2019-02-01 21:12:52 +00:00
|
|
|
cp Dockerfile.dev dist
|
|
|
|
|
docker build -t $(IMAGE_PREFIX)argocd:$(IMAGE_TAG) -f dist/Dockerfile.dev dist
|
|
|
|
|
else
|
2018-11-15 11:46:10 +00:00
|
|
|
image:
|
2018-11-27 21:39:06 +00:00
|
|
|
docker build -t $(IMAGE_PREFIX)argocd:$(IMAGE_TAG) .
|
2019-02-01 21:12:52 +00:00
|
|
|
endif
|
2018-11-15 11:46:10 +00:00
|
|
|
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argocd:$(IMAGE_TAG) ; fi
|
2018-04-25 21:18:30 +00:00
|
|
|
|
2018-02-26 21:47:42 +00:00
|
|
|
.PHONY: builder-image
|
|
|
|
|
builder-image:
|
2018-08-28 23:00:14 +00:00
|
|
|
docker build -t $(IMAGE_PREFIX)argo-cd-ci-builder:$(IMAGE_TAG) --target builder .
|
2019-07-13 00:17:23 +00:00
|
|
|
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argo-cd-ci-builder:$(IMAGE_TAG) ; fi
|
2018-02-26 21:47:42 +00:00
|
|
|
|
2020-05-26 16:15:38 +00:00
|
|
|
.PHONY: mod-download
|
|
|
|
|
mod-download:
|
|
|
|
|
$(call run-in-test-client,go mod download)
|
2020-03-27 18:36:20 +00:00
|
|
|
|
2020-05-26 16:15:38 +00:00
|
|
|
.PHONY: mod-download-local
|
|
|
|
|
mod-download-local:
|
|
|
|
|
go mod download
|
2019-09-11 17:33:00 +00:00
|
|
|
|
2020-05-26 16:15:38 +00:00
|
|
|
.PHONY: mod-vendor
|
|
|
|
|
mod-vendor:
|
|
|
|
|
$(call run-in-test-client,go mod vendor)
|
2020-03-27 18:36:20 +00:00
|
|
|
|
2020-05-26 16:15:38 +00:00
|
|
|
.PHONY: mod-vendor-local
|
|
|
|
|
mod-vendor-local: mod-download-local
|
|
|
|
|
go mod vendor
|
2020-03-29 09:10:02 +00:00
|
|
|
|
2020-03-27 18:36:20 +00:00
|
|
|
# Deprecated - replace by install-local-tools
|
2019-10-11 18:55:48 +00:00
|
|
|
.PHONY: install-lint-tools
|
|
|
|
|
install-lint-tools:
|
|
|
|
|
./hack/install.sh lint-tools
|
2018-02-15 00:53:07 +00:00
|
|
|
|
2020-03-27 18:36:20 +00:00
|
|
|
# Run linter on the code
|
2019-09-19 17:14:51 +00:00
|
|
|
.PHONY: lint
|
2019-10-11 18:55:48 +00:00
|
|
|
lint:
|
2020-03-27 18:36:20 +00:00
|
|
|
$(call run-in-test-client,make lint-local)
|
|
|
|
|
|
|
|
|
|
# Run linter on the code (local version)
|
|
|
|
|
.PHONY: lint-local
|
|
|
|
|
lint-local:
|
2019-10-11 18:55:48 +00:00
|
|
|
golangci-lint --version
|
2020-01-29 16:26:05 +00:00
|
|
|
# NOTE: If you get a "Killed" OOM message, try reducing the value of GOGC
|
|
|
|
|
# See https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
|
2020-04-16 15:55:13 +00:00
|
|
|
GOGC=$(ARGOCD_LINT_GOGC) GOMAXPROCS=2 golangci-lint run --fix --verbose --timeout 300s
|
2019-09-19 17:14:51 +00:00
|
|
|
|
2020-03-30 20:21:27 +00:00
|
|
|
.PHONY: lint-ui
|
|
|
|
|
lint-ui:
|
|
|
|
|
$(call run-in-test-client,make lint-ui-local)
|
|
|
|
|
|
|
|
|
|
.PHONY: lint-ui-local
|
|
|
|
|
lint-ui-local:
|
|
|
|
|
cd ui && yarn lint
|
|
|
|
|
|
2020-03-27 18:36:20 +00:00
|
|
|
# Build all Go code
|
2019-03-28 18:20:51 +00:00
|
|
|
.PHONY: build
|
2019-03-31 05:14:35 +00:00
|
|
|
build:
|
2020-03-27 18:36:20 +00:00
|
|
|
mkdir -p $(GOCACHE)
|
|
|
|
|
$(call run-in-test-client, make build-local)
|
|
|
|
|
|
|
|
|
|
# Build all Go code (local version)
|
|
|
|
|
.PHONY: build-local
|
2020-05-26 16:15:38 +00:00
|
|
|
build-local: mod-vendor-local
|
|
|
|
|
export GO111MODULE=off
|
2020-03-27 18:36:20 +00:00
|
|
|
go build -p 1 -v `go list ./... | grep -v 'resource_customizations\|test/e2e'`
|
|
|
|
|
|
|
|
|
|
# Run all unit tests
|
|
|
|
|
#
|
|
|
|
|
# If TEST_MODULE is set (to fully qualified module name), only this specific
|
|
|
|
|
# module will be tested.
|
2018-02-15 00:53:07 +00:00
|
|
|
.PHONY: test
|
2020-03-31 17:33:59 +00:00
|
|
|
test:
|
2020-03-27 18:36:20 +00:00
|
|
|
mkdir -p $(GOCACHE)
|
|
|
|
|
$(call run-in-test-client,make TEST_MODULE=$(TEST_MODULE) test-local)
|
|
|
|
|
|
|
|
|
|
# Run all unit tests (local version)
|
|
|
|
|
.PHONY: test-local
|
2020-05-26 16:15:38 +00:00
|
|
|
test-local: mod-vendor-local
|
|
|
|
|
export GO111MODULE=off
|
2020-03-27 18:36:20 +00:00
|
|
|
if test "$(TEST_MODULE)" = ""; then \
|
|
|
|
|
./hack/test.sh -coverprofile=coverage.out `go list ./... | grep -v 'test/e2e'`; \
|
|
|
|
|
else \
|
|
|
|
|
./hack/test.sh -coverprofile=coverage.out "$(TEST_MODULE)"; \
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Run the E2E test suite. E2E test servers (see start-e2e target) must be
|
|
|
|
|
# started before.
|
2018-04-18 20:53:37 +00:00
|
|
|
.PHONY: test-e2e
|
2020-03-27 18:36:20 +00:00
|
|
|
test-e2e:
|
|
|
|
|
$(call exec-in-test-server,make test-e2e-local)
|
|
|
|
|
|
|
|
|
|
# Run the E2E test suite (local version)
|
|
|
|
|
.PHONY: test-e2e-local
|
|
|
|
|
test-e2e-local: cli
|
2020-01-29 16:26:05 +00:00
|
|
|
# NO_PROXY ensures all tests don't go out through a proxy if one is configured on the test system
|
2020-05-26 16:15:38 +00:00
|
|
|
export GO111MODULE=off
|
2020-03-16 18:51:59 +00:00
|
|
|
NO_PROXY=* ./hack/test.sh -timeout 15m -v ./test/e2e
|
2018-02-15 00:53:07 +00:00
|
|
|
|
2020-03-27 18:36:20 +00:00
|
|
|
# Spawns a shell in the test server container for debugging purposes
|
|
|
|
|
debug-test-server:
|
|
|
|
|
$(call run-in-test-server,/bin/bash)
|
|
|
|
|
|
|
|
|
|
# Spawns a shell in the test client container for debugging purposes
|
|
|
|
|
debug-test-client:
|
|
|
|
|
$(call run-in-test-client,/bin/bash)
|
|
|
|
|
|
|
|
|
|
# Starts e2e server in a container
|
2019-04-17 17:53:37 +00:00
|
|
|
.PHONY: start-e2e
|
2020-03-27 18:36:20 +00:00
|
|
|
start-e2e:
|
2019-07-24 22:50:31 +00:00
|
|
|
docker version
|
2020-03-27 18:36:20 +00:00
|
|
|
mkdir -p ${GOCACHE}
|
|
|
|
|
$(call run-in-test-server,make ARGOCD_PROCFILE=test/container/Procfile start-e2e-local)
|
|
|
|
|
|
|
|
|
|
# Starts e2e server locally (or within a container)
|
|
|
|
|
.PHONY: start-e2e-local
|
2020-05-26 16:15:38 +00:00
|
|
|
start-e2e-local: mod-vendor-local
|
|
|
|
|
export GO111MODULE=off
|
2019-04-17 17:53:37 +00:00
|
|
|
kubectl create ns argocd-e2e || true
|
2019-07-13 00:17:23 +00:00
|
|
|
kubectl config set-context --current --namespace=argocd-e2e
|
2019-04-17 17:53:37 +00:00
|
|
|
kustomize build test/manifests/base | kubectl apply -f -
|
2019-07-25 00:25:27 +00:00
|
|
|
# set paths for locally managed ssh known hosts and tls certs data
|
2019-08-04 18:35:00 +00:00
|
|
|
ARGOCD_SSH_DATA_PATH=/tmp/argo-e2e/app/config/ssh \
|
|
|
|
|
ARGOCD_TLS_DATA_PATH=/tmp/argo-e2e/app/config/tls \
|
2019-09-05 20:31:04 +00:00
|
|
|
ARGOCD_E2E_DISABLE_AUTH=false \
|
|
|
|
|
ARGOCD_ZJWT_FEATURE_FLAG=always \
|
2020-03-27 18:36:20 +00:00
|
|
|
ARGOCD_IN_CI=$(ARGOCD_IN_CI) \
|
|
|
|
|
ARGOCD_E2E_TEST=true \
|
|
|
|
|
goreman -f $(ARGOCD_PROCFILE) start
|
2019-04-17 17:53:37 +00:00
|
|
|
|
2018-06-15 21:29:20 +00:00
|
|
|
# Cleans VSCode debug.test files from sub-dirs to prevent them from being included in packr boxes
|
|
|
|
|
.PHONY: clean-debug
|
|
|
|
|
clean-debug:
|
|
|
|
|
-find ${CURRENT_DIR} -name debug.test | xargs rm -f
|
|
|
|
|
|
2018-02-15 00:53:07 +00:00
|
|
|
.PHONY: clean
|
2018-06-15 21:29:20 +00:00
|
|
|
clean: clean-debug
|
2018-02-15 00:53:07 +00:00
|
|
|
-rm -rf ${CURRENT_DIR}/dist
|
|
|
|
|
|
2019-04-03 22:11:48 +00:00
|
|
|
.PHONY: start
|
|
|
|
|
start:
|
2019-07-12 16:30:02 +00:00
|
|
|
docker version
|
2020-04-09 13:01:45 +00:00
|
|
|
$(call run-in-test-server,make ARGOCD_PROCFILE=test/container/Procfile start-local ARGOCD_START=${ARGOCD_START})
|
2020-03-27 18:36:20 +00:00
|
|
|
|
|
|
|
|
# Starts a local instance of ArgoCD
|
|
|
|
|
.PHONY: start-local
|
2020-05-26 16:15:38 +00:00
|
|
|
start-local: mod-vendor-local
|
2020-03-27 18:36:20 +00:00
|
|
|
# check we can connect to Docker to start Redis
|
|
|
|
|
killall goreman || true
|
2019-08-16 16:44:17 +00:00
|
|
|
kubectl create ns argocd || true
|
2019-09-05 20:31:04 +00:00
|
|
|
ARGOCD_ZJWT_FEATURE_FLAG=always \
|
2020-03-27 18:36:20 +00:00
|
|
|
ARGOCD_IN_CI=false \
|
|
|
|
|
ARGOCD_E2E_TEST=false \
|
|
|
|
|
goreman -f $(ARGOCD_PROCFILE) start ${ARGOCD_START}
|
2019-04-03 22:11:48 +00:00
|
|
|
|
2020-05-27 17:22:13 +00:00
|
|
|
# Runs pre-commit validation with the virtualized toolchain
|
2019-02-21 16:30:13 +00:00
|
|
|
.PHONY: pre-commit
|
2019-03-31 05:14:35 +00:00
|
|
|
pre-commit: dep-ensure codegen build lint test
|
2018-02-15 00:53:07 +00:00
|
|
|
|
2020-03-27 18:36:20 +00:00
|
|
|
# Runs pre-commit validation with the local toolchain
|
|
|
|
|
.PHONY: pre-commit-local
|
|
|
|
|
pre-commit-local: dep-ensure-local codegen-local build-local lint-local test-local
|
|
|
|
|
|
2018-04-23 07:18:59 +00:00
|
|
|
.PHONY: release-precheck
|
2018-09-24 19:58:17 +00:00
|
|
|
release-precheck: manifests
|
2018-04-23 07:18:59 +00:00
|
|
|
@if [ "$(GIT_TREE_STATE)" != "clean" ]; then echo 'git tree state is $(GIT_TREE_STATE)' ; exit 1; fi
|
|
|
|
|
@if [ -z "$(GIT_TAG)" ]; then echo 'commit must be tagged to perform release' ; exit 1; fi
|
2018-09-26 14:40:42 +00:00
|
|
|
@if [ "$(GIT_TAG)" != "v`cat VERSION`" ]; then echo 'VERSION does not match git tag'; exit 1; fi
|
2018-04-23 07:18:59 +00:00
|
|
|
|
|
|
|
|
.PHONY: release
|
2019-06-17 17:45:32 +00:00
|
|
|
release: pre-commit release-precheck image release-cli
|
2019-10-21 23:54:23 +00:00
|
|
|
|
|
|
|
|
.PHONY: build-docs
|
|
|
|
|
build-docs:
|
|
|
|
|
mkdocs build
|
|
|
|
|
|
|
|
|
|
.PHONY: serve-docs
|
|
|
|
|
serve-docs:
|
|
|
|
|
mkdocs serve
|
|
|
|
|
|
|
|
|
|
.PHONY: lint-docs
|
|
|
|
|
lint-docs:
|
|
|
|
|
# https://github.com/dkhamsing/awesome_bot
|
|
|
|
|
find docs -name '*.md' -exec grep -l http {} + | xargs docker run --rm -v $(PWD):/mnt:ro dkhamsing/awesome_bot -t 3 --allow-dupe --allow-redirect --white-list `cat white-list | grep -v "#" | tr "\n" ','` --skip-save-results --
|
|
|
|
|
|
|
|
|
|
.PHONY: publish-docs
|
|
|
|
|
publish-docs: lint-docs
|
2020-01-29 16:26:05 +00:00
|
|
|
mkdocs gh-deploy
|
2020-03-27 18:36:20 +00:00
|
|
|
|
|
|
|
|
# Verify that kubectl can connect to your K8s cluster from Docker
|
|
|
|
|
.PHONY: verify-kube-connect
|
|
|
|
|
verify-kube-connect:
|
|
|
|
|
$(call run-in-test-client,kubectl version)
|
|
|
|
|
|
|
|
|
|
# Show the Go version of local and virtualized environments
|
|
|
|
|
.PHONY: show-go-version
|
|
|
|
|
show-go-version:
|
|
|
|
|
@echo -n "Local Go version: "
|
|
|
|
|
@go version
|
|
|
|
|
@echo -n "Docker Go version: "
|
|
|
|
|
$(call run-in-test-client,go version)
|
|
|
|
|
|
|
|
|
|
# Installs all tools required to build and test ArgoCD locally
|
|
|
|
|
.PHONY: install-tools-local
|
|
|
|
|
install-tools-local:
|
|
|
|
|
./hack/install.sh dep-linux
|
|
|
|
|
./hack/install.sh packr-linux
|
|
|
|
|
./hack/install.sh kubectl-linux
|
|
|
|
|
./hack/install.sh ksonnet-linux
|
|
|
|
|
./hack/install.sh helm2-linux
|
|
|
|
|
./hack/install.sh helm-linux
|
|
|
|
|
./hack/install.sh codegen-tools
|
|
|
|
|
./hack/install.sh codegen-go-tools
|
|
|
|
|
./hack/install.sh lint-tools
|
|
|
|
|
|
|
|
|
|
.PHONY: dep-ui
|
|
|
|
|
dep-ui:
|
|
|
|
|
$(call run-in-test-client,make dep-ui-local)
|
|
|
|
|
|
|
|
|
|
dep-ui-local:
|
|
|
|
|
cd ui && yarn install
|