feat: add remote trigger token support for Jenkins job execution

- Add support for passing a remote trigger token to Jenkins jobs
- Update the Jenkins constructor to accept a token parameter
- Ensure the token is included as a query parameter when triggering jobs
- Improve error reporting by including response body in error messages
- Remove unnecessary logging and refactor build parameter logic
- Update tests to use the new Jenkins constructor and token handling
- Add CLI option for specifying a remote trigger token
- Extend plugin configuration to support remote token injection

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2025-12-01 17:16:39 +08:00
parent a5469c939e
commit 3dd86f956c
4 changed files with 55 additions and 30 deletions
+8 -7
View File
@@ -10,12 +10,13 @@ import (
type (
// Plugin values.
Plugin struct {
BaseURL string
Username string
Token string
Job []string
Insecure bool
Parameters []string
BaseURL string
Username string
Token string
RemoteToken string
Job []string
Insecure bool
Parameters []string
}
)
@@ -50,7 +51,7 @@ func (p Plugin) Exec() error {
Token: p.Token,
}
jenkins := NewJenkins(auth, p.BaseURL, p.Insecure)
jenkins := NewJenkins(auth, p.BaseURL, p.RemoteToken, p.Insecure)
params := url.Values{}
for _, v := range p.Parameters {