Skip to content
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

Modified to use Git with PAT #4571

Merged
merged 45 commits into from
Aug 30, 2024
Merged

Conversation

sZma5a
Copy link
Contributor

@sZma5a sZma5a commented Aug 27, 2023

What this PR does / why we need it: Modified to use Personal Access Token since currently only SSH can control the Git repository.

Which issue(s) this PR fixes:

Fixes #4106

Does this PR introduce a user-facing change?: Yes

  • How are users affected by this change: Be able to use Personal Access Token setting like this:
apiVersion: pipecd.dev/v1beta1
kind: Piped
spec:
  git:
     personalAccessToken:
        userName: <user-name>
        userToken: <user-token>
  • Is this breaking change: No
  • How to migrate (if breaking change):

@sZma5a
Copy link
Contributor Author

sZma5a commented Aug 27, 2023

@kentakozuka

Sorry...
I accidentally closed a previously created PR, but was unable to reopen it, so I created a side...

#4534

@sZma5a sZma5a marked this pull request as ready for review August 27, 2023 16:32
@sZma5a sZma5a force-pushed the feat/add-pat-setting branch 2 times, most recently from 0cbfcc1 to 028e54d Compare August 27, 2023 16:33
@codecov
Copy link

codecov bot commented Aug 27, 2023

Codecov Report

Attention: Patch coverage is 54.16667% with 22 lines in your changes missing coverage. Please review.

Project coverage is 28.93%. Comparing base (14eb473) to head (87be877).
Report is 37 commits behind head on master.

Current head 87be877 differs from pull request most recent head 1291bab

Please upload reports for the commit 1291bab to get more accurate results.

Files Patch % Lines
pkg/git/client.go 40.00% 12 Missing and 3 partials ⚠️
pkg/app/piped/cmd/piped/piped.go 0.00% 4 Missing ⚠️
pkg/config/piped.go 84.21% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4571      +/-   ##
==========================================
- Coverage   29.23%   28.93%   -0.30%     
==========================================
  Files         318      317       -1     
  Lines       40597    40413     -184     
==========================================
- Hits        11870    11695     -175     
+ Misses      27787    27786       -1     
+ Partials      940      932       -8     

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

Copy link
Member

@kentakozuka kentakozuka left a comment

Choose a reason for hiding this comment

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

Thanks! Left a comment. PTAL 👀

Comment on lines 1390 to 1520
func TestPipeGitValidate(t *testing.T) {
t.Parallel()
testcases := []struct {
git PipedGit
err error
}{
{
git: PipedGit{
SSHKeyData: "sshkey1",
PersonalAccessToken: PipedGitPersonalAccessToken{
UserName: "UserName",
UserToken: "UserToken",
},
},
err: errors.New("cannot configure both sshKeyData or sshKeyFile and personalAccessToken"),
},
{
git: PipedGit{
SSHKeyData: "sshkey2",
},
err: nil,
},
{
git: PipedGit{
PersonalAccessToken: PipedGitPersonalAccessToken{
UserName: "UserName",
UserToken: "UserToken",
},
},
err: nil,
},
{
git: PipedGit{ },
err: nil,
},
}
for _, tc := range testcases {
tc := tc
t.Run(tc.git.SSHKeyData, func(t *testing.T) {
t.Parallel()
err := tc.git.Validate()
assert.Equal(t, tc.err, err)
})
}
}
Copy link
Member

Choose a reason for hiding this comment

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

IMHO, the test above misses some cases.
Can you copy and paste the test bellow, fix TODOs, and run it?

