-
Notifications
You must be signed in to change notification settings - Fork 200
PMM-14887 Restructure Makefiles #5212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ademidoff
wants to merge
11
commits into
v3
Choose a base branch
from
PMM-14887-restructure-project-makefiles
base: v3
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7b9bffd
PMM-14887 Restructure Makefiles
ademidoff b0b93ed
PMM-14887 Move the dev Docker compose back to the root
ademidoff 0c48eb4
PMM-14887 Merge dev/Makefile into the root, fix targets
ademidoff 6612647
PMM-14887 Revert envars in api-test workflow
ademidoff b559b15
PMM-14887 Fix a wrong link
ademidoff 6edbf0c
PMM-14887 Remove deprecated env variables
ademidoff b73ee56
PMM-14887 Update the root Docker compose, modernize sysbench workflow
ademidoff e6f0a28
PMM-14887 Deprecate spell-check workflow
ademidoff 9804d42
PMM-14887 Drop the deprecated Platform key
ademidoff 4e45a77
PMM-14887 Provide a suite of compose files
ademidoff acce7ca
PMM-14887 Fix the path to agents.md
ademidoff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,17 @@ | ||
| # Percona PMM dev container | ||
| #PMM_CONTAINER=perconalab/pmm-server:3-dev-container | ||
| # This is a sample .env file for PMM Server. You can copy this file to .env and modify the values as needed. | ||
|
|
||
| CH_IMAGE=clickhouse/clickhouse-server:22.6.9.11-alpine | ||
| CH_PORT=9000 | ||
| CH_HOSTNAME=ch | ||
| # The latest PMM Server image is alsways published as percona/pmm-server:3. | ||
| # A specific version can be used by changing the tag, e.g., percona/pmm-server:3.7.0. | ||
| PMM_SERVER_IMAGE=percona/pmm-server:3 | ||
| # Shared docker network for PMM Server and its components. | ||
| PMM_NETWORK=pmm-network | ||
| # Label-based access control for PMM Server. Set to 1 to enable. | ||
| PMM_ENABLE_ACCESS_CONTROL=1 | ||
| # Good for development, but not recommended for production environments. | ||
| PMM_ENABLE_INTERNAL_PG_QAN=1 | ||
| # Controls the log verbosity of PMM Server. Set to 1 to enable debug logging, which can be helpful for troubleshooting. | ||
| PMM_DEBUG=0 | ||
| # Port mapping for PMM Server. The default is 443, but you can change it if needed. | ||
| PMM_PORT_HTTPS=443 | ||
| # Change the admin password for PMM Server. The default is "admin", but you should set a strong password for production environments. | ||
| PMM_ADMIN_PASSWORD=admin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,48 +1,125 @@ | ||
| # Host Makefile. | ||
| # Development Makefile | ||
| .PHONY: default help init release gen test clean all | ||
| .DEFAULT_GOAL := help | ||
|
|
||
| include Makefile.include | ||
| -include documentation/Makefile | ||
| -include .devcontainer/Makefile | ||
|
|
||
| ifeq ($(PROFILES),) | ||
| PROFILES := 'pmm' | ||
| endif | ||
| default: help | ||
|
|
||
| env-up: ## Start devcontainer | ||
| help: ## Display this help message | ||
| @echo "Please use \`make <target>\`, where <target> is one of the following:" | ||
| @grep -h '^[a-zA-Z]' $(MAKEFILE_LIST) | awk -F ':.*## ' 'NF==2 {printf " %-26s%s\n", $$1, $$2}' | sort | ||
| @echo | ||
| @echo For developers: check docker-compose.dev.yml to see which environment variables are available. | ||
|
|
||
| init: ## Install tools | ||
| rm -rf bin/* | ||
| cd tools && go generate -x -tags=tools | ||
|
|
||
| # Install golangci-lint | ||
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin v2.6.2 # Version should match specified in CI | ||
|
|
||
|
|
||
| PROFILES ?= pmm | ||
| COMPOSE_FILE ?= docker-compose.dev.yml | ||
|
|
||
| env-up: ## Start devcontainer | ||
| COMPOSE_PROFILES=$(PROFILES) \ | ||
| docker compose up -d --wait --wait-timeout 100 | ||
| docker compose -f $(COMPOSE_FILE) up -d --wait --wait-timeout 100 | ||
|
|
||
| env-up-rebuild: env-update-image ## Rebuild and start devcontainer. Useful for custom $PMM_SERVER_IMAGE | ||
| COMPOSE_PROFILES=$(PROFILES) \ | ||
| docker compose up --build -d | ||
| docker compose -f $(COMPOSE_FILE) up --build -d | ||
|
|
||
| env-update-image: ## Pull latest dev image | ||
| env-update-image: ## Pull latest dev image | ||
| COMPOSE_PROFILES=$(PROFILES) \ | ||
| docker compose pull | ||
| docker compose -f $(COMPOSE_FILE) pull | ||
|
|
||
| env-compose-up: env-update-image | ||
| env-compose-up: env-update-image ## Pull the image, then start devcontainer waiting for it to be ready | ||
| COMPOSE_PROFILES=$(PROFILES) \ | ||
| docker compose up --detach --renew-anon-volumes --remove-orphans --wait --wait-timeout 100 | ||
| docker compose -f $(COMPOSE_FILE) up -d --renew-anon-volumes --remove-orphans --wait --wait-timeout 100 | ||
|
|
||
| env-devcontainer: | ||
| env-devcontainer: ## Provision devcontainer (run this after `make env-up` or `make env-compose-up`) | ||
| docker exec -it --workdir=/root/go/src/github.com/percona/pmm --user root pmm-server python .devcontainer/setup.py | ||
|
|
||
| env-down: ## Stop devcontainer | ||
| env-down: ## Stop devcontainer | ||
| COMPOSE_PROFILES=$(PROFILES) \ | ||
| docker compose down --remove-orphans | ||
| docker compose -f $(COMPOSE_FILE) down --remove-orphans | ||
|
|
||
| env-remove: | ||
| env-remove: ## Stop devcontainer and remove volumes | ||
| COMPOSE_PROFILES=$(PROFILES) \ | ||
| docker compose down --volumes --remove-orphans | ||
| docker compose -f $(COMPOSE_FILE) down --volumes --remove-orphans | ||
|
|
||
| TARGET ?= _bash | ||
|
|
||
| env: ## Run `make TARGET` in devcontainer (`make env TARGET=help`); TARGET defaults to bash | ||
| COMPOSE_PROFILES=$(PROFILES) \ | ||
| env: ## Run `make TARGET` in devcontainer (`make env TARGET=help`); TARGET defaults to bash | ||
| docker exec -it --workdir=/root/go/src/github.com/percona/pmm pmm-server make $(TARGET) | ||
|
|
||
| env-root: ## Run `make TARGET` in devcontainer (`make env-root TARGET=help`); TARGET defaults to bash | ||
| COMPOSE_PROFILES=$(PROFILES) \ | ||
| env-root: ## Run `make TARGET` in devcontainer (`make env-root TARGET=help`); TARGET defaults to bash | ||
| docker exec -it --workdir=/root/go/src/github.com/percona/pmm --user root pmm-server make $(TARGET) | ||
|
|
||
| rotate-encryption: ## Rotate encryption key | ||
| rotate-encryption: ## Rotate encryption key | ||
| go run ./encryption-rotation/main.go | ||
|
|
||
| release: ## Build release versions of all components | ||
| make -C agent release | ||
| make -C admin release | ||
| make -C managed release | ||
| make -C qan-api2 release | ||
|
|
||
| gen: clean ## Generate files | ||
| make -C api gen | ||
| make -C api clean-swagger | ||
|
|
||
| make -C agent gen | ||
| make -C admin gen | ||
| make -C managed gen | ||
|
|
||
| make gen-mocks ## Generate mocks | ||
|
|
||
| make format | ||
| make format ## TODO: One formatting run is not enough, figure out why. | ||
| go install -v ./... | ||
|
|
||
| clean: ## Remove generated files | ||
| make -C api clean | ||
|
|
||
| gen-mocks: ## Generate mocks for API | ||
| find . -name mock_*.go -delete | ||
| ./bin/mockery --config .mockery.yaml | ||
|
|
||
| test-common: ## Run tests from API (and other shared) packages only (i.e it ignores directories that are explicitly listed) | ||
| go test $(shell go list ./... | grep -v -e admin -e agent -e managed -e api-tests -e qan-api2 -e update) | ||
|
|
||
| api-test: ## Run API tests on dev env. | ||
| go test -count=1 -race -p 1 -v ./api-tests/... -pmm.server-insecure-tls | ||
|
|
||
| GOLANG_CI_LINT_RUN_OPTS ?= | ||
| check: ## Run required checks and linters | ||
| bin/buf lint -v api | ||
| LOG_LEVEL=error bin/golangci-lint run -c=.golangci.yml --new-from-rev=$(shell git merge-base v3 HEAD) --new $(GOLANG_CI_LINT_RUN_OPTS) | ||
| bin/go-sumtype ./... | ||
|
|
||
| check-license: ## Run license header checks against source files | ||
| bin/license-eye -c .licenserc.yaml header check | ||
|
|
||
| check-all: check-license check ## Run linter and license checks | ||
|
|
||
| check-new: ## Run linters only against new code since v3 branch point | ||
| bin/golangci-lint run -c=.golangci.yml --new-from-rev=origin/v3 --new | ||
|
|
||
| FILES = $(shell find . -type f -name '*.go') | ||
|
|
||
| format: ## Format source code | ||
| make -C api format | ||
| bin/gofumpt -l -w $(FILES) | ||
| bin/goimports -local github.com/percona/pmm -l -w $(FILES) | ||
| bin/gci write --section Standard --section Default --section "Prefix(github.com/percona/pmm)" $(FILES) | ||
|
|
||
| serve: ## Serve API documentation with nginx | ||
| nginx -p . -c api/nginx/nginx.conf | ||
|
|
||
| GOLANG_CI_LINT_RUN_OPTS=--fix | ||
| prepare-pr: gen check-all ## Run all checks and generate files | ||
| go mod tidy |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Practically no value from this, better use AI, e.g. Copilot reviews.