From cd942402d6bc82fa3ea87e5c43509e1ec6cfafe2 Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Fri, 4 Oct 2024 11:18:10 +0200 Subject: syz-ci: introduce gitArchive parameters Some commits don't live long remotely. It sometimes happens we need them later to: 1. Merge coverage. 2. Mention during communication. --- pkg/vcs/fuchsia.go | 4 ++++ pkg/vcs/git.go | 9 +++++++++ pkg/vcs/vcs.go | 3 +++ 3 files changed, 16 insertions(+) (limited to 'pkg') diff --git a/pkg/vcs/fuchsia.go b/pkg/vcs/fuchsia.go index 2ad0e1878..704c0a9e6 100644 --- a/pkg/vcs/fuchsia.go +++ b/pkg/vcs/fuchsia.go @@ -107,3 +107,7 @@ func (ctx *fuchsia) MergeBases(firstCommit, secondCommit string) ([]*Commit, err func (ctx *fuchsia) CommitExists(string) (bool, error) { return false, fmt.Errorf("not implemented for fuchsia") } + +func (ctx *fuchsia) PushCommit(repo, commit string) error { + return ctx.repo.PushCommit(repo, commit) +} diff --git a/pkg/vcs/git.go b/pkg/vcs/git.go index d1a91404c..f8362dfb2 100644 --- a/pkg/vcs/git.go +++ b/pkg/vcs/git.go @@ -635,3 +635,12 @@ func (git *git) CommitExists(commit string) (bool, error) { } return true, nil } + +func (git *git) PushCommit(repo, commit string) error { + tagName := "tag-" + commit // assign tag to guarantee remote persistence + git.git("tag", tagName) // ignore errors on re-tagging + if _, err := git.git("push", repo, "tag", tagName); err != nil { + return fmt.Errorf("git push %s tag %s: %w", repo, tagName, err) + } + return nil +} diff --git a/pkg/vcs/vcs.go b/pkg/vcs/vcs.go index 0730ba721..23a302cbd 100644 --- a/pkg/vcs/vcs.go +++ b/pkg/vcs/vcs.go @@ -72,6 +72,9 @@ type Repo interface { // CommitExists check for the commit presence in local checkout. CommitExists(commit string) (bool, error) + + // PushCommit is used to store commit in remote repo. + PushCommit(repo, commit string) error } // Bisecter may be optionally implemented by Repo. -- cgit mrf-deployment