func TestPipeGitValidate(t *testing.T) {
	t.Parallel()
	testcases := []struct {
		name string
		git  PipedGit
		err  error
	}{
		{
			name: "both SSH and PAT are valid",
			git: PipedGit{
				SSHKeyData: "sshkey1",
				PersonalAccessToken: PipedGitPersonalAccessToken{
					UserName:  "UserName",
					UserToken: "UserToken",
				},
			},
			err: errors.New("cannot configure both sshKeyData or sshKeyFile and personalAccessToken"),
		},
		{
			name: "Both SSH and PAT is not valid",
			git: PipedGit{
				SSHKeyFile: "sshkeyfile",
				SSHKeyData: "sshkeydata",
				PersonalAccessToken: PipedGitPersonalAccessToken{
					UserName:  "",
					UserToken: "UserToken",
				},
			},
			// TODO: should return error
		},
		{
			name: "SSH key data is not empty",
			git: PipedGit{
				SSHKeyData: "sshkey2",
			},
			err: nil,
		},
		{
			name: "SSH key file is not empty",
			git: PipedGit{
				SSHKeyFile: "sshkey2",
			},
			err: nil,
		},
		{
			name: "Both SSH file and data is not empty",
			git: PipedGit{
				SSHKeyData: "sshkeydata",
				SSHKeyFile: "sshkeyfile",
			},
			// TODO: should return error
		},
		{
			name: "PAT is valid",
			git: PipedGit{
				PersonalAccessToken: PipedGitPersonalAccessToken{
					UserName:  "UserName",
					UserToken: "UserToken",
				},
			},
			err: nil,
		},
		{
			name: "PAT username is empty",
			git: PipedGit{
				PersonalAccessToken: PipedGitPersonalAccessToken{
					UserName:  "UserName",
					UserToken: "",
				},
			},
			// TODO: should return error
		},
		{
			name: "PAT token is empty",
			git: PipedGit{
				PersonalAccessToken: PipedGitPersonalAccessToken{
					UserName:  "",
					UserToken: "UserToken",
				},
			},
			// TODO: should return error
		},
		{
			name: "Git config is empty",
			git:  PipedGit{},
			err:  nil,
		},
	}
	for _, tc := range testcases {
		tc := tc
		t.Run(tc.git.SSHKeyData, func(t *testing.T) {
			t.Parallel()
			err := tc.git.Validate()
			assert.Equal(t, tc.err, err)
		})
	}
}

@@ -49,6 +49,13 @@ spec:
| hostName | string | The hostname or IP address of the remote git server. Default is the same value with Host. | No |
| sshKeyFile | string | The path to the private ssh key file. This will be used to clone the source code of the specified git repositories. | No |
| sshKeyData | string | Base64 encoded string of SSH key. | No |
| personalAccessToken | [PipedGitPersonalAccessToken](#gitPersonalAccessToken) | Configuration for personal access token. | No |
Copy link
Member

Choose a reason for hiding this comment

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

Just realized that;
PipeCD supports not only GitHub but also Git services(GitLab, self-host Git server, etc.).
So, it should be how this configuration can be used for other Git services.

How about simply adding password instead of personalAccessToken?
WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you suggesting replacing the Personal Access Token with a password?
Using a password might lead to confusion, so maybe we could stick with some form of access token instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

You are right. It can be confusing for GitHub users. But, IMHO, using the word password should be better because Personal access tokens can be used in GitHub (and GitLab as well), but it is not required for being a Git server. PipeCD supports Git (not GitHub) so it should respect Git terminology.

Copy link
Contributor Author

@sZma5a sZma5a Dec 17, 2023

Choose a reason for hiding this comment

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

Since 'Password' overlaps with the variable name, 'PersonalAccessToken' renamed to 'PasswordAuth' and 'userToken' to 'Password'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kentakozuka
Sorry I forgot to add a mentions...

Copy link
Member

@ffjlabo ffjlabo Jan 30, 2024

Choose a reason for hiding this comment

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

@sZma5a @kentakozuka
To clarify this discussion, I want to organize your opinions and give my opinion 👀
Feel free to tell me if there is a misunderstanding :)

The point is whether to define a variable only for PAT or not.
For me, each opinion of yours seems to be like below 👀

