Skip to content
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

Repeatable builds #48

Merged
merged 12 commits into from Dec 18, 2020
Merged

Repeatable builds #48

merged 12 commits into from Dec 18, 2020

Conversation

thanodnl
Copy link
Member

@thanodnl thanodnl commented Dec 16, 2020

This PR rewrites our complete build system for creating and maintaining CI images.

It uses docker layers with better reuse compared to what we used to have. There are still some ways for better reuse. In the future we can move all dockerfiles into 1 with different target names and reuse of common layers like

  • python base
  • build base
  • tool base

For now it touched all by the stylechecker.

The Makefile included in circeleci\images contains the postgres versions to currently build for. All scripts install them from the apt archive maintained by pgdg. This should allow for stable builds over time, where we can rebuild older versions with more ease.

We have removed the need to create custom debian packages that needed to be uploaded to package cloud. Instead we use multi layer docker builds to compile the specific postgres version and copy over the isolation tester binaries and the vanilla tests for us to run in CI.

By default the Makefile will build images tagged with a -devYYYYmmddHHMM suffix for use when changing images. Once changes are approved and landed to master we can create the final images via RELEASE=1 make push-all.

TODO

  • write usage of Makefile in README.md

Copy link
Contributor

@SaitTalhaNisanci SaitTalhaNisanci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, this version is much better than the previous one, much much better actually.

Readme should be updated, but updating that will probably be easy because you will mostly remove many things there :)

Overall this makes sense, just left some minor things.

circleci/images/Makefile Outdated Show resolved Hide resolved
circleci/images/Makefile Outdated Show resolved Hide resolved
circleci/images/Makefile Show resolved Hide resolved
circleci/images/Makefile Outdated Show resolved Hide resolved
circleci/images/exttester/Dockerfile Outdated Show resolved Hide resolved
circleci/images/exttester/Dockerfile Outdated Show resolved Hide resolved
circleci/images/exttester/Dockerfile Outdated Show resolved Hide resolved
circleci/images/pgupgradetester/Dockerfile Outdated Show resolved Hide resolved
circleci/images/Makefile Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated

Because of the specific logic that we have to run tests faster, we have a docker image `debbuilder` that generates a debian package for `postgresql-server-dev-{pg-major}`. The generated package is in the built docker image, specifically in `{container-name}/home/circleci/debs`. The package is pushed to [the-process](https://packagecloud.io/citus-bot/the-process). This package place is added to apt source list and pinned with with the highest priority so that it is chosen over the standard `postgresql-server-dev-{pg-major}` package.
This image contains all the artifacts required to produce a build of citus binaries for exactly 1 postgres version. This image is build for every supported Postgres version. Any scripts driving the build are contained in the citus repostiroy.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build -> built

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which one of the 3? :P
built is past tense
build is current tense

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This image is built

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated
```bash
docker push {repositoryName}/{imageName}
```
TODO: this image has not changed and is currently not build by the Makefile. Future work.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

built

WORKDIR /build/postgresql-${PG_VERSION}/
COPY patches/ patches/
SHELL ["/bin/bash", "-c"]
RUN if [ -d "patches/${PG_VERSION}/" ]; \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea, it is just sad that one mistake in postgres side causes many others to resolve the problem multiple times.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only half of the year ;)

Copy link
Contributor

@SaitTalhaNisanci SaitTalhaNisanci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again thanks a lot for the restructure, this should save a LOT of time during upgrades

@thanodnl thanodnl merged commit c6b167e into master Dec 18, 2020
@thanodnl thanodnl deleted the repeatable-builds branch December 18, 2020 16:56
thanodnl added a commit to citusdata/citus that referenced this pull request Dec 18, 2020
This doesn't change anything functionally for Citus or our CI. Instead it is a quality of life change to make it easier to maintain CI and how we build.

In general this patch accomplishes the following
 - move build and test scripts into the Citus tree instead of our CI tree.
 - deduplicate convoluted jobs definition by a couple generic build and test runs
   - standardized the output
   - standardized coredumps
   - made all coredumps and regression diffs available for download

A big part of this refactor is in the `the-process` repository. citusdata/the-process#48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants