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

Environment Variable CI_COMMIT_AUTHOR_EMAIL is wrong #2971

Open
5 tasks done
philipkozeny opened this issue Dec 19, 2023 · 6 comments · May be fixed by #4626
Open
5 tasks done

Environment Variable CI_COMMIT_AUTHOR_EMAIL is wrong #2971

philipkozeny opened this issue Dec 19, 2023 · 6 comments · May be fixed by #4626
Labels
bug Something isn't working

Comments

@philipkozeny
Copy link

Component

server, agent

Describe the bug

I am running Gitea with Woodpecker CI. I have noticed that for some time now, the built in CI_COMMIT_AUTHOR_EMAIL environment variable is wrong. I have setup a sample project, with nothing more than a simple pipeline.

Here is the git log from the CLI:

commit 3d6d4085e41d1a044a67c15ddb99a7ea4746ded7 (HEAD -> main, origin/main, origin/HEAD)
Author: Philip Kozeny <[email protected]>
Date:   Tue Dec 19 10:32:26 2023 +0000

    Update .woodpecker.yml

Here is the woodpecker.yml

steps:
  build:
    image: alpine:edge
    commands:
      - echo $CI_COMMIT_AUTHOR
      - echo $CI_COMMIT_AUTHOR_EMAIL

Here is the output after running the pipeline:

+ echo $CI_COMMIT_AUTHOR
philip.kozeny
+ echo $CI_COMMIT_AUTHOR_EMAIL
[email protected]

System Info

{"source":"https://github.com/woodpecker-ci/woodpecker","version":"2.0.0"}
Powered by Gitea Version: 1.21.2

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Checked that the bug isn't fixed in the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
  • Check that this is a concrete bug. For Q&A join our Discord Chat Server or the Matrix room.
@philipkozeny philipkozeny added the bug Something isn't working label Dec 19, 2023
@philipkozeny
Copy link
Author

I have further investigated the issue and I can see that in the web hook gitea sends something strange.

For the commits, head_commit, etc. the info is correct, the pusher data has the wrong mail though. So this might be an Gitea issue.

Example of the payload:

{
  "ref": "refs/heads/main",
  "before": "a930081ca449a21d4416bdeb345bc4d3181b916e",
  "after": "3d6d4085e41d1a044a67c15ddb99a7ea4746ded7",
  "compare_url": "xxxx/compare/a930081ca449a21d4416bdeb345bc4d3181b916e...3d6d4085e41d1a044a67c15ddb99a7ea4746ded7",
  "commits": [
    {
      "id": "3d6d4085e41d1a044a67c15ddb99a7ea4746ded7",
      "message": "Update .woodpecker.yml\n",
      "url": "xxxx/commit/3d6d4085e41d1a044a67c15ddb99a7ea4746ded7",
      "author": {
        "name": "Philip Kozeny",
        "email": "[email protected]",
        "username": "philip.kozeny"
      },
      "committer": {
        "name": "Philip Kozeny",
        "email": "[email protected]",
        "username": "philip.kozeny"
      },
      "verification": null,
      "timestamp": "2023-12-19T10:32:26Z",
      "added": [],
      "removed": [],
      "modified": [
        ".woodpecker.yml"
      ]
    }
  ],
  "total_commits": 1,
  "head_commit": {
    "id": "3d6d4085e41d1a044a67c15ddb99a7ea4746ded7",
    "message": "Update .woodpecker.yml\n",
    "url": "xxx/commit/3d6d4085e41d1a044a67c15ddb99a7ea4746ded7",
    "author": {
      "name": "Philip Kozeny",
      "email": "[email protected]",
      "username": "philip.kozeny"
    },
    "committer": {
      "name": "Philip Kozeny",
      "email": "[email protected]",
      "username": "philip.kozeny"
    },
    "verification": null,
    "timestamp": "2023-12-19T10:32:26Z",
    "added": [],
    "removed": [],
    "modified": [
      ".woodpecker.yml"
    ]
  },
...
  "pusher": {
    "id": 1,
    "login": "philip.kozeny",
    "login_name": "",
    "full_name": "Philip Kozeny",
    "email": "[email protected]",
    ...
  },
  "sender": {
    "id": 1,
    "login": "philip.kozeny",
    "login_name": "",
    "full_name": "Philip Kozeny",
    "email": "[email protected]",
    ...
    "username": "philip.kozeny"
  }
}

@wxiaoguang
Copy link

wxiaoguang commented Dec 19, 2023

IIRC:

  • commiter email: the email in your git commit
  • pusher email: the user email of the Gitea user

More context: go-gitea/gitea#28532

@philipkozeny
Copy link
Author

IIRC:

  • commiter email: the email in your git commit
  • pusher email: the user email of the Gitea user

More context: go-gitea/gitea#28532

For Woodpecker wouldn't it make more sense to set environment variables like CI_COMMIT_AUTHOR_... to the author of the commit, not the user who did the push?

@dnno
Copy link

dnno commented Nov 21, 2024

This is also happening to me. Is there some updates on this or reasons why the CI_COMMIT_AUTHOR_... variables should not contain the actual commiter's data?

@pat-s
Copy link
Contributor

pat-s commented Nov 23, 2024

Likely a bug on the first look. Contributions welcome.

@whysthatso
Copy link

i'm seeing this with a mirrored repo (gitlab pushing to forgejo) where the data is set according to the user used by gitlab to authenticate against forgejo (a bot account on forgejo i've created for this purpose) rather than the expected data of the committer.

@qwerty287 qwerty287 linked a pull request Jan 6, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants