Repository navigation
fix(docker): stop clobbering the base image's /usr/lib, and build images on main #3157
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
Changes from all commits
015cd52
3dc71d8
85e50b2
47e95ac
8af1390
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| '@hyperdx/app': patch | ||
| --- | ||
|
|
||
| fix: stop the all-in-one image copying node's /usr/lib over the base image | ||
|
|
||
| The all-in-one and local images copied the whole `/usr/lib` out of `node:22.22-alpine`, overwriting the ClickHouse base image's `libapk.so`, `libssl`, `libcrypto` and `libz`. Once the two images landed on different Alpine point releases (3.24.1 vs 3.24.2), the older `libapk.so` no longer satisfied the newer `/sbin/apk`, and every image build failed with `Error relocating /sbin/apk: apk_fs_is_malicious_filename: symbol not found`. | ||
|
|
||
| Node only needed `libstdc++`/`libgcc` from that copy, so those are now installed with apk from the image's own Alpine release and the blanket copy is gone. This also stops ClickHouse's OpenSSL being silently swapped for node's. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,45 @@ | ||
| name: Docker Build | ||
| # Verifies the release Docker images actually build on PRs, without pushing. | ||
| # Verifies the release Docker images actually build, without pushing. | ||
| # A source-level type check (`make ci-lint`) cannot catch build failures that | ||
| # only surface inside the image — e.g. a declaration file that exists in the | ||
| # repo but was never COPYed into the Docker build stage. Each image is built | ||
| # only when files that affect it change, so unrelated PRs stay fast. | ||
| # repo but was never COPYed into the Docker build stage. | ||
| # | ||
| # On pull requests each image is built only when files that affect it change, | ||
| # so unrelated PRs stay fast. | ||
| # | ||
| # On pushes to main every image is built regardless of what changed. The path | ||
| # filter is the wrong instrument there, because these builds can break with no | ||
| # repo change at all: the Dockerfile pins floating upstream tags | ||
| # (`node:${NODE_VERSION}-alpine`, `clickhouse-server:${CLICKHOUSE_VERSION}-alpine`) | ||
| # and the registry re-points them whenever upstream publishes a patch. That is | ||
| # exactly how the 26.8-alpine break reached a release: the tag moved from | ||
| # ClickHouse 26.8.6 to 26.8.7 mid-afternoon, upgrading apk-tools 3.0.6 -> 3.0.8 | ||
| # underneath us. The PR check and the nightly had both already passed against | ||
| # the older digest, two commits then merged to main with no image build between | ||
| # them, and the failure only appeared in the release run hours later. Building | ||
| # unconditionally on main turns that into a red build on the next merge. | ||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| push: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will there be a large increase in gh actions usage from this? assuming thats fine
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think its fine. Let me pull out a bit more analysis before merging it. |
||
| branches: [main] | ||
| workflow_dispatch: | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| # Keyed on the event as well as the ref to separate a manual run on main from | ||
| # a merge: both carry `refs/heads/main`, so they would otherwise contend for | ||
| # one group. (A pull request run never collides with either — its ref is | ||
| # `refs/pull/<n>/merge`.) | ||
| # | ||
| # Pushes to main do not cancel in progress, so a merge cannot kill the build | ||
| # verifying the commit before it. This guarantees the tip of main gets built, | ||
| # not that every individual commit does: GitHub holds only one pending run per | ||
| # group, so a third merge arriving during a long build supersedes the queued | ||
| # one. That is fine for what this job is for — an upstream base-image move | ||
| # affects every commit equally, and a Dockerfile break in a superseded commit | ||
| # is still present at the tip. Per-commit attribution comes from the pull | ||
| # request run, not from here. | ||
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 minor — GitHub keeps at most one pending run per concurrency group: when a third push arrives while one run is in progress and one is queued, the queued run is cancelled, not deferred. So with three merges inside one ~40-minute all-in-one build, the middle commit is still never verified — the outcome the comment above says this change prevents. Either add Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, and fixed in 85e50b2 — the comment overclaimed. GitHub holds one pending run per group, so a third merge during a long build supersedes the queued one rather than joining a queue. The comment now says that plainly and says why it is acceptable rather than pretending otherwise: an upstream base move affects every commit equally, and a Dockerfile break in a superseded commit is still present at the tip, so building the tip is what this job needs. Per-commit attribution comes from the pull request run. Took the reword over adding |
||
| permissions: | ||
| contents: read | ||
| jobs: | ||
|
|
@@ -24,20 +53,21 @@ jobs: | |
| uses: actions/checkout@v6 | ||
| - name: Get changed files | ||
| id: changed-files | ||
| if: github.event_name == 'pull_request' | ||
| uses: tj-actions/changed-files@v47.0.6 | ||
| with: | ||
| files: | | ||
| docker/otel-collector/** | ||
| packages/otel-collector/** | ||
| - name: Setup Docker Buildx | ||
| if: | ||
| steps.changed-files.outputs.any_changed == 'true' || github.event_name | ||
| == 'workflow_dispatch' | ||
| github.event_name != 'pull_request' || | ||
| steps.changed-files.outputs.any_changed == 'true' | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Build (no push) | ||
| if: | ||
| steps.changed-files.outputs.any_changed == 'true' || github.event_name | ||
| == 'workflow_dispatch' | ||
| github.event_name != 'pull_request' || | ||
| steps.changed-files.outputs.any_changed == 'true' | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
|
|
@@ -62,6 +92,7 @@ jobs: | |
| uses: actions/checkout@v6 | ||
| - name: Get changed files | ||
| id: changed-files | ||
| if: github.event_name == 'pull_request' | ||
| uses: tj-actions/changed-files@v47.0.6 | ||
| with: | ||
| files: | | ||
|
|
@@ -79,13 +110,13 @@ jobs: | |
| nx.json | ||
| - name: Setup Docker Buildx | ||
| if: | ||
| steps.changed-files.outputs.any_changed == 'true' || github.event_name | ||
| == 'workflow_dispatch' | ||
| github.event_name != 'pull_request' || | ||
| steps.changed-files.outputs.any_changed == 'true' | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Build (no push) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 minor — On push to main the App Image job is fully subsumed by the All-in-One job, duplicating the ~8-minute Node build on every merge
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct that it is subsumed, but leaving it — the duplication buys a faster signal. App Image finishes in roughly 8 minutes; All-in-One takes 15-40. For the failure mode this PR is about, a moved It is runner-minutes against time-to-detect, and for a drift gate I would rather know sooner. Happy to gate it to |
||
| if: | ||
| steps.changed-files.outputs.any_changed == 'true' || github.event_name | ||
| == 'workflow_dispatch' | ||
| github.event_name != 'pull_request' || | ||
| steps.changed-files.outputs.any_changed == 'true' | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
|
|
@@ -115,10 +146,11 @@ jobs: | |
| # | ||
| # This target's base does `COPY --from=prod /app /app`, so it already | ||
| # rebuilds the entire App/prod image. To avoid duplicating that ~8-minute | ||
| # Node build on every app change, this job is gated ONLY on the incremental | ||
| # bundling inputs (ClickHouse / OTel / the shared Dockerfile) — NOT on | ||
| # api/app/common-utils/deps. Those are covered by the App Image job above, | ||
| # and they can't break the bundling layers, which only COPY the prod output. | ||
| # Node build on every app change, the pull-request path filter below is | ||
| # scoped ONLY to the incremental bundling inputs (ClickHouse / OTel / the | ||
| # shared Dockerfile) — NOT api/app/common-utils/deps. Those are covered by | ||
| # the App Image job above, and they can't break the bundling layers, which | ||
| # only COPY the prod output. Pushes to main ignore the filter entirely. | ||
| all-in-one-image: | ||
| name: Build All-in-One Image | ||
| runs-on: ubuntu-24.04 | ||
|
|
@@ -128,6 +160,7 @@ jobs: | |
| uses: actions/checkout@v6 | ||
| - name: Get changed files | ||
| id: changed-files | ||
| if: github.event_name == 'pull_request' | ||
| uses: tj-actions/changed-files@v47.0.6 | ||
| with: | ||
| files: | | ||
|
|
@@ -138,13 +171,13 @@ jobs: | |
| .vex/** | ||
| - name: Setup Docker Buildx | ||
| if: | ||
| steps.changed-files.outputs.any_changed == 'true' || github.event_name | ||
| == 'workflow_dispatch' | ||
| github.event_name != 'pull_request' || | ||
| steps.changed-files.outputs.any_changed == 'true' | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Build all-in-one-auth (no push) | ||
| if: | ||
| steps.changed-files.outputs.any_changed == 'true' || github.event_name | ||
| == 'workflow_dispatch' | ||
| github.event_name != 'pull_request' || | ||
| steps.changed-files.outputs.any_changed == 'true' | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
|
|
@@ -169,8 +202,8 @@ jobs: | |
| # the final noauth COPY layer. | ||
| - name: Build all-in-one-noauth / Local (no push) | ||
| if: | ||
| steps.changed-files.outputs.any_changed == 'true' || github.event_name | ||
| == 'workflow_dispatch' | ||
| github.event_name != 'pull_request' || | ||
| steps.changed-files.outputs.any_changed == 'true' | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
|
|
@@ -195,7 +228,7 @@ jobs: | |
| # ClickHouse. Proves the artefact we ship actually runs, not just builds. | ||
| - name: Smoke test the built image | ||
| if: | ||
| steps.changed-files.outputs.any_changed == 'true' || github.event_name | ||
| == 'workflow_dispatch' | ||
| github.event_name != 'pull_request' || | ||
| steps.changed-files.outputs.any_changed == 'true' | ||
| timeout-minutes: 10 | ||
| run: scripts/ci/smoke-all-in-one.sh hyperdx-aio-smoke:pr | ||
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.
🔵 minor — The new push-to-main drift gate has no failure notification, unlike the nightly it is meant to backstop
release-nightly.yml:340-402posts toSLACK_WEBHOOK_URL_ENG_NOTIFSon failure precisely because an unwatched drift detector is no detector. Replay the incident in the header comment with this change in place: upstream re-tags at 15:01, the 16:17 merge turns Docker Build red on main, and the only signal is a red X in main's commit list plus a default Actions email to whoever clicked merge on an unrelated PR — the 19:31 release still fails. Add aslack-notify-failurejob modelled on the nightly's, gated onif: failure() && github.event_name == 'push'.Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
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.
Best point in the review, and I am deliberately not acting on it — it is a team call about alerting, not a defect.
The gap is real: a red main is only a signal if someone looks, and the repo already concedes that by wiring Slack into the nightly.
What gives me pause is that the nightly and this are not the same situation. A 00:35 cron has no owner, which is exactly why it needs a webhook. A push-to-main failure has an obvious one — the person who just merged, who gets GitHub's default failure mail and is watching main anyway. And
if: failure() && github.event_name == 'push'fires on any Docker Build failure on main, not just drift, so most of what it sends would be telling someone something they already know. Whether that trade is worth it depends on how the team currently treats a red main and how noisySLACK_WEBHOOK_URL_ENG_NOTIFSalready is, which I should not be guessing at from inside a build-break fix.Flagging it for a maintainer rather than deciding it here. If the answer is yes, it is a small follow-up.