From 801d27b091fd6b834c54bc294e70bf280eb24433 Mon Sep 17 00:00:00 2001 From: Debanjan Ganguly Date: Thu, 17 Oct 2024 19:17:32 +0530 Subject: [PATCH 1/2] feat: allow retrieval of commits for tags (#675) --- testhelper/gittest/gittest.go | 13 +++++++++++-- testhelper/gittest/gittest_test.go | 12 ++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/testhelper/gittest/gittest.go b/testhelper/gittest/gittest.go index 323db29c..229f6b3c 100644 --- a/testhelper/gittest/gittest.go +++ b/testhelper/gittest/gittest.go @@ -109,8 +109,17 @@ func (s *Server) GetServerCA() []byte { return getServerCA(s.Server) } -func (s *Server) GetLatestCommitHash(t testing.TB, branch string) string { - cmd := exec.Command("git", "-c", "http.sslVerify=false", "ls-remote", s.URL, fmt.Sprintf("refs/heads/%s", branch)) +func (s *Server) GetLatestCommitHash(t testing.TB, referenceType, ref string) string { + var refType string + switch referenceType { + case "branch": + refType = "heads" + case "tag": + refType = "tags" + default: + require.Fail(t, "invalid refType") + } + cmd := exec.Command("git", "-c", "http.sslVerify=false", "ls-remote", s.URL, fmt.Sprintf("refs/%s/%s", refType, ref)) out, err := cmd.Output() require.NoError(t, err, "should be able to run the ls-remote command") commitHash := strings.Split(string(out), "\t")[0] diff --git a/testhelper/gittest/gittest_test.go b/testhelper/gittest/gittest_test.go index 18ce52a7..6457acb2 100644 --- a/testhelper/gittest/gittest_test.go +++ b/testhelper/gittest/gittest_test.go @@ -63,7 +63,7 @@ func TestGitServer(t *testing.T) { require.NoError(t, err, "should be able to get the HEAD commit") require.NotEmpty(t, out, "HEAD commit should not be empty") - latestCommit := s.GetLatestCommitHash(t, "develop") + latestCommit := s.GetLatestCommitHash(t, "branch", "develop") require.Equal(t, strings.TrimSpace(out), latestCommit, "HEAD commit should match the latest commit") }) @@ -79,7 +79,15 @@ func TestGitServer(t *testing.T) { require.NoError(t, err, "should be able to get the HEAD commit") require.NotEmpty(t, out, "HEAD commit should not be empty") - latestCommit := s.GetLatestCommitHash(t, "main") + out, err = execCmd("git", "-C", tempDir, "tag", "-a", "v1.0.0", "-m", "tag v1.0.0") + require.NoErrorf(t, err, "should be able to create a new tag: %s", out) + out, err = execCmd("git", "-c", "http.sslVerify=false", "-C", tempDir, "push", "origin", "v1.0.0") + require.NoErrorf(t, err, "should be able to push the new tag: %s", out) + + out, err = execCmd("git", "-C", tempDir, "rev-parse", "v1.0.0") + require.NoError(t, err, "should be able to get the HEAD commit") + latestCommit := s.GetLatestCommitHash(t, "tag", "v1.0.0") + require.Equal(t, strings.TrimSpace(out), latestCommit, "HEAD commit should match the latest commit") }) } From 60a57d08fc0d443bf816cfaf8c7f10060fdd4315 Mon Sep 17 00:00:00 2001 From: devops-github-rudderstack <88187154+devops-github-rudderstack@users.noreply.github.com> Date: Fri, 18 Oct 2024 11:14:26 +0530 Subject: [PATCH 2/2] chore: release 0.44.0 (#674) --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e094d7a..a614aa8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [0.44.0](https://github.com/rudderlabs/rudder-go-kit/compare/v0.43.0...v0.44.0) (2024-10-17) + + +### Features + +* allow retrieval of commits for tags ([#675](https://github.com/rudderlabs/rudder-go-kit/issues/675)) ([801d27b](https://github.com/rudderlabs/rudder-go-kit/commit/801d27b091fd6b834c54bc294e70bf280eb24433)) + + +### Miscellaneous + +* add support for WithEnv and WithRepository for transformer resource ([#673](https://github.com/rudderlabs/rudder-go-kit/issues/673)) ([f907f10](https://github.com/rudderlabs/rudder-go-kit/commit/f907f1082e1246b2210be24010f8aa1d47b16d47)) + ## [0.43.0](https://github.com/rudderlabs/rudder-go-kit/compare/v0.42.2...v0.43.0) (2024-09-27)