Skip to content

fix: set MagicDir to tempdir when performing cache probe #48

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 3 commits into from
Sep 10, 2024

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Sep 6, 2024

Relates to #43
Depends on coder/envbuilder#337 and coder/envbuilder#336

@johnstcn johnstcn self-assigned this Sep 6, 2024
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

Looks like linter is complaining a bit?

@johnstcn
Copy link
Member Author

johnstcn commented Sep 9, 2024

Looks like linter is complaining a bit?

Can't build until the linked envbuilder PRs are merged :-)

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Just a few envbuilder related comments, this PR is fine 👍🏻

@@ -34,7 +35,9 @@ func GetRemoteImage(imgRef string) (v1.Image, error) {
// ExtractEnvbuilderFromImage reads the image located at imgRef and extracts
// MagicBinaryLocation to destPath.
func ExtractEnvbuilderFromImage(ctx context.Context, imgRef, destPath string) error {
needle := filepath.Clean(constants.MagicBinaryLocation)[1:] // skip leading '/'
var o eboptions.Options
o.SetDefaults()
Copy link
Member

Choose a reason for hiding this comment

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

(envbuilder review: Usage here might be nicer with o := eboptions.Defaults().)

@@ -467,6 +466,8 @@ func runCacheProbe(ctx context.Context, builderImage string, opts eboptions.Opti
if err := os.MkdirAll(tmpKanikoDir, 0o755); err != nil {
return nil, fmt.Errorf("failed to create kaniko dir: %w", err)
}
// Use the temporary directory as our 'magic dir'.
opts.MagicDirBase = tmpKanikoDir
Copy link
Member

Choose a reason for hiding this comment

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

(envbuilder nit: "base" makes me think of the directory that should contain the magicdir, i.e. [base]/.envbuilder).

@johnstcn johnstcn merged commit 4077a87 into main Sep 10, 2024
14 checks passed
@johnstcn johnstcn deleted the cj/set-magicdir branch September 10, 2024 08:47
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.

4 participants