Skip to content

Improve Git tagger#714

Merged
r2d4 merged 5 commits intoGoogleContainerTools:masterfrom
dgageot:fix-705
Jun 25, 2018
Merged

Improve Git tagger#714
r2d4 merged 5 commits intoGoogleContainerTools:masterfrom
dgageot:fix-705

Conversation

@dgageot
Copy link
Copy Markdown
Contributor

@dgageot dgageot commented Jun 20, 2018

Makes the git tagger more useable in real world situations:

  • Compute tag by artifact working dir
  • Use imageID instead of source sha256 for dirty repositories
  • Fallback on using imageID for non git repositories (with a warning)

@dgageot dgageot force-pushed the fix-705 branch 2 times, most recently from f39cbe7 to a3d10d6 Compare June 20, 2018 16:22
@dgageot dgageot force-pushed the fix-705 branch 9 times, most recently from 485b0d1 to f0831da Compare June 24, 2018 13:04
@dgageot dgageot changed the title Compute tag by artifact working dir Improve Git tagger Jun 24, 2018
dgageot added 3 commits June 25, 2018 08:44
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
for _, changedPath := range changes {
status := status[changedPath].Worktree
lines = append(lines, fmt.Sprintf("%c %s", status, changedPath))
func nornalizePath(path string) (string, error) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Typo: normalize

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Fixing it

@@ -57,36 +53,44 @@ func (c *GitCommit) GenerateFullyQualifiedImageName(workingDir string, opts *Opt
func generateNameGitShellOut(workingDir string, opts *Options) (string, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Now that we're adding some more logic to git-shell impl, are we always going to get the same result with git-shell vs. go-git? Do we care? Should we just drop the library?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The same features should be implemented by both paths. Both paths are also tested. If that’s not the case, it’s an error

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SGTM

return lines, nil
}

func commitOrTag(currentTag string, tags []string, opts *Options) string {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why does this need a slice of tags?

Can git describe --tags --always return more than one tag?

$ git tag test
$ git tag test2
$ git describe --tags --always
test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Go-git returns a slice. Don’t know why

@r2d4 r2d4 merged commit 65337cd into GoogleContainerTools:master Jun 25, 2018
@dgageot dgageot deleted the fix-705 branch December 28, 2018 07:11
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