Skip to content

Commit 012a083

Browse files
committed
fix repo refresh
Signed-off-by: Mmadu Manasseh <manasseh.mmadu@zapier.com>
1 parent acd97a9 commit 012a083

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

localdev/kubechecks/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ configMap:
2222
#
2323
# KUBECHECKS_LABEL_FILTER: "test" # On your PR/MR, prefix this with "kubechecks:"
2424
# KUBECHECKS_SCHEMAS_LOCATION: https://github.com/zapier/kubecheck-schemas.git
25+
KUBECHECKS_REPO_REFRESH_INTERVAL: 30s
2526
KUBECHECKS_TIDY_OUTDATED_COMMENTS_MODE: "delete"
2627
KUBECHECKS_ENABLE_CONFTEST: "false"
27-
KUBECHECKS_ENABLE_SHALLOW_CLONE: "true"
28-
28+
KUBECHECKS_REPO_SHALLOW_CLONE: "true"
2929

3030
deployment:
3131
annotations:

pkg/git/repo.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func New(cfg config.ServerConfig, cloneUrl, branchName string) *Repo {
4848

4949
func (r *Repo) Clone(ctx context.Context) error {
5050
if r.Shallow {
51-
return r.ShallowClone(ctx)
51+
return r.shallowClone(ctx)
5252
}
5353

5454
var err error
@@ -92,7 +92,7 @@ func (r *Repo) Clone(ctx context.Context) error {
9292
return nil
9393
}
9494

95-
func (r *Repo) ShallowClone(ctx context.Context) error {
95+
func (r *Repo) shallowClone(ctx context.Context) error {
9696
var err error
9797

9898
if r.Directory == "" {
@@ -215,7 +215,7 @@ func (r *Repo) Update(ctx context.Context) error {
215215
if r.Shallow {
216216
r.Wipe()
217217
err := os.Mkdir(r.Directory, 0700)
218-
if err == nil {
218+
if err != nil {
219219
return errors.Wrap(err, "failed to create repo directory")
220220
}
221221
return r.Clone(ctx)

pkg/utils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ func Pointer[T interface{}](item T) *T {
1616
}
1717

1818
func WipeDir(dir string) {
19+
log.Debug().Str("path", dir).Msg("wiping path")
1920
if err := os.RemoveAll(dir); err != nil {
2021
log.Error().
2122
Err(err).

0 commit comments

Comments
 (0)