8000 Propagate context.Context to build logic by michaeldwan · Pull Request #2287 · replicate/cog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Propagate context.Context to build logic #2287

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

Merged
merged 2 commits into from
Apr 29, 2025
Merged

Propagate context.Context to build logic #2287

merged 2 commits into from
Apr 29, 2025

Conversation

michaeldwan
Copy link
Member
@michaeldwan michaeldwan commented Apr 28, 2025

I'm doing some work in the build code that requires a context.Context (adding another command.Command implementation that hits the docker engine directly). Since most of the build code doesn't accept a context, I had to make a ton of tiny changes to pass a context from a command's run function through to the dockerfile generators and the docker command.Command interface.

These changes shouldn't have a meaningful impact, but extracting them into a separate PR will make the next one much easier to review. 😅

The vast majority of changes are adding ctx context.Context to function signatures then passing it on. The only actual changes that use the context are:

  • calls to the docker CLI that used exec.Command(... now use exec.CommandContext(ctx, ..., such as this example.
  • several function calls that required a context were using context.Background() or context.TODO() and are now using the parent context provided (such as this)

@michaeldwan michaeldwan changed the title wip build api experiment Propagate context.Context to build logic Apr 28, 2025
@michaeldwan michaeldwan requested a review from a team April 28, 2025 22:25
@michaeldwan michaeldwan marked this pull request as ready for review April 28, 2025 22:46
@michaeldwan michaeldwan merged commit c505da2 into main Apr 29, 2025
21 checks passed
@michaeldwan michaeldwan deleted the md/docker-api branch April 29, 2025 16:26
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.

2 participants
0