-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(controller): always pass credentials to kargo render #1696
Conversation
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
✅ Deploy Preview for docs-kargo-akuity-io canceled.
|
@@ -103,7 +103,7 @@ CMD ["pnpm", "dev"] | |||
# - the official image we publish | |||
# - purposefully last so that it is the default target when building | |||
#################################################################################################### | |||
FROM ghcr.io/akuity/kargo-render:v0.1.0-rc.38 as final | |||
FROM ghcr.io/akuity/kargo-render:v0.1.0-rc.39 as final |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a bug where Kargo render sometimes pushed a new, empty target branch to the remote even when instructed not to commit anything.
"--repo-username", | ||
req.RepoCreds.Username, | ||
"--output", | ||
"json", | ||
} | ||
for _, image := range req.Images { | ||
cmdTokens = append(cmdTokens, "--image", image) | ||
} | ||
cmd := exec.Command(cmdTokens[0], cmdTokens[1:]...) // nolint: gosec | ||
cmd.Env = append( | ||
os.Environ(), | ||
fmt.Sprintf("KARGO_RENDER_REPO_PASSWORD=%s", req.RepoCreds.Password), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of two key changes. Most everything else is just updates to function signatures to get these creds down to here.
@@ -97,6 +99,7 @@ func (r *renderer) apply( | |||
Images: images, | |||
LocalInPath: workingDir, | |||
LocalOutPath: writeDir, | |||
RepoCreds: repoCreds, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of two key changes. Most everything else is just updates to function signatures to get these creds down to here.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1696 +/- ##
==========================================
- Coverage 43.93% 43.92% -0.02%
==========================================
Files 203 203
Lines 13061 13070 +9
==========================================
+ Hits 5739 5741 +2
- Misses 7075 7082 +7
Partials 247 247 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this with a scenario which was previously failing, and it works great!
Prior to #1674 we did always pass credentials to Kargo Render. We stopped because Kargo proper now handles all the checking out and committing -- or so I thought...
I had forgotten that Kargo Render will, even if given a local repo that is already checked out to the correct source commit, check if the target branch exists remotely and attempt to pull from it. It does this because it wants up-to-date metadata from the target branch, if it exists.