[@kentakozuka 's opinion]
GitHub's PAT behaves like a password on the git. It's just a password on the git.

[@sZma5a 's opinion]
PAT is a different role from a password. So It's confusing to define it as a Password.

I think both opinions are important points 👍
So I will try to give my opinion after considering those opinions!

[IMO]

Maybe this PR is like a supporting password for git on piped :)

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood, thank you very much!

Copy link
Contributor Author

@sZma5a sZma5a Feb 12, 2024

Choose a reason for hiding this comment

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

@ffjlabo @kentakozuka
Sorry it took so long to fix.
I have modified the PAT settings to use a password, and updated it to work with the existing Git username!
How does this look?

Copy link
Contributor

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added Stale and removed Stale labels Dec 14, 2023
@sZma5a sZma5a requested a review from t-kikuc as a code owner December 17, 2023 14:43
@sZma5a sZma5a force-pushed the feat/add-pat-setting branch 2 times, most recently from a358cde to ffeea16 Compare December 17, 2023 15:05
鈴木 優耀 and others added 13 commits August 19, 2024 05:24
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>
…on-reference.md

Co-authored-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Co-authored-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: sZma5a <[email protected]>
@sZma5a
Copy link
Contributor Author

sZma5a commented Aug 24, 2024

@Warashi
Sorry be late.
I fixed your comment.
I would appreciate it if you could review this.
#4571 (review)

@sZma5a sZma5a requested a review from Warashi August 24, 2024 14:17
Copy link
Contributor

@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.

I checked the behavior, and this worked as expected!
Thank you. LGTM.

Copy link
Member

@ffjlabo ffjlabo left a comment

Choose a reason for hiding this comment

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

Thank you for the great contribution 🚀

@Warashi Warashi merged commit 224c205 into pipe-cd:master Aug 30, 2024
15 checks passed
@sZma5a
Copy link
Contributor Author

sZma5a commented Aug 30, 2024

Thank you very much for following me!

github-actions bot pushed a commit that referenced this pull request Sep 5, 2024
* fix to read PAT settings from file

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* piped

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* include  PAT information in URL

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: modification of conditional branching

Co-authored-by: sivchari <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: corrected error in error message

Co-authored-by: sivchari <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: integration of mask function

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: make validation test

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: function name

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: rename function for validation PAT

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix test code as pointed out in the review

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* feat: add explan
for git personal access token in document

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: change required in documentation

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: change return value

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: add test case

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix test

Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: PipedGit struct to use password
authentication instead of personal access token

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix to read PAT settings from file

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* piped

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: integration of mask function

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: make validation test

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: function name

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: rename function for validation PAT

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix test

Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: PipedGit struct to use password
authentication instead of personal access token

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Fix Git authentication configuration

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Update password authentication configuration

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Fix error variable name

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Fix rename password

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Refactor includePasswordAuthRemote function

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Update password authentication in clone test

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: delete PasswordAuth

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: remove unused PasswordAuth field and refactor password authentication in git client

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Remove unnecessary print statement in Validate function

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix code for rebase

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: remove unused GitPasswordAuth configuration

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* feat: add password decoding for password in includePasswordRemote function

Signed-off-by: sZma5a <[email protected]>

* fix: refactor Git password authentication method

Signed-off-by: sZma5a <[email protected]>

* fix: update password encoding in TestCloneUsingPassword

Signed-off-by: sZma5a <[email protected]>

* Update docs/content/en/docs-dev/user-guide/managing-piped/configuration-reference.md

Co-authored-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Update pkg/config/piped.go

Co-authored-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* [wip] delete password

Signed-off-by: sZma5a <[email protected]>

* [wip] not tested - change token to args from url

Signed-off-by: sZma5a <[email protected]>

* Fix commented out test case

Signed-off-by: sZma5a <[email protected]>

* Refactor authentication in git client

Signed-off-by: sZma5a <[email protected]>

* feat: add password decoding function and replace Password string

Signed-off-by: sZma5a <[email protected]>

---------

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Co-authored-by: sZma5a <[email protected]>
Co-authored-by: sivchari <[email protected]>
Co-authored-by: 鈴木 優耀 <[email protected]>
Co-authored-by: Your Name <[email protected]>
Co-authored-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: pipecd-bot <[email protected]>
@github-actions github-actions bot mentioned this pull request Sep 5, 2024
github-actions bot pushed a commit that referenced this pull request Sep 5, 2024
* fix to read PAT settings from file

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* piped

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* include  PAT information in URL

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: modification of conditional branching

Co-authored-by: sivchari <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: corrected error in error message

Co-authored-by: sivchari <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: integration of mask function

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: make validation test

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: function name

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: rename function for validation PAT

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix test code as pointed out in the review

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* feat: add explan
for git personal access token in document

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: change required in documentation

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: change return value

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: add test case

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix test

Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: PipedGit struct to use password
authentication instead of personal access token

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix to read PAT settings from file

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* piped

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: integration of mask function

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: make validation test

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: function name

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: rename function for validation PAT

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix test

Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: PipedGit struct to use password
authentication instead of personal access token

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Fix Git authentication configuration

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Update password authentication configuration

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Fix error variable name

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Fix rename password

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Refactor includePasswordAuthRemote function

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Update password authentication in clone test

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: delete PasswordAuth

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: remove unused PasswordAuth field and refactor password authentication in git client

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Remove unnecessary print statement in Validate function

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix code for rebase

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: remove unused GitPasswordAuth configuration

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* feat: add password decoding for password in includePasswordRemote function

Signed-off-by: sZma5a <[email protected]>

* fix: refactor Git password authentication method

Signed-off-by: sZma5a <[email protected]>

* fix: update password encoding in TestCloneUsingPassword

Signed-off-by: sZma5a <[email protected]>

* Update docs/content/en/docs-dev/user-guide/managing-piped/configuration-reference.md

Co-authored-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Update pkg/config/piped.go

Co-authored-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* [wip] delete password

Signed-off-by: sZma5a <[email protected]>

* [wip] not tested - change token to args from url

Signed-off-by: sZma5a <[email protected]>

* Fix commented out test case

Signed-off-by: sZma5a <[email protected]>

* Refactor authentication in git client

Signed-off-by: sZma5a <[email protected]>

* feat: add password decoding function and replace Password string

Signed-off-by: sZma5a <[email protected]>

---------

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Co-authored-by: sZma5a <[email protected]>
Co-authored-by: sivchari <[email protected]>
Co-authored-by: 鈴木 優耀 <[email protected]>
Co-authored-by: Your Name <[email protected]>
Co-authored-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: pipecd-bot <[email protected]>
ffjlabo added a commit that referenced this pull request Sep 5, 2024
* Modified to use Git with PAT (#4571)

* fix to read PAT settings from file

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* piped

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* include  PAT information in URL

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: modification of conditional branching

Co-authored-by: sivchari <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: corrected error in error message

Co-authored-by: sivchari <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: integration of mask function

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: make validation test

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: function name

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: rename function for validation PAT

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix test code as pointed out in the review

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* feat: add explan
for git personal access token in document

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: change required in documentation

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: change return value

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: add test case

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix test

Signed-off-by: swallow <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: PipedGit struct to use password
authentication instead of personal access token

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix to read PAT settings from file

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* piped

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: integration of mask function

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: make validation test

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: function name

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: rename function for validation PAT

Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix test

Signed-off-by: swallow <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: PipedGit struct to use password
authentication instead of personal access token

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Fix Git authentication configuration

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Update password authentication configuration

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Fix error variable name

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Fix rename password

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Refactor includePasswordAuthRemote function

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Update password authentication in clone test

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: delete PasswordAuth

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: remove unused PasswordAuth field and refactor password authentication in git client

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Remove unnecessary print statement in Validate function

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: fix code for rebase

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* fix: remove unused GitPasswordAuth configuration

Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* feat: add password decoding for password in includePasswordRemote function

Signed-off-by: sZma5a <[email protected]>

* fix: refactor Git password authentication method

Signed-off-by: sZma5a <[email protected]>

* fix: update password encoding in TestCloneUsingPassword

Signed-off-by: sZma5a <[email protected]>

* Update docs/content/en/docs-dev/user-guide/managing-piped/configuration-reference.md

Co-authored-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* Update pkg/config/piped.go

Co-authored-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: sZma5a <[email protected]>

* [wip] delete password

Signed-off-by: sZma5a <[email protected]>

* [wip] not tested - change token to args from url

Signed-off-by: sZma5a <[email protected]>

* Fix commented out test case

Signed-off-by: sZma5a <[email protected]>

* Refactor authentication in git client

Signed-off-by: sZma5a <[email protected]>

* feat: add password decoding function and replace Password string

Signed-off-by: sZma5a <[email protected]>

---------

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Co-authored-by: sZma5a <[email protected]>
Co-authored-by: sivchari <[email protected]>
Co-authored-by: 鈴木 優耀 <[email protected]>
Co-authored-by: Your Name <[email protected]>
Co-authored-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: pipecd-bot <[email protected]>

* Use singleflight to clone/update repository cache (#5171)

Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: pipecd-bot <[email protected]>

* Refactor the git clone (#5190)

Move the authArgs into the singleflight closure, as they are only used within it.

Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: pipecd-bot <[email protected]>

---------

Signed-off-by: sZma5a <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
Signed-off-by: Your Name <[email protected]>
Signed-off-by: sZma5a <[email protected]>
Signed-off-by: swallow <[email protected]>
Signed-off-by: pipecd-bot <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Co-authored-by: sZma5a <[email protected]>
Co-authored-by: sZma5a <[email protected]>
Co-authored-by: sivchari <[email protected]>
Co-authored-by: 鈴木 優耀 <[email protected]>
Co-authored-by: Your Name <[email protected]>
Co-authored-by: Yoshiki Fujikane <[email protected]>
Co-authored-by: Shinnosuke Sawada-Dazai <[email protected]>
@github-actions github-actions bot mentioned this pull request Sep 10, 2024
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.

Add the way to access git repository by using Personal Access Token(PAT)
5 participants