Skip to content

When a tagger fails, use a fallback tagger#4019

Merged
dgageot merged 3 commits intoGoogleContainerTools:masterfrom
dgageot:fallback-tagger
Apr 27, 2020
Merged

When a tagger fails, use a fallback tagger#4019
dgageot merged 3 commits intoGoogleContainerTools:masterfrom
dgageot:fallback-tagger

Conversation

@dgageot
Copy link
Copy Markdown
Contributor

@dgageot dgageot commented Apr 23, 2020

This is contributing to reduce the amount of strange error messages the user get.

  • Let the git tagger fail when no git information is found.
  • Use a fallback tagger (usually will tag with :latest)
  • Move the errors to the debug log and show a discrete warning to the user

BEFORE:

Generating tags...
 - leeroy-web -> WARN[0000] Unable to find git commit: running [git describe --tags --always]
 - stdout:
 - stderr: "fatal: not a git repository (or any of the parent directories): .git\n": exit status 128
leeroy-web:dirty
 - leeroy-app -> WARN[0000] Unable to find git commit: running [git describe --tags --always]
 - stdout:
 - stderr: "fatal: not a git repository (or any of the parent directories): .git\n": exit status 128
leeroy-app:dirty
Checking cache...
 - leeroy-web: Found Locally
 - leeroy-app: Found Locally

AFTER:

Generating tags...
 - leeroy-web -> leeroy-web:latest (check the logs for errors)
 - leeroy-app -> leeroy-app:latest (check the logs for errors)
Checking cache...
 - leeroy-web: Found Locally
 - leeroy-app: Found Locally

Signed-off-by: David Gageot david@gageot.net

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 23, 2020

Codecov Report

Merging #4019 into master will decrease coverage by 0.04%.
The diff coverage is 28.57%.

Impacted Files Coverage Δ
pkg/skaffold/runner/build_deploy.go 53.57% <23.07%> (-4.54%) ⬇️
pkg/skaffold/build/tag/git_commit.go 82.89% <100.00%> (-0.23%) ⬇️

fallbackTagger := &tag.ChecksumTagger{}
t.tag, err = fallbackTagger.GenerateFullyQualifiedImageName(artifact.Workspace, imageName)
if err != nil {
return nil, fmt.Errorf("generating tag for %q: %w", imageName, err)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it worth saying:

Suggested change
return nil, fmt.Errorf("generating tag for %q: %w", imageName, err)
return nil, fmt.Errorf("generating checksum as fall-back tag for %q: %w", imageName, err)

dgageot added 3 commits April 27, 2020 10:27
Also print more discrete error messages

Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
@dgageot dgageot merged commit c4fd2b9 into GoogleContainerTools:master Apr 27, 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