Skip to content

Commit a94019f

Browse files
authored
Revert "feat(cli): adds support for polling git hash from Argo CD (#89)" (#92)
This reverts commit 2c8a7d3.
1 parent 2c8a7d3 commit a94019f

File tree

2 files changed

+9
-41
lines changed

2 files changed

+9
-41
lines changed

lib/project/project/runtime.go

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ package project
33
import (
44
"fmt"
55
"log/slog"
6-
"os"
7-
8-
"github.com/input-output-hk/catalyst-forge/lib/tools/argo"
9-
tg "github.com/input-output-hk/catalyst-forge/lib/tools/git"
106

117
"cuelang.org/go/cue"
128
"github.com/go-git/go-git/v5"
@@ -59,31 +55,15 @@ func GetDefaultRuntimes(logger *slog.Logger) []RuntimeData {
5955

6056
// getCommitHash returns the commit hash of the HEAD commit.
6157
func getCommitHash(repo *git.Repository) (string, error) {
62-
if tg.InCI() {
63-
v, exists := os.LookupEnv("GITHUB_SHA")
64-
if !exists {
65-
return "", fmt.Errorf("GITHUB_SHA not found in environment")
66-
}
67-
68-
return v, nil
69-
} else if argo.InArgo() {
70-
v, exists := os.LookupEnv("ARGOCD_APP_REVISION")
71-
if !exists {
72-
return "", fmt.Errorf("ARGOCD_APP_REVISION not found in environment")
73-
}
74-
75-
return v, nil
76-
} else {
77-
ref, err := repo.Head()
78-
if err != nil {
79-
return "", fmt.Errorf("failed to get HEAD: %w", err)
80-
}
81-
82-
obj, err := repo.CommitObject(ref.Hash())
83-
if err != nil {
84-
return "", fmt.Errorf("failed to get commit object: %w", err)
85-
}
58+
ref, err := repo.Head()
59+
if err != nil {
60+
return "", fmt.Errorf("failed to get HEAD: %w", err)
61+
}
8662

87-
return obj.Hash.String(), nil
63+
obj, err := repo.CommitObject(ref.Hash())
64+
if err != nil {
65+
return "", fmt.Errorf("failed to get commit object: %w", err)
8866
}
67+
68+
return obj.Hash.String(), nil
8969
}

lib/tools/argo/util.go

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)