Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: executor: DoCacheProbe: remove fake verbiage #15

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
Jun 12, 2024

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Jun 12, 2024

  • Removes 'fake' verbiage from DoCacheProbe
  • Renames FakeExecuteCommand to CachedExecuteCommand
  • Updates cache probe tests to use an in-memory registry instead
  • Adds a test for issue envbuilder#230 (disabled for now)

@johnstcn johnstcn self-assigned this Jun 12, 2024
@@ -37,8 +41,7 @@ func TestDoCacheProbe(t *testing.T) {
COPY foo/bar.txt copied/
`
os.WriteFile(filepath.Join(testDir, "workspace", "Dockerfile"), []byte(dockerFile), 0755)
// Populate the cache by doing an initial build
cacheDir := t.TempDir()
regCache := setupCacheRegistry(t)
Copy link
Member Author

Choose a reason for hiding this comment

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

review: I noticed the oci:/ repo was not actually pushing to cacheDir so I elected to stand up a temporary registry instad.

Copy link

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +127 to +164
t.Run("MultiStage", func(t *testing.T) {
t.Skip("TODO: https://github.com/coder/envbuilder/issues/230")
testDir, fn := setupMultistageTests(t)
defer fn()
dockerFile := `
FROM scratch as first
COPY foo/bam.txt copied/
ENV test test

From scratch as second
COPY --from=first copied/bam.txt output/bam.txt`
os.WriteFile(filepath.Join(testDir, "workspace", "Dockerfile"), []byte(dockerFile), 0755)
regCache := setupCacheRegistry(t)
opts := &config.KanikoOptions{
DockerfilePath: filepath.Join(testDir, "workspace", "Dockerfile"),
SrcContext: filepath.Join(testDir, "workspace"),
SnapshotMode: constants.SnapshotModeRedo,
Cache: true,
CacheOptions: config.CacheOptions{
CacheTTL: time.Hour,
},
CacheCopyLayers: true,
CacheRunLayers: true,
CacheRepo: regCache + "/test",
}
_, err := DoBuild(opts)
testutil.CheckNoError(t, err)
os.WriteFile(filepath.Join(testDir, "workspace", "Dockerfile"), []byte(dockerFile), 0755)
opts.Reproducible = true
_, err = DoCacheProbe(opts)
testutil.CheckNoError(t, err)
// Check Image has one layer bam.txt
files, err := readDirectory(filepath.Join(testDir, "output"))
if err != nil {
t.Fatal(err)
}
testutil.CheckDeepEqual(t, 1, len(files))
testutil.CheckDeepEqual(t, files[0].Name(), "bam.txt")

Choose a reason for hiding this comment

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

Is this germane to this set of changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it's just a drive-by. I figured I may as well add the test for later since I had it hanging around unstaged.

@johnstcn johnstcn merged commit 9d2f7ea into main Jun 12, 2024
9 checks passed
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.

post-merge approval 👍

@mafredri mafredri deleted the cj/kaniko-follow-up-remove-fake-verbiage branch September 25, 2024 12:35
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.

3 participants