Skip to content

Enable ssh configration for pipedv1#6201

Merged
ffjlabo merged 4 commits into
masterfrom
uncomment-git-ssh-setting-for-pipedv1
Sep 3, 2025
Merged

Enable ssh configration for pipedv1#6201
ffjlabo merged 4 commits into
masterfrom
uncomment-git-ssh-setting-for-pipedv1

Conversation

@ffjlabo
Copy link
Copy Markdown
Member

@ffjlabo ffjlabo commented Sep 3, 2025

What this PR does:

as title
To realize this, we decided to define a type alias for configv1.PipedGit in pkg/config.

Currently, it's ok because configv1.PipedGit and config.PipedGit are the same definition.

// in pkg/config
type PipedGit = configv1.PipedGit

⚠️ We need to consider the backward capability for v0 when fixing configv1.PipedGit.
We decided to do it to fix the config easily in the future, and we will support only pipedv1.

Why we need it:

The current pipedv1 can't clone git repo with ssh.

Which issue(s) this PR fixes:

Part of #5259

Does this PR introduce a user-facing change?:

  • How are users affected by this change:
  • Is this breaking change:
  • How to migrate (if breaking change):

Signed-off-by: Yoshiki Fujikane <ffjlabo@gmail.com>
Signed-off-by: Yoshiki Fujikane <ffjlabo@gmail.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 9.09091% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.78%. Comparing base (3415269) to head (05ee84e).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
pkg/app/pipedv1/cmd/piped/piped.go 0.00% 9 Missing ⚠️
pkg/git/ssh_config.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6201      +/-   ##
==========================================
- Coverage   28.80%   28.78%   -0.03%     
==========================================
  Files         559      559              
  Lines       59568    59520      -48     
==========================================
- Hits        17160    17132      -28     
+ Misses      41094    41074      -20     
  Partials     1314     1314              
Flag Coverage Δ
. 23.25% <9.09%> (-0.04%) ⬇️
.-pkg-app-pipedv1-plugin-analysis 32.64% <ø> (ø)
.-pkg-app-pipedv1-plugin-kubernetes 60.24% <ø> (ø)
.-pkg-app-pipedv1-plugin-kubernetes_multicluster 67.48% <ø> (ø)
.-pkg-app-pipedv1-plugin-scriptrun 54.83% <ø> (ø)
.-pkg-app-pipedv1-plugin-terraform 39.49% <ø> (ø)
.-pkg-app-pipedv1-plugin-wait 35.51% <ø> (ø)
.-pkg-app-pipedv1-plugin-waitapproval 55.73% <ø> (ø)
.-pkg-plugin-sdk 50.37% <ø> (ø)
.-tool-actions-gh-release 19.23% <ø> (ø)
.-tool-actions-plan-preview 25.51% <ø> (ø)
.-tool-codegen-protoc-gen-auth 0.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ffjlabo ffjlabo changed the title [WIP] Enable ssh configration for pipedv1 Enable ssh configration for pipedv1 Sep 3, 2025
@ffjlabo ffjlabo marked this pull request as ready for review September 3, 2025 04:59
@ffjlabo ffjlabo requested a review from a team as a code owner September 3, 2025 04:59
@ffjlabo ffjlabo enabled auto-merge (squash) September 3, 2025 05:03
Comment on lines +171 to +177
if cfg.Git.ShouldConfigureSSHConfig() {
if _, err := git.AddSSHConfig(cfg.Git); err != nil {
input.Logger.Error("failed to configure ssh-config", zap.Error(err))
return err
}
input.Logger.Info("successfully configured ssh-config")
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should update to remove ssh key file as we do for pipedv0
ref:

// Configure SSH config if needed.
if cfg.Git.ShouldConfigureSSHConfig() {
tempFile, err := git.AddSSHConfig(cfg.Git)
if err != nil {
input.Logger.Error("failed to configure ssh-config", zap.Error(err))
return err
}
defer os.Remove(tempFile)
input.Logger.Info("successfully configured ssh-config")
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, will fix it.
Note: It is supported in the PR #5769

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed on 01304fe

Comment thread pkg/git/ssh_config.go
"text/template"

"github.com/pipe-cd/pipecd/pkg/config"
configv1 "github.com/pipe-cd/pipecd/pkg/configv1"
Copy link
Copy Markdown
Member

@khanhtc1202 khanhtc1202 Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
configv1 "github.com/pipe-cd/pipecd/pkg/configv1"
"github.com/pipe-cd/pipecd/pkg/configv1"

Or how about making this like we did in pipedv1 entry
ref: https://github.com/pipe-cd/pipecd/blob/master/pkg/app/pipedv1/cmd/piped/piped.go#L72

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@khanhtc1202
This package is for both pipedv0 and pipedv1, so it would be nice to distinguish config and configv1 to avoid misinterpreting them.
So I think it is good as is.
WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got your point 🙆‍♂️

Signed-off-by: Yoshiki Fujikane <ffjlabo@gmail.com>
Comment thread pkg/app/pipedv1/cmd/piped/piped.go Outdated
@@ -168,13 +168,15 @@ func (p *piped) run(ctx context.Context, input cli.Input) (runErr error) {
registry := registerMetrics(cfg.PipedID, cfg.ProjectID, p.launcherVersion)

// // Configure SSH config if needed.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// // Configure SSH config if needed.
// Configure SSH config if needed.

nits

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed 05ee84e

khanhtc1202
khanhtc1202 previously approved these changes Sep 3, 2025
Copy link
Copy Markdown
Member

@khanhtc1202 khanhtc1202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, letf a nits 🙆‍♂️

Signed-off-by: Yoshiki Fujikane <ffjlabo@gmail.com>
Copy link
Copy Markdown
Member

@khanhtc1202 khanhtc1202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks 🙆‍♂️

Copy link
Copy Markdown
Member

@Warashi Warashi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@ffjlabo ffjlabo merged commit 0e9c3ff into master Sep 3, 2025
44 of 45 checks passed
@ffjlabo ffjlabo deleted the uncomment-git-ssh-setting-for-pipedv1 branch September 3, 2025 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants