-
Notifications
You must be signed in to change notification settings - Fork 133
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
PMM-12899 Use module and build cache #2916
Draft
ademidoff
wants to merge
90
commits into
v3
Choose a base branch
from
PMM-12899-use-module-and-build-cache
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.
+1,141
−573
Draft
Changes from all commits
Commits
Show all changes
90 commits
Select commit
Hold shift + click to select a range
1ef83f3
PMM-12899 Use module and build cache
ademidoff 32c8fa8
PMM-12899 update grafana spec
ademidoff 37e005a
PMM-12899 fix the build_command
ademidoff c863f50
PMM-12899 fix builddeps
ademidoff 853be6e
PMM-12899 use rpmbuild:3
ademidoff d57ec55
PMM-12641 Fix the dashboard upgrade (#2926)
ademidoff 5c7821f
PMM-12899 prevent grafana from using own GOPATH
ademidoff 42a02a9
PMM-12899 use a dedicated folder for yarn cache
ademidoff 6d0b02b
PMM-12899 extract server rpm script
ademidoff 0a32c59
Merge branch 'v3' into PMM-12899-use-module-and-build-cache
ademidoff 098e894
PMM-12899 fix server param evaluation
ademidoff c80fe45
Merge branch 'PMM-12899-use-module-and-build-cache' of github.com:per…
ademidoff aa5729f
PMM-12899 clean up server RPM specs
ademidoff aa5e8b8
PMM-12899 fix directory permissions
ademidoff ee45fd6
PMM-12899 remove unnecessary macro
ademidoff afde65a
PMM-12899 revert QAN package name
ademidoff f28cbcc
PMM-12899 merge update.sh to build.sh
ademidoff 66dc390
Merge branch 'v3' into PMM-12899-use-module-and-build-cache
ademidoff 093179a
PMM-12899 reorganize the script structure
ademidoff 12fd453
PMM-12899 get rid of `exit 0` in callee scripts
ademidoff 9587f21
PMM-12899 clean up pmm-update.spec
ademidoff 13b4f65
PMM-12899 send exec time to the log file
ademidoff 6f9eac8
PMM-12899 remove a redundant directory
ademidoff 3eb50f8
PMM-12899 add total exec time
ademidoff 36869b7
PMM-12899 reorg some variables
ademidoff bf640ca
PMM-12899 fix the regexp
ademidoff f28202a
PMM-12899 structure the code
ademidoff a0f7b50
PMM-12899 add a flag to skip building server docker
ademidoff 988cfb0
PMM-12899 fix a failure of find when no files are found
ademidoff 8216d65
Merge branch 'v3' into PMM-12899-use-module-and-build-cache
ademidoff d2c4ecb
Merge branch 'v3' into PMM-12899-use-module-and-build-cache
ademidoff 0582998
PMM-12899 update the documentation
ademidoff 0e0bde7
Merge branch 'v3' into PMM-12899-use-module-and-build-cache
ademidoff ccf3bf0
Merge branch 'v3' into PMM-12899-use-module-and-build-cache
ademidoff ea42fe7
PMM-12899 update README.md
ademidoff 87cc6a2
Merge branch 'v3' into PMM-12899-use-module-and-build-cache
ademidoff fc248de
PMM-12899 fix duplicate labels in Dockerfile
ademidoff 4b469bd
PMM-12899 add a config file for all PMM components
ademidoff 6d590ce
Merge branch 'v3' into PMM-12899-use-module-and-build-cache
ademidoff f35a85f
PMM-12899 simplify init, add usage
ademidoff 1aad3f7
PMM-12899 fix architecture for the client
ademidoff 23aaaf6
PMM-12899 fix the build time for MacOS
ademidoff c2357c5
PMM-12899 fix git commit variable
ademidoff 7925079
PMM-12899 don't use S3 cache for local builds
ademidoff 1d8fe37
PMM-12899 dont chown with an id external to the container
ademidoff 48d481f
PMM-12899 refactor the log output
ademidoff dd2779a
Merge branch 'v3' into PMM-12899-use-module-and-build-cache
ademidoff e8e3f0f
PMM-12899 don't chown with builder id outside of container
ademidoff 01427fc
Merge branch 'PMM-12899-use-module-and-build-cache' of github.com:per…
ademidoff 344b783
PMM-12899 add aarch to grafana.spec
ademidoff 7aa9a30
PMM-12899 add aarch64 to grafana.spec
ademidoff f28ecde
PMM-12899 add the platform
ademidoff 87d75a7
PMM-12899 use docker volumes for caching
ademidoff 15d9344
PMM-12899 exit if the spec cannot be found
ademidoff 5a8f6e4
PMM-12899 fix yarn cache
ademidoff e326d94
PMM-12899 fix the platform
ademidoff 9010f42
PMM-12899 chown the cache dirs before starting
ademidoff 0ff180f
PMM-12899 remove GOARCH setting
ademidoff c9d8e35
PMM-12899 add --platform to --help
ademidoff 46c8934
PMM-12899 do not upload to S3 when building locally
ademidoff 10ea625
PMM-12899 fix a typo
ademidoff 891a2f0
PMM-12899 clean up scripts
ademidoff b193355
PMM-12899 revert changes to grafana.spec
ademidoff 53de284
PMM-12899 revert changes to grafana.spec
ademidoff a7ebc00
PMM-12899 update goreleaser to latest
ademidoff 6ea7125
PMM-12899 use a different Go version for grafana
ademidoff f3b7ece
PMM-12899 fix copying ansible files
ademidoff 3293ab5
PMM-12899 fix copying Dockerfile
ademidoff d501abc
PMM-12899 fix legacy Docker label format
ademidoff 15be815
PMM-12899 do not use the repo subpaths for mutations
ademidoff eeccd8a
PMM-12899 use a dedicated spec directory
ademidoff 8c8bf03
PMM-12899 fix the spec directory evaluation
ademidoff 4aa5012
PMM-12899 create rpms directories first
ademidoff eaaeaf2
PMM-12899 fix find syntax
ademidoff 2325c53
PMM-12899 fix find syntax to search for both files and dirs
ademidoff dc6cadd
PMM-12899 revert changes made to grafana.spec
ademidoff 2819fc9
PMM-12899 try not to use cache for grafana
ademidoff cd0df5c
PMM-12899 try not to use cache for grafana
ademidoff f5dc745
PMM-12899 fix the cache directory not being writable
ademidoff a28edba
PMM-12899 use no Go cache for grafana
ademidoff 44fc04b
PMM-12899 use no Go cache for grafana
ademidoff e1fbeca
PMM-12899 remove docker tarballs
ademidoff c94b549
PMM-12899 add --client-only parameter
ademidoff 687d3b6
Merge branch 'v3' into PMM-12899-use-module-and-build-cache
ademidoff 8944ef5
PMM-12899 rename build.sh to build
ademidoff 69899db
PMM-12899 purge more files before starting
ademidoff a8756ab
PMM-12899 pass NO_VCS parameter to go build
ademidoff be7405e
PMM-12899 add dist directory to .gitignore
ademidoff 93d5d7c
PMM-12899 create cache directories in rpmbuild
ademidoff 45fd300
PMM-12899 fix "build_command" extrapolation
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 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 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 |
---|---|---|
|
@@ -44,3 +44,6 @@ api-tests/pmm-api-tests-output.txt | |
api-tests/pmm-api-tests-junit-report.xml | ||
|
||
packer.log | ||
|
||
# Goreleaser | ||
dist/ |
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Local builds | ||
|
||
This directory contains a set of scripts aimed at providing a simple way to build PMM locally. | ||
|
||
## Background | ||
|
||
Historically, PMM used to be built using Jenkins. This worked well for the team, but not for the community. The learning curve was, and still is, rather steep, and it is hard for folks, even internally, to contribute to. | ||
|
||
Therefore, we decided to make it possible to build PMM locally. This is a work in progress, but we are definitely committed to bring the developer experience to an acceptable level. | ||
|
||
The build process is mostly based on bash scripts, which control the build flow. This was an intentional decision early on, since every developer should have at least a basic command of bash. Apart from bash and a few other well-known utilitites like `curl` or `make`, it also uses Docker for environment isolation and caching. | ||
|
||
The build process is designed to run on a Linux host. We believe it can run on other flavors of Linux, including MacOS, with little to no modification (TBC). | ||
|
||
|
||
## Prerequisites | ||
|
||
Below is a list of prerequisites that are required to build PMM locally. | ||
|
||
- OS: Linux (tested on Oracle Linux 9.3, CentOS 7, Ubuntu 22.04.3 LTS) | ||
- Docker: 25.0.2+ (tested on 25.0.2) | ||
- Docker Compose Plugin: 2.24.7+ (tested on 2.24.7) | ||
- make: 4.3+ (tested on 4.3) | ||
- bash (GNU): 5.1+ (tested on 5.1) | ||
- git: 2.34.1+ (tested on 2.34.1) | ||
- curl: 7.81.0+ (tested on 7.81.0) | ||
- yq: 4.42.0+ (tested on 4.42.1) | ||
- jq: 1.6+ (tested on 1.6) | ||
|
||
|
||
## How to build PMM | ||
|
||
1. Install the prerequisites | ||
2. Clone the PMM repository to the user's home directory, e.g.: `git clone https://github.com/percona/pmm /home/user/pmm`. | ||
3. Change to the `build/local` directory in the cloned repo. | ||
4. Run `./build --help` to print the help message and check the usage. | ||
5. Run `./build` with parameters of your choice to build PMM v3. | ||
|
||
Usually, you will want to rebuild PMM whenever there are changes in at least one of its components. All components of PMM are gathered together in one repository - `github.com/percona-lab/pmm-submodules` (or `pmm-submodules`). Therefore, you can run `build` as often as those changes need to be factored in to the next build. | ||
|
||
Once the build is finished, you can proceed with launching a new instance of PMM Server, or installing a freshly built PMM Client, and testing the changes. | ||
|
||
|
||
## The `rpmbuild` image and docker cache | ||
|
||
We use a special docker image to build various PMM artifacts - `perconalab/rpmbuild:3`. It comes provisioned with tools which are required to build PMM artifacts, for example RPM packages. As a build tool, it offers a number of benefits, two most obvious of which are: | ||
|
||
- it frees the user from installing dependencies on their host machine | ||
- it leverages a very powerful docker caching system, which results in reduced build times | ||
|
||
During the first run, `build` will create a few directories on the host machine, which are necessary to make use of docker cache. Please be aware, that the docker container's user needs to be able to write to these directories. The docker container's user is `builder` with uid 1000 and gid 1000. You need to make sure that the directories we create on the host are owned by a user with the same uid and gid. If the build fails, this is the first thing to check. | ||
|
||
|
||
## Avoiding unnecessary builds | ||
|
||
Sometimes, the changes you make affect only PMM Client. Other times, they affect only PMM Server. Therefore, you may want to skip building parts of PMM. The `build` script offers several parameters to help control what you want to build. | ||
|
||
* --no-update: run the build tasks without pulling the changes from `pmm-submodules` repository | ||
* --update-only: pull changes from the repo without building PMM | ||
* --no-client: do not build the client, use the cached PMM Client artifacts | ||
* --no-client-docker: skip building PMM Client docker container | ||
* --no-server-rpm: skip building PMM Server RPM artifacts | ||
* --log-file <path>: change the path of the build log file | ||
|
||
It's important to note, however, that once all changes are made and tested, you most probably want to re-build both PMM Client and Server to test them together. | ||
|
||
|
||
## Target environments | ||
|
||
Currently, local builds target the following environments: | ||
- PMM Client | ||
- tarball - virtually any amd64 Linux environment | ||
- RPM - RHEL9-compatible environments | ||
- docker image - docker and Kubernetes environments (amd64) | ||
- PMM Server | ||
- docker image - docker and Kubernetes environments (amd64) | ||
|
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.
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.
Sorry, I couldn't resist - seems to be much more to the point here :)