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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(makefile): use BuildKit plain output when CI env var is defined #8

Merged
merged 1 commit into from Oct 2, 2022

Conversation

ppiotr3k
Copy link
Contributor

@ppiotr3k ppiotr3k commented Oct 2, 2022

Force BuildKit to output in a text log friendly format when running in CI.

Note: due to #3, changes introduced in this PR won't be taken into account until they reach dev or main branches. 馃し

馃挭 My Motivation:

BuildKit should automatically adapt progress output format based on environment.
Unfortunately something doesn't play well with CircleCI and the produced output - while great for TTY - is terrible for text logs, leading to thousands of garbage lines in CircleCI's job logs. We want CI job logs to be usable, not filled with garbage.

馃 My Solution:

Based on Docker CLI doc and CircleCI built-in env variables doc, use BUILDKIT_PROGRESS=plain env variable when CI variable is set in the environment to force BuildKit output in a text log friendly format.
CI seems to be an env variable commonly set by other CI providers (ex: GitLab, GitHub, Travis) for portability.

BuildKit _should_ automatically adapt progress output format based on
environment. Unfortunately something doesn't play well with CircleCI
and the produced output - while great for TTY - is terrible for text
logs, leading to thousands of garbage lines in CircleCI's job logs.

Based on [1] and [2], use `BUILDKIT_PROGRESS=plain` env variable when
`CI` variable is set in the environment to force BuildKit output in a
text log friendly format. `CI` seems to be an env variable commonly
set by other CI providers (ex: GitLab, GitHub, Travis) for portability.

[1]: https://github.com/docker/cli/blob/f3ed630f8feaaa02bc129150a7c7e1ca6a782a95/docs/reference/commandline/cli.md#environment-variables
[2]: https://circleci.com/docs/built-in-environment-variables

Signed-off-by: Piotr PAWLICKI <piotrek@seovya.net>
@ppiotr3k ppiotr3k added A-ci-circleci Area: CircleCI setup C-enhacement Category: this is PR with an enhancement or bugfix labels Oct 2, 2022
@ppiotr3k ppiotr3k self-assigned this Oct 2, 2022
@ppiotr3k ppiotr3k merged commit 1808854 into dev Oct 2, 2022
@ppiotr3k ppiotr3k deleted the ci-circleci-buildkit-progress branch October 2, 2022 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ci-circleci Area: CircleCI setup C-enhacement Category: this is PR with an enhancement or bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant