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

Reapply "[image-builder-bob] bump up buildkit (#20690)" (#20693) #20694

Merged
merged 2 commits into from
Apr 1, 2025

Conversation

iQQBot
Copy link
Contributor

@iQQBot iQQBot commented Mar 21, 2025

This reverts commit 7137833.

Tool: gitpod/catfood.gitpod.cloud

Description

This pid is actually thread id, it should be safe if we use in thread-self

see doc link
image

workspace integration test are success https://github.com/gitpod-io/gitpod/actions/runs/13993623337/job/39183946713?pr=20694

Related Issue(s)

Fixes CLC-1252

How to test

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • /werft preemptible
    Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

iQQBot added 2 commits March 21, 2025 14:08
This reverts commit 7137833.

Tool: gitpod/catfood.gitpod.cloud
Tool: gitpod/catfood.gitpod.cloud
@iQQBot iQQBot force-pushed the pd/upgrade-buildkit branch from d5d1291 to b568af2 Compare March 21, 2025 14:08
@roboquat roboquat added size/S and removed size/XS labels Mar 21, 2025
@iQQBot iQQBot marked this pull request as ready for review March 21, 2025 14:29
@iQQBot iQQBot requested review from a team as code owners March 21, 2025 14:29
Copy link
Contributor

@kylos101 kylos101 left a comment

Choose a reason for hiding this comment

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

👋 @iQQBot , nice find! It would be good to get a review from a SME for workspacekit

Comment on lines +278 to +280
if strings.HasPrefix(dest, "/proc/thread-self/") {
target = filepath.Join("/proc", strconv.Itoa(int(req.Pid)), strings.TrimPrefix(dest, "/proc/thread-self/"))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this change impact regular workspaces, and prebuilds?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see tests were failing, and assume this is the intended fix:

--- FAIL: TestBaseImageBuild (50.03s)
--- FAIL: TestBaseImageBuild/database (0.00s)
--- FAIL: TestBaseImageBuild/database/it_should_build_a_base_image (50.03s)

--- FAIL: TestParallelBaseImageBuild (28.78s)
--- FAIL: TestParallelBaseImageBuild/image-builder (0.00s)
--- FAIL: TestParallelBaseImageBuild/image-builder/it_should_allow_parallel_build_of_images (28.78s)

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good, I think, to get a review for this file from @Furisto @aledbf or @csweichel .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We previously did not handle thread-self, so it would fallback to nsenter, using the tid/pid of nsenter at that time. Handling it here actually increases some security.

Copy link
Contributor

Choose a reason for hiding this comment

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

@iQQBot we were talking earlier today, my recollection is, something in buildkit must have changed and is now relying on threading, whereas previously it was not. However, we don't know what that is, is that right?

May I ask, how did you find this change was necessary? As in, what led you to make this change? Can you link to something that tipped you off / pointed you in the right direction? I ask because I'm curious how you did the related debugging. For example, I am not sure if you saw something with journalct or dmesg and wish to know more.

I found upload_parallelism was added:
moby/buildkit@22f6b3e#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R581

It mentions:

Each individual layer is uploaded with 5 threads, using the Upload manager provided by the AWS SDK.

Perhaps that is it?

I see we use many gorountimes and then upload here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Image build fail if not change this

Copy link
Contributor

@kylos101 kylos101 left a comment

Choose a reason for hiding this comment

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

Added a non-blocking question here, to better understand how it was determined that this change was necessary.

✅ to unblock

cc: @geropl

@iQQBot
Copy link
Contributor Author

iQQBot commented Apr 1, 2025

/unhold

@roboquat roboquat merged commit f0eafab into main Apr 1, 2025
144 of 150 checks passed
@roboquat roboquat deleted the pd/upgrade-buildkit branch April 1, 2025 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants