You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/Makefile

127 lines
3.8 KiB

# See: https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63
# For a list of valid GOOS and GOARCH values
# Note: these can be overriden on the command line e.g. `make PLATFORM=<platform> ARCH=<arch>`
PLATFORM=$(shell go env GOOS)
ARCH=$(shell go env GOARCH)
# build target, can be one of "production", "testing", "development"
ENV=development
WEBPACK_CONFIG=webpack/webpack.$(ENV).js
TAG=latest
SWAG=go run github.com/swaggo/swag/cmd/swag@v1.8.11
GOTESTSUM=go run gotest.tools/gotestsum@latest
# Don't change anything below this line unless you know what you're doing
.DEFAULT_GOAL := help
##@ Building
.PHONY: init-dist build-storybook build build-client build-server build-image devops
init-dist:
@mkdir -p dist
build-all: deps build-server build-client ## Build the client, server and download external dependancies (doesn't build an image)
build-client: init-dist ## Build the client
export NODE_ENV=$(ENV) && yarn build --config $(WEBPACK_CONFIG)
build-server: init-dist ## Build the server binary
./build/build_binary.sh "$(PLATFORM)" "$(ARCH)"
build-image: build-all ## Build the Portainer image locally
docker buildx build --load -t portainerci/portainer:$(TAG) -f build/linux/Dockerfile .
build-storybook: ## Build and serve the storybook files
yarn storybook:build
devops: clean deps build-client ## Build the everything target specifically for CI
echo "Building the devops binary..."
@./build/build_binary_azuredevops.sh "$(PLATFORM)" "$(ARCH)"
##@ Build dependencies
.PHONY: deps server-deps client-deps tidy
deps: server-deps client-deps ## Download all client and server build dependancies
server-deps: init-dist ## Download dependant server binaries
@./build/download_binaries.sh $(PLATFORM) $(ARCH)
client-deps: ## Install client dependencies
yarn
tidy: ## Tidy up the go.mod file
cd api && go mod tidy
##@ Cleanup
.PHONY: clean
clean: ## Remove all build and download artifacts
@echo "Clearing the dist directory..."
@rm -rf dist/*
##@ Testing
.PHONY: test test-client test-server
test: test-server test-client ## Run all tests
test-client: ## Run client tests
yarn test
test-server: ## Run server tests
cd api && $(GOTESTSUM) --format pkgname-and-test-fails --format-hide-empty-pkg --hide-summary skipped -- -cover ./...
##@ Dev
.PHONY: dev dev-client dev-server
dev: ## Run both the client and server in development mode
make dev-server
make dev-client
dev-client: ## Run the client in development mode
yarn dev
dev-server: build-server ## Run the server in development mode
@./dev/run_container.sh
##@ Format
.PHONY: format format-client format-server
format: format-client format-server ## Format all code
format-client: ## Format client code
yarn format
format-server: ## Format server code
cd api && go fmt ./...
##@ Lint
.PHONY: lint lint-client lint-server
lint: lint-client lint-server ## Lint all code
lint-client: ## Lint client code
yarn lint
lint-server: ## Lint server code
golangci-lint run --timeout=10m -c .golangci.yaml
##@ Extension
.PHONY: dev-extension
dev-extension: build-server build-client ## Run the extension in development mode
make local -f build/docker-extension/Makefile
##@ Docs
.PHONY: docs-build docs-validate docs-clean docs-validate-clean
docs-build: init-dist ## Build docs
Revert multiple commits to set it back to tag 2.19 (#10946) * Revert "docs(dashboard): update link for swarm node [EE-6318] (#10770)" This reverts commit 30356d2c15470ffc9d71732e48d1fd57b82c5540. * Revert "docs(api): default to pascal case for property name [EE-6471] (#10861)" This reverts commit 392819576c95ce9d945ceab396aada1850cf4407. * Revert "fix(edge/jobs): clear logs [EE-5923] (#10819)" This reverts commit e01386f63d486e7b6940a2c480ce7a7e401a655d. * Revert "disable html5 validation (#10843)" This reverts commit 4b0f08e92a21cb0c3a2c72804c9cd5b29b76d17f. * Revert "fix(edgestack): allow to set retry deployment toggle EE-6167 (#10676) (#10805)" This reverts commit eee632b22d0793ef9c758ea1d0e4426a2a998912. * Revert "fix(stack): edit git stack validation (#10812)" This reverts commit d3b150b29c3ac507d7adabaa841f2164732d23be. * Revert "Revert "Revert "fix(rollback): reversed rollback code from 2.19.4 [EE-6435] (#10811)" (#10832)" This reverts commit 32e05bb705f1c10c9487f546736963641797a44b. * Revert "fix(setting/ssl): cert files are optional to upload [EE-6139] (#10779)" This reverts commit 7408668dbb7a468b65d2514dd668ea3bf600d7a9. * Revert "fix(endpoint): delete the endpoint proxy when updating an endpoint address [EE-5577] (#10824)" This reverts commit 4b5ea01456d8051c140c4edcb07931c306dabbee. * Revert "fix(swagger): custom template create docs EE-6428 (#10806)" This reverts commit 0d55cb3e08d273035b9176ec381ed81f3b12fe4b. * Revert "fix(images): sort by tags [EE-6410] (#10755)" This reverts commit 7f51c727a09944af0c9f7c46da3438fb61adf3c9. * Revert "fix(stacks): sort by date [EE-5766] (#10758)" This reverts commit 57b80cd9ac92a282c0768f12300f2925684c6089. * Revert "fix(UI): remember backup settings tab [EE-6347] (#10764)" This reverts commit c20452492dadd3217ba0e29273d5c4044d5d93ca. * Revert "fix(backup ui): minor typo on backup page EE-6348 (#10717)" This reverts commit d58046eb68dbdf4e132d5d50763d51e80cab024d. * Revert "fix(app): shift external to the top [EE-6392] (#10753) (#10802)" This reverts commit 4795e85d18dda62cac31f05fdde02ce4cbf92490. * Revert "fix(app): update sliders when limits are known [EE-5933] (#10769) (#10801)" This reverts commit d090b0043a98d80f8014411a3a7fe2f3edabf71d. * Revert "fix(gitops): correct commit hash link [EE-6346] (#10800)" This reverts commit 0e59cf76ecb4547c6c416bcae5933fdab0ea1b2a. * Revert "fix toast error (#10804)" This reverts commit 9978b88ed4144a468e2c32f1a0d4d0c44631ef29. * Revert "fix(kube): configmaps and secrets from envFrom in the app detail screen [EE-6282] (#10741) (#10798)" This reverts commit c1a01558d0668afade59590963ec970bb121eef6. * Revert "fix(stacks): allow editing custom templates before stack deployment EE-6380 (#10713)" This reverts commit f0aa0554f8c5e6752e6545369997d860a4cd5eae. * Reapply "fix(rollback): reversed rollback code from 2.19.4 [EE-6435] (#10811) This reverts commit c58fa274e7e8128b6f3fba6e4b4a696acefc2f75.
10 months ago
cd api && $(SWAG) init -o "../dist/docs" -ot "yaml" -g ./http/handler/handler.go --parseDependency --parseInternal --parseDepth 2 --markdownFiles ./
docs-validate: docs-build ## Validate docs
yarn swagger2openapi --warnOnly dist/docs/swagger.yaml -o dist/docs/openapi.yaml
yarn swagger-cli validate dist/docs/openapi.yaml
##@ Helpers
.PHONY: help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)