Skip to content

feat: support starting from an already-built image #296

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 6 commits into from
Aug 3, 2024

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Aug 2, 2024

Fixes #291

Depends on coder/kaniko#19

Builds on top of #292

  • Extracts 'magic directives' to constants.go.
  • Adds 'magic image' file to signify envbuilder should skip the destructive 'build image' stage.
  • Modifies logic for copying binary into built image: we now copy to build context and remove it after build finishes to avoid leaving around files owned by root:root. Also ensures files are created with consistent permissions.

@@ -1138,8 +1149,8 @@ ENTRYPOINT [%q]`, exePath, exePath, exePath)
},
SrcContext: buildParams.BuildContext,

// For cached image utilization, produce reproducible builds.
Reproducible: opts.PushImage,
// When performing a cache probe, always perform reproducible snapshots.
Copy link
Member

Choose a reason for hiding this comment

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

👍🏻

Comment on lines +1107 to +1111
for _, path := range []string{magicImageDest, envbuilderBinDest, magicTempDir} {
if err := opts.Filesystem.Remove(path); err != nil {
opts.Logger(log.LevelWarn, "failed to clean up magic temp dir from build context: %w", err)
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

note: there is no fs.RemoveAll :(

@johnstcn johnstcn requested a review from mafredri August 3, 2024 15:45
@johnstcn johnstcn merged commit 6afe89e into main Aug 3, 2024
4 checks passed
@johnstcn johnstcn deleted the cj/fix-cache-probe-provider branch August 3, 2024 18:38
johnstcn added a commit that referenced this pull request Aug 5, 2024
- Extracts 'magic directives' to constants.go.
- Adds 'magic image' file to signify envbuilder should skip the destructive 'build image' stage.
- Modifies logic for copying binary into built image: we now copy to build context and remove it after build finishes to avoid leaving around files owned by root:root. Also ensures files are created with consistent permissions.

(cherry picked from commit 6afe89e)
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.

Add support for starting envbuilder from a built image
2 participants