github.com/argoproj/argo-cd@v1.8.7/Makefile (about)

     1  PACKAGE=github.com/argoproj/argo-cd/common
     2  CURRENT_DIR=$(shell pwd)
     3  DIST_DIR=${CURRENT_DIR}/dist
     4  CLI_NAME=argocd
     5  
     6  HOST_OS:=$(shell go env GOOS)
     7  HOST_ARCH:=$(shell go env GOARCH)
     8  
     9  VERSION=$(shell cat ${CURRENT_DIR}/VERSION)
    10  BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
    11  GIT_COMMIT=$(shell git rev-parse HEAD)
    12  GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
    13  GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)
    14  PACKR_CMD=$(shell if [ "`which packr`" ]; then echo "packr"; else echo "go run github.com/gobuffalo/packr/packr"; fi)
    15  VOLUME_MOUNT=$(shell if test "$(go env GOOS)" = "darwin"; then echo ":delegated"; elif test selinuxenabled; then echo ":delegated"; else echo ""; fi)
    16  
    17  GOPATH?=$(shell if test -x `which go`; then go env GOPATH; else echo "$(HOME)/go"; fi)
    18  GOCACHE?=$(HOME)/.cache/go-build
    19  
    20  DOCKER_SRCDIR?=$(GOPATH)/src
    21  DOCKER_WORKDIR?=/go/src/github.com/argoproj/argo-cd
    22  
    23  ARGOCD_PROCFILE?=Procfile
    24  
    25  # Configuration for building argocd-test-tools image
    26  TEST_TOOLS_NAMESPACE?=
    27  TEST_TOOLS_IMAGE=argocd-test-tools
    28  TEST_TOOLS_TAG?=latest
    29  ifdef TEST_TOOLS_NAMESPACE
    30  TEST_TOOLS_PREFIX=${TEST_TOOLS_NAMESPACE}/
    31  endif
    32  
    33  # You can change the ports where ArgoCD components will be listening on by
    34  # setting the appropriate environment variables before running make.
    35  ARGOCD_E2E_APISERVER_PORT?=8080
    36  ARGOCD_E2E_REPOSERVER_PORT?=8081
    37  ARGOCD_E2E_REDIS_PORT?=6379
    38  ARGOCD_E2E_DEX_PORT?=5556
    39  ARGOCD_E2E_YARN_HOST?=localhost
    40  
    41  ARGOCD_IN_CI?=false
    42  ARGOCD_TEST_E2E?=true
    43  
    44  ARGOCD_LINT_GOGC?=20
    45  
    46  # Depending on where we are (legacy or non-legacy pwd), we need to use
    47  # different Docker volume mounts for our source tree
    48  LEGACY_PATH=$(GOPATH)/src/github.com/argoproj/argo-cd
    49  ifeq ("$(PWD)","$(LEGACY_PATH)")
    50  DOCKER_SRC_MOUNT="$(DOCKER_SRCDIR):/go/src$(VOLUME_MOUNT)"
    51  else
    52  DOCKER_SRC_MOUNT="$(PWD):/go/src/github.com/argoproj/argo-cd$(VOLUME_MOUNT)"
    53  endif
    54  
    55  # Runs any command in the argocd-test-utils container in server mode
    56  # Server mode container will start with uid 0 and drop privileges during runtime
    57  define run-in-test-server
    58  	docker run --rm -it \
    59  		--name argocd-test-server \
    60  		-u $(shell id -u):$(shell id -g) \
    61  		-e USER_ID=$(shell id -u) \
    62  		-e HOME=/home/user \
    63  		-e GOPATH=/go \
    64  		-e GOCACHE=/tmp/go-build-cache \
    65  		-e ARGOCD_IN_CI=$(ARGOCD_IN_CI) \
    66  		-e ARGOCD_E2E_TEST=$(ARGOCD_E2E_TEST) \
    67  		-e ARGOCD_E2E_YARN_HOST=$(ARGOCD_E2E_YARN_HOST) \
    68  		-v ${DOCKER_SRC_MOUNT} \
    69  		-v ${GOPATH}/pkg/mod:/go/pkg/mod${VOLUME_MOUNT} \
    70  		-v ${GOCACHE}:/tmp/go-build-cache${VOLUME_MOUNT} \
    71  		-v ${HOME}/.kube:/home/user/.kube${VOLUME_MOUNT} \
    72  		-v /tmp:/tmp${VOLUME_MOUNT} \
    73  		-w ${DOCKER_WORKDIR} \
    74  		-p ${ARGOCD_E2E_APISERVER_PORT}:8080 \
    75  		-p 4000:4000 \
    76  		$(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE):$(TEST_TOOLS_TAG) \
    77  		bash -c "$(1)"
    78  endef
    79  
    80  # Runs any command in the argocd-test-utils container in client mode
    81  define run-in-test-client
    82  	docker run --rm -it \
    83  	  --name argocd-test-client \
    84  		-u $(shell id -u):$(shell id -g) \
    85  		-e HOME=/home/user \
    86  		-e GOPATH=/go \
    87  		-e ARGOCD_E2E_K3S=$(ARGOCD_E2E_K3S) \
    88  		-e GOCACHE=/tmp/go-build-cache \
    89  		-e ARGOCD_LINT_GOGC=$(ARGOCD_LINT_GOGC) \
    90  		-v ${DOCKER_SRC_MOUNT} \
    91  		-v ${GOPATH}/pkg/mod:/go/pkg/mod${VOLUME_MOUNT} \
    92  		-v ${GOCACHE}:/tmp/go-build-cache${VOLUME_MOUNT} \
    93  		-v ${HOME}/.kube:/home/user/.kube${VOLUME_MOUNT} \
    94  		-v /tmp:/tmp${VOLUME_MOUNT} \
    95  		-w ${DOCKER_WORKDIR} \
    96  		$(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE):$(TEST_TOOLS_TAG) \
    97  		bash -c "$(1)"
    98  endef
    99  
   100  # 
   101  define exec-in-test-server
   102  	docker exec -it -u $(shell id -u):$(shell id -g) -e ARGOCD_E2E_K3S=$(ARGOCD_E2E_K3S) argocd-test-server $(1)
   103  endef
   104  
   105  PATH:=$(PATH):$(PWD)/hack
   106  
   107  # docker image publishing options
   108  DOCKER_PUSH?=false
   109  IMAGE_NAMESPACE?=
   110  # perform static compilation
   111  STATIC_BUILD?=true
   112  # build development images
   113  DEV_IMAGE?=false
   114  ARGOCD_GPG_ENABLED?=true
   115  ARGOCD_E2E_APISERVER_PORT?=8080
   116  
   117  override LDFLAGS += \
   118    -X ${PACKAGE}.version=${VERSION} \
   119    -X ${PACKAGE}.buildDate=${BUILD_DATE} \
   120    -X ${PACKAGE}.gitCommit=${GIT_COMMIT} \
   121    -X ${PACKAGE}.gitTreeState=${GIT_TREE_STATE}
   122  
   123  ifeq (${STATIC_BUILD}, true)
   124  override LDFLAGS += -extldflags "-static"
   125  endif
   126  
   127  ifneq (${GIT_TAG},)
   128  IMAGE_TAG=${GIT_TAG}
   129  LDFLAGS += -X ${PACKAGE}.gitTag=${GIT_TAG}
   130  else
   131  IMAGE_TAG?=latest
   132  endif
   133  
   134  ifeq (${DOCKER_PUSH},true)
   135  ifndef IMAGE_NAMESPACE
   136  $(error IMAGE_NAMESPACE must be set to push images (e.g. IMAGE_NAMESPACE=argoproj))
   137  endif
   138  endif
   139  
   140  ifdef IMAGE_NAMESPACE
   141  IMAGE_PREFIX=${IMAGE_NAMESPACE}/
   142  endif
   143  
   144  .PHONY: all
   145  all: cli image argocd-util
   146  
   147  # We have some legacy requirements for being checked out within $GOPATH.
   148  # The ensure-gopath target can be used as dependency to ensure we are running
   149  # within these boundaries.
   150  .PHONY: ensure-gopath
   151  ensure-gopath:
   152  ifneq ("$(PWD)","$(LEGACY_PATH)")
   153  	@echo "Due to legacy requirements for codegen, repository needs to be checked out within \$$GOPATH"
   154  	@echo "Location of this repo should be '$(LEGACY_PATH)' but is '$(PWD)'"
   155  	@exit 1
   156  endif
   157  
   158  .PHONY: gogen
   159  gogen: ensure-gopath
   160  	export GO111MODULE=off
   161  	go generate ./util/argo/...
   162  
   163  .PHONY: protogen
   164  protogen: ensure-gopath
   165  	export GO111MODULE=off
   166  	./hack/generate-proto.sh
   167  
   168  .PHONY: openapigen
   169  openapigen: ensure-gopath
   170  	export GO111MODULE=off
   171  	./hack/update-openapi.sh
   172  
   173  .PHONY: clientgen
   174  clientgen: ensure-gopath
   175  	export GO111MODULE=off
   176  	./hack/update-codegen.sh
   177  
   178  .PHONY: clidocsgen
   179  clidocsgen: ensure-gopath
   180  	go run tools/cmd-docs/main.go	
   181  
   182  .PHONY: codegen-local
   183  codegen-local: ensure-gopath mod-vendor-local gogen protogen clientgen openapigen clidocsgen manifests-local
   184  	rm -rf vendor/
   185  
   186  .PHONY: codegen
   187  codegen: test-tools-image
   188  	$(call run-in-test-client,make codegen-local)
   189  
   190  .PHONY: cli
   191  cli: test-tools-image
   192  	$(call run-in-test-client, GOOS=${HOST_OS} GOARCH=${HOST_ARCH} make cli-local)
   193  
   194  .PHONY: cli-local
   195  cli-local: clean-debug
   196  	CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${CLI_NAME} ./cmd/argocd
   197  
   198  .PHONY: cli-argocd
   199  cli-argocd:
   200  	go build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${CLI_NAME} ./cmd/argocd
   201  
   202  .PHONY: release-cli
   203  release-cli: clean-debug image
   204  	docker create --name tmp-argocd-linux $(IMAGE_PREFIX)argocd:$(IMAGE_TAG)
   205  	docker cp tmp-argocd-linux:/usr/local/bin/argocd ${DIST_DIR}/argocd-linux-amd64
   206  	docker cp tmp-argocd-linux:/usr/local/bin/argocd-darwin-amd64 ${DIST_DIR}/argocd-darwin-amd64
   207  	docker cp tmp-argocd-linux:/usr/local/bin/argocd-windows-amd64.exe ${DIST_DIR}/argocd-windows-amd64.exe
   208  	docker rm tmp-argocd-linux
   209  
   210  .PHONY: argocd-util
   211  argocd-util: clean-debug
   212  	# Build argocd-util as a statically linked binary, so it could run within the alpine-based dex container (argoproj/argo-cd#844)
   213  	CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-util ./cmd/argocd-util
   214  
   215  # .PHONY: dev-tools-image
   216  # dev-tools-image:
   217  # 	docker build -t $(DEV_TOOLS_PREFIX)$(DEV_TOOLS_IMAGE) . -f hack/Dockerfile.dev-tools
   218  # 	docker tag $(DEV_TOOLS_PREFIX)$(DEV_TOOLS_IMAGE) $(DEV_TOOLS_PREFIX)$(DEV_TOOLS_IMAGE):$(DEV_TOOLS_VERSION)
   219  
   220  .PHONY: test-tools-image
   221  test-tools-image:
   222  	docker build --build-arg UID=$(shell id -u) -t $(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE) -f test/container/Dockerfile .
   223  	docker tag $(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE) $(TEST_TOOLS_PREFIX)$(TEST_TOOLS_IMAGE):$(TEST_TOOLS_TAG)
   224  
   225  .PHONY: manifests-local
   226  manifests-local:
   227  	./hack/update-manifests.sh
   228  
   229  .PHONY: manifests
   230  manifests: test-tools-image
   231  	$(call run-in-test-client,make manifests-local IMAGE_NAMESPACE='${IMAGE_NAMESPACE}' IMAGE_TAG='${IMAGE_TAG}')
   232  
   233  
   234  # NOTE: we use packr to do the build instead of go, since we embed swagger files and policy.csv
   235  # files into the go binary
   236  .PHONY: server
   237  server: clean-debug
   238  	CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-server ./cmd/argocd-server
   239  
   240  .PHONY: repo-server
   241  repo-server:
   242  	CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-repo-server ./cmd/argocd-repo-server
   243  
   244  .PHONY: controller
   245  controller:
   246  	CGO_ENABLED=0 ${PACKR_CMD} build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-application-controller ./cmd/argocd-application-controller
   247  
   248  .PHONY: packr
   249  packr:
   250  	go build -o ${DIST_DIR}/packr github.com/gobuffalo/packr/packr/
   251  
   252  .PHONY: image
   253  ifeq ($(DEV_IMAGE), true)
   254  # The "dev" image builds the binaries from the users desktop environment (instead of in Docker)
   255  # which speeds up builds. Dockerfile.dev needs to be copied into dist to perform the build, since
   256  # the dist directory is under .dockerignore.
   257  IMAGE_TAG="dev-$(shell git describe --always --dirty)"
   258  image: packr
   259  	docker build -t argocd-base --target argocd-base .
   260  	docker build -t argocd-ui --target argocd-ui .
   261  	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-server ./cmd/argocd-server
   262  	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-application-controller ./cmd/argocd-application-controller
   263  	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-repo-server ./cmd/argocd-repo-server
   264  	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-util ./cmd/argocd-util
   265  	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd ./cmd/argocd
   266  	CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-darwin-amd64 ./cmd/argocd
   267  	CGO_ENABLED=0 GOOS=windows GOARCH=amd64 dist/packr build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/argocd-windows-amd64.exe ./cmd/argocd
   268  	cp Dockerfile.dev dist
   269  	docker build -t $(IMAGE_PREFIX)argocd:$(IMAGE_TAG) -f dist/Dockerfile.dev dist
   270  else
   271  image:
   272  	docker build -t $(IMAGE_PREFIX)argocd:$(IMAGE_TAG) .
   273  endif
   274  	@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argocd:$(IMAGE_TAG) ; fi
   275  
   276  .PHONY: armimage
   277  # The "BUILD_ALL_CLIS" argument is to skip building the CLIs for darwin and windows
   278  # which would take a really long time.
   279  armimage:
   280  	docker build -t $(IMAGE_PREFIX)argocd:$(IMAGE_TAG)-arm . --build-arg BUILD_ALL_CLIS="false"
   281  
   282  .PHONY: builder-image
   283  builder-image:
   284  	docker build  -t $(IMAGE_PREFIX)argo-cd-ci-builder:$(IMAGE_TAG) --target builder .
   285  	@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argo-cd-ci-builder:$(IMAGE_TAG) ; fi
   286  
   287  .PHONY: mod-download
   288  mod-download: test-tools-image
   289  	$(call run-in-test-client,go mod download)
   290  
   291  .PHONY: mod-download-local
   292  mod-download-local:
   293  	go mod download
   294  
   295  .PHONY: mod-vendor
   296  mod-vendor: test-tools-image
   297  	$(call run-in-test-client,go mod vendor)
   298  
   299  .PHONY: mod-vendor-local
   300  mod-vendor-local: mod-download-local
   301  	go mod vendor
   302  
   303  # Deprecated - replace by install-local-tools
   304  .PHONY: install-lint-tools
   305  install-lint-tools:
   306  	./hack/install.sh lint-tools
   307  
   308  # Run linter on the code
   309  .PHONY: lint
   310  lint: test-tools-image
   311  	$(call run-in-test-client,make lint-local)
   312  
   313  # Run linter on the code (local version)
   314  .PHONY: lint-local
   315  lint-local:
   316  	golangci-lint --version
   317  	# NOTE: If you get a "Killed" OOM message, try reducing the value of GOGC
   318  	# See https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
   319  	GOGC=$(ARGOCD_LINT_GOGC) GOMAXPROCS=2 golangci-lint run --fix --verbose --timeout 300s
   320  
   321  .PHONY: lint-ui
   322  lint-ui: test-tools-image
   323  	$(call run-in-test-client,make lint-ui-local)
   324  
   325  .PHONY: lint-ui-local
   326  lint-ui-local:
   327  	cd ui && yarn lint
   328  
   329  # Build all Go code
   330  .PHONY: build
   331  build: test-tools-image
   332  	mkdir -p $(GOCACHE)
   333  	$(call run-in-test-client, make build-local)
   334  
   335  # Build all Go code (local version)
   336  .PHONY: build-local
   337  build-local:
   338  	go build -v `go list ./... | grep -v 'resource_customizations\|test/e2e'`
   339  
   340  # Run all unit tests
   341  #
   342  # If TEST_MODULE is set (to fully qualified module name), only this specific
   343  # module will be tested.
   344  .PHONY: test
   345  test: test-tools-image
   346  	mkdir -p $(GOCACHE)
   347  	$(call run-in-test-client,make TEST_MODULE=$(TEST_MODULE) test-local)
   348  
   349  # Run all unit tests (local version)
   350  .PHONY: test-local
   351  test-local:
   352  	if test "$(TEST_MODULE)" = ""; then \
   353  		./hack/test.sh -coverprofile=coverage.out `go list ./... | grep -v 'test/e2e'`; \
   354  	else \
   355  		./hack/test.sh -coverprofile=coverage.out "$(TEST_MODULE)"; \
   356  	fi
   357  
   358  .PHONY: test-race
   359  test-race: test-tools-image
   360  	mkdir -p $(GOCACHE)
   361  	$(call run-in-test-client,make TEST_MODULE=$(TEST_MODULE) test-race-local)
   362  
   363  # Run all unit tests, with data race detection, skipping known failures (local version)
   364  .PHONY: test-race-local
   365  test-race-local:
   366  	if test "$(TEST_MODULE)" = ""; then \
   367  		./hack/test.sh -race -coverprofile=coverage.out `go list ./... | grep -v 'test/e2e'`; \
   368  	else \
   369  		./hack/test.sh -race -coverprofile=coverage.out "$(TEST_MODULE)"; \
   370  	fi
   371  
   372  # Run the E2E test suite. E2E test servers (see start-e2e target) must be
   373  # started before.
   374  .PHONY: test-e2e
   375  test-e2e:
   376  	$(call exec-in-test-server,make test-e2e-local)
   377  
   378  # Run the E2E test suite (local version)
   379  .PHONY: test-e2e-local
   380  test-e2e-local: cli-local
   381  	# NO_PROXY ensures all tests don't go out through a proxy if one is configured on the test system
   382  	export GO111MODULE=off
   383  	ARGOCD_GPG_ENABLED=true NO_PROXY=* ./hack/test.sh -timeout 20m -v ./test/e2e
   384  
   385  # Spawns a shell in the test server container for debugging purposes
   386  debug-test-server: test-tools-image
   387  	$(call run-in-test-server,/bin/bash)
   388  
   389  # Spawns a shell in the test client container for debugging purposes
   390  debug-test-client: test-tools-image
   391  	$(call run-in-test-client,/bin/bash)
   392  
   393  # Starts e2e server in a container
   394  .PHONY: start-e2e
   395  start-e2e: test-tools-image
   396  	docker version
   397  	mkdir -p ${GOCACHE}
   398  	$(call run-in-test-server,make ARGOCD_PROCFILE=test/container/Procfile start-e2e-local)
   399  
   400  # Starts e2e server locally (or within a container)
   401  .PHONY: start-e2e-local
   402  start-e2e-local:
   403  	kubectl create ns argocd-e2e || true
   404  	kubectl config set-context --current --namespace=argocd-e2e
   405  	kustomize build test/manifests/base | kubectl apply -f -
   406  	# Create GPG keys and source directories
   407  	if test -d /tmp/argo-e2e/app/config/gpg; then rm -rf /tmp/argo-e2e/app/config/gpg/*; fi
   408  	mkdir -p /tmp/argo-e2e/app/config/gpg/keys && chmod 0700 /tmp/argo-e2e/app/config/gpg/keys
   409  	mkdir -p /tmp/argo-e2e/app/config/gpg/source && chmod 0700 /tmp/argo-e2e/app/config/gpg/source
   410  	# set paths for locally managed ssh known hosts and tls certs data
   411  	ARGOCD_SSH_DATA_PATH=/tmp/argo-e2e/app/config/ssh \
   412  	ARGOCD_TLS_DATA_PATH=/tmp/argo-e2e/app/config/tls \
   413  	ARGOCD_GPG_DATA_PATH=/tmp/argo-e2e/app/config/gpg/source \
   414  	ARGOCD_GNUPGHOME=/tmp/argo-e2e/app/config/gpg/keys \
   415  	ARGOCD_GPG_ENABLED=true \
   416  	ARGOCD_E2E_DISABLE_AUTH=false \
   417  	ARGOCD_ZJWT_FEATURE_FLAG=always \
   418  	ARGOCD_IN_CI=$(ARGOCD_IN_CI) \
   419  	ARGOCD_E2E_TEST=true \
   420  		goreman -f $(ARGOCD_PROCFILE) start ${ARGOCD_START}
   421  
   422  # Cleans VSCode debug.test files from sub-dirs to prevent them from being included in packr boxes
   423  .PHONY: clean-debug
   424  clean-debug:
   425  	-find ${CURRENT_DIR} -name debug.test | xargs rm -f
   426  
   427  .PHONY: clean
   428  clean: clean-debug
   429  	-rm -rf ${CURRENT_DIR}/dist
   430  
   431  .PHONY: start
   432  start: test-tools-image
   433  	docker version
   434  	$(call run-in-test-server,make ARGOCD_PROCFILE=test/container/Procfile start-local ARGOCD_START=${ARGOCD_START})
   435  
   436  # Starts a local instance of ArgoCD
   437  .PHONY: start-local
   438  start-local: mod-vendor-local
   439  	# check we can connect to Docker to start Redis
   440  	killall goreman || true
   441  	kubectl create ns argocd || true
   442  	rm -rf /tmp/argocd-local
   443  	mkdir -p /tmp/argocd-local
   444  	mkdir -p /tmp/argocd-local/gpg/keys && chmod 0700 /tmp/argocd-local/gpg/keys
   445  	mkdir -p /tmp/argocd-local/gpg/source
   446  	ARGOCD_ZJWT_FEATURE_FLAG=always \
   447  	ARGOCD_IN_CI=false \
   448  	ARGOCD_GPG_ENABLED=true \
   449  	ARGOCD_E2E_TEST=false \
   450  		goreman -f $(ARGOCD_PROCFILE) start ${ARGOCD_START}
   451  
   452  # Runs pre-commit validation with the virtualized toolchain
   453  .PHONY: pre-commit
   454  pre-commit: codegen build lint test
   455  
   456  # Runs pre-commit validation with the local toolchain
   457  .PHONY: pre-commit-local
   458  pre-commit-local: codegen-local build-local lint-local test-local
   459  
   460  .PHONY: release-precheck
   461  release-precheck: manifests
   462  	@if [ "$(GIT_TREE_STATE)" != "clean" ]; then echo 'git tree state is $(GIT_TREE_STATE)' ; exit 1; fi
   463  	@if [ -z "$(GIT_TAG)" ]; then echo 'commit must be tagged to perform release' ; exit 1; fi
   464  	@if [ "$(GIT_TAG)" != "v`cat VERSION`" ]; then echo 'VERSION does not match git tag'; exit 1; fi
   465  
   466  .PHONY: release
   467  release: pre-commit release-precheck image release-cli
   468  
   469  .PHONY: build-docs
   470  build-docs:
   471  	mkdocs build
   472  
   473  .PHONY: serve-docs
   474  serve-docs:
   475  	mkdocs serve
   476  
   477  .PHONY: lint-docs
   478  lint-docs:
   479  	#  https://github.com/dkhamsing/awesome_bot
   480  	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 --
   481  
   482  .PHONY: publish-docs
   483  publish-docs: lint-docs
   484  	mkdocs gh-deploy
   485  
   486  # Verify that kubectl can connect to your K8s cluster from Docker
   487  .PHONY: verify-kube-connect
   488  verify-kube-connect: test-tools-image
   489  	$(call run-in-test-client,kubectl version)
   490  
   491  # Show the Go version of local and virtualized environments
   492  .PHONY: show-go-version
   493  show-go-version: test-tools-image
   494  	@echo -n "Local Go version: "
   495  	@go version
   496  	@echo -n "Docker Go version: "
   497  	$(call run-in-test-client,go version)
   498  
   499  # Installs all tools required to build and test ArgoCD locally
   500  .PHONY: install-tools-local
   501  install-tools-local: install-test-tools-local install-codegen-tools-local install-go-tools-local
   502  
   503  # Installs all tools required for running unit & end-to-end tests (Linux packages)
   504  .PHONY: install-test-tools-local
   505  install-test-tools-local:
   506  	sudo ./hack/install.sh packr-linux
   507  	sudo ./hack/install.sh kubectl-linux
   508  	sudo ./hack/install.sh kustomize-linux
   509  	sudo ./hack/install.sh ksonnet-linux
   510  	sudo ./hack/install.sh helm2-linux
   511  	sudo ./hack/install.sh helm-linux
   512  
   513  # Installs all tools required for running codegen (Linux packages)
   514  .PHONY: install-codegen-tools-local
   515  install-codegen-tools-local:
   516  	sudo ./hack/install.sh codegen-tools
   517  
   518  # Installs all tools required for running codegen (Go packages)
   519  .PHONY: install-go-tools-local
   520  install-go-tools-local:
   521  	./hack/install.sh codegen-go-tools
   522  
   523  .PHONY: dep-ui
   524  dep-ui: test-tools-image
   525  	$(call run-in-test-client,make dep-ui-local)
   526  
   527  dep-ui-local:
   528  	cd ui && yarn install