Skip to content

Commit

Permalink
Merge pull request #292 from utilitywarehouse/fix-upd-repo-bases
Browse files Browse the repository at this point in the history
Do not update repo bases if GitSSHSecretRef is not set
  • Loading branch information
ffilippopoulos committed Mar 22, 2024
2 parents 7e51a11 + e308962 commit 1886cb1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine AS build
FROM golang:1.22-alpine AS build

WORKDIR /src

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/utilitywarehouse/kube-applier

go 1.20
go 1.22

require (
github.com/go-test/deep v1.0.5
Expand Down
6 changes: 4 additions & 2 deletions run/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,10 @@ func (r *Runner) setupRepositoryClone(ctx context.Context, waybill *kubeapplierv
return "", "", err
}
// Rewrite repo addresses for those that want to use SSH keys to clone
if err := r.updateRepoBaseAddresses(tmpRepoDir); err != nil {
return "", "", err
if waybill.Spec.GitSSHSecretRef != nil {
if err := r.updateRepoBaseAddresses(tmpRepoDir); err != nil {
return "", "", err
}
}
return filepath.Join(tmpRepoDir, r.RepoPath), hash, nil
}
Expand Down
2 changes: 1 addition & 1 deletion run/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ Some error output has been omitted because it may contain sensitive data
Commit: bHeadCommitHash,
ErrorMessage: "exit status 1",
Finished: metav1.Time{},
Output: `(?s)Error: accumulating resources:.*'ssh:\/\/deploy_github_com\/utilitywarehouse\/kube-applier\/\/testdata\/bases\/simple-deployment\?ref=master'.*exit status 128`,
Output: `(?s).*Please make sure you have the correct access rights.*exit status 128`,
Started: metav1.Time{},
Success: false,
Type: PollingRun.String(),
Expand Down
1 change: 1 addition & 0 deletions testdata/manifests/app-d-kustomize/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
bases:
# kube-applier: key_should_be_ignored
- ssh://github.com/utilitywarehouse/kube-applier//testdata/bases/simple-deployment?ref=master
resources:
- 00-namespace.yaml

0 comments on commit 1886cb1

Please sign in to comment.