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

Fail when cache check should have succeeded #3996

Merged
merged 1 commit into from
Apr 23, 2020

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented Apr 21, 2020

For every case of failure here, there’s going to be the same issue down the line.
We should not ignore those errors.

The only case where we should ignore them is when images are not local and this is already done.

(This piece of code wasn't tested before and I couldn't find a way to test it properly)

Signed-off-by: David Gageot [email protected]

@codecov
Copy link

codecov bot commented Apr 21, 2020

Codecov Report

Merging #3996 into master will increase coverage by 0.01%.
The diff coverage is 0.00%.

Impacted Files Coverage Δ
pkg/skaffold/build/cache/retrieve.go 69.66% <0.00%> (+1.53%) ⬆️
pkg/skaffold/server/server.go 58.57% <0.00%> (ø)

color.Yellow.Fprintln(out, "Error checking cache. Rebuilding.")
needToBuild = append(needToBuild, artifact)
continue
color.Red.Fprintln(out, "Error checking cache.")
Copy link
Member

Choose a reason for hiding this comment

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

So it seems odd to allow caching to cause a build failure. But your claim is that cache failures are due to problems checking registries or the local daemon, which will fail anyways after building, so we may as well error out now. That seems reasonable. (I'll note that the remote check doesn't actually seem to return a failure

func (c *cache) lookupRemote(ctx context.Context, hash, tag string, entry ImageDetails) cacheDetails {
)

If we're going to fail, shouldn't we output the error 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.

Exactly, they will fail anyways down the line (for local builders only). Why would we print the error here? We just bubble up the error like everywhere.

Here's the output that we used to have:

$ skaffold build
Generating tags...
 - skaffold-example -> skaffold-example:v1.8.0-15-g992ced4a0
Checking cache...
 - skaffold-example: WARN[0007] error checking cache, caching may not work as expected: getting imageID for skaffold-example:v1.8.0-15-g992ced4a0: inspecting image: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Error checking cache. Rebuilding.
Found [docker-desktop] context, using local docker daemon.
Building [skaffold-example]...
FATA[0012] build failed: building [skaffold-example]: build artifact: docker build: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Here's the one we have now:

$ skaffold build
Generating tags...
 - skaffold-example -> skaffold-example:v1.8.0-16-gb688c4faf
Checking cache...
 - skaffold-example: Error checking cache.
FATA[0015] getting imageID for skaffold-example:v1.8.0-16-gb688c4faf: inspecting image: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

For every case of failure here, there’s going to
be the same issue later in the build process.
We should not ignore those errors.

Signed-off-by: David Gageot <[email protected]>
@dgageot
Copy link
Contributor Author

dgageot commented Apr 22, 2020

ping @briandealwis @nkubala

@dgageot dgageot merged commit 15018e3 into GoogleContainerTools:master Apr 23, 2020
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