You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-06-03 16:35:37 +02:00
Use Gitlab username (#6653)
This commit is contained in:
+6
-3
@@ -178,18 +178,21 @@ func runExec(ctx context.Context, c *cli.Command, yamls []*builder.YamlFile, rep
|
||||
// configure volumes for local execution
|
||||
volumes := c.StringSlice("volumes")
|
||||
if c.Bool("local") {
|
||||
compilerOpts = append(compilerOpts,
|
||||
compilerOpts = append(
|
||||
compilerOpts,
|
||||
compiler.WithWorkspace(
|
||||
c.String("workspace-base"),
|
||||
c.String("workspace-path"),
|
||||
),
|
||||
)
|
||||
volumes = append(volumes,
|
||||
volumes = append(
|
||||
volumes,
|
||||
prefix+"_default:"+c.String("workspace-base"),
|
||||
repoPath+":"+c.String("workspace-base")+"/"+c.String("workspace-path"),
|
||||
)
|
||||
} else {
|
||||
compilerOpts = append(compilerOpts,
|
||||
compilerOpts = append(
|
||||
compilerOpts,
|
||||
compiler.WithWorkspace(
|
||||
c.String("workspace-base"),
|
||||
c.String("workspace-path"),
|
||||
|
||||
@@ -72,12 +72,14 @@ steps:
|
||||
r.Close()
|
||||
stdout := buf.String()
|
||||
|
||||
assert.Contains(t, stdout,
|
||||
assert.Contains(
|
||||
t, stdout,
|
||||
`[build:L0:0s] StepName: build
|
||||
[build:L1:0s] StepType: commands
|
||||
[build:L2:0s] StepUUID: `,
|
||||
)
|
||||
assert.Contains(t, stdout,
|
||||
assert.Contains(
|
||||
t, stdout,
|
||||
`[build:L3:0s] StepCommands:
|
||||
[build:L4:0s] ------------------
|
||||
[build:L5:0s] echo hello
|
||||
|
||||
@@ -224,7 +224,7 @@ func convertMergeRequestHook(hook *gitlab.MergeEvent, req *http.Request) (mergeI
|
||||
|
||||
author := lastCommit.Author
|
||||
|
||||
pipeline.Author = author.Name
|
||||
pipeline.Author = hook.User.Username
|
||||
pipeline.Email = author.Email
|
||||
|
||||
if len(pipeline.Email) != 0 {
|
||||
@@ -279,11 +279,12 @@ func convertPushHook(hook *gitlab.PushEvent) (*model.Repo, *model.Pipeline, erro
|
||||
pipeline.Branch = strings.TrimPrefix(hook.Ref, "refs/heads/")
|
||||
pipeline.Ref = hook.Ref
|
||||
|
||||
pipeline.Author = hook.UserUsername
|
||||
|
||||
// assume a capacity of 4 changed files per commit
|
||||
files := make([]string, 0, len(hook.Commits)*4)
|
||||
for _, cm := range hook.Commits {
|
||||
if hook.After == cm.ID {
|
||||
pipeline.Author = cm.Author.Name
|
||||
pipeline.Email = cm.Author.Email
|
||||
pipeline.Message = cm.Message
|
||||
pipeline.Timestamp = cm.Timestamp.Unix()
|
||||
@@ -337,10 +338,10 @@ func convertTagHook(hook *gitlab.TagEvent) (*model.Repo, *model.Pipeline, string
|
||||
pipeline.Commit = hook.After
|
||||
pipeline.Branch = refTag
|
||||
pipeline.Ref = hook.Ref
|
||||
pipeline.Author = hook.UserUsername
|
||||
|
||||
for _, cm := range hook.Commits {
|
||||
if hook.After == cm.ID {
|
||||
pipeline.Author = cm.Author.Name
|
||||
pipeline.Email = cm.Author.Email
|
||||
pipeline.Message = cm.Message
|
||||
pipeline.Timestamp = cm.Timestamp.Unix()
|
||||
@@ -394,8 +395,11 @@ func convertReleaseHook(hook *gitlab.ReleaseEvent) (*model.Repo, *model.Pipeline
|
||||
ForgeURL: hook.URL,
|
||||
Message: fmt.Sprintf("created release %s", hook.Name),
|
||||
Sender: hook.Commit.Author.Name,
|
||||
Author: hook.Commit.Author.Name,
|
||||
Email: hook.Commit.Author.Email,
|
||||
// Using the commit author here as Gitlab does not send the hook user.
|
||||
// This is not an issue because releases can be created by users with
|
||||
// push permissions only anyways.
|
||||
Author: hook.Commit.Author.Name,
|
||||
Email: hook.Commit.Author.Email,
|
||||
|
||||
// Tag name here is the ref. We should add the refs/tags, so
|
||||
// it is known it's a tag (git-plugin looks for it)
|
||||
|
||||
Reference in New Issue
Block a user