Environment variable for user who triggered build

Issue #14006 open
Matej Vitásek created an issue

These are the environment variables we can use now: https://confluence.atlassian.com/bitbucket/environment-variables-794502608.html

I'd also like to have access to the person who triggered the Pipeline, either the Git user who committed/pushed the changes, or the Bitbucket user who manually triggered the Pipeline.

Ideally this would be provided in the format Full name <email@address.com>, similar to Git.

Original request

This ticket also requested the Git commit short hash, but that is easily retrievable either via git directly (git log --format=%h -n1) or by trimming down the BITBUCKET_COMMIT env var (echo $BITBUCKET_COMMIT | cut -c1-7).

Comments (10)

  1. Joshua Tjhin Account Deactivated

    Thanks Matej for the suggestion.

    For the pipeline triggerer, what would be useful to you? The bitbucket username, email, full name etc..?

    For the short commit hash, you could use:

  2. Matej Vitásek reporter

    Hey Joshua, those are good points. Regarding the triggerer, I guess each of the three would work well. Perhaps something like Full Name &lt;mail@org.com&gt; would be nice - we'd be able to parse out one or the other if necessary.

    (Sorry about the angle brackets, can't seem to be able to escape them properly.)

  3. Matt Ryall

    Thanks for the feedback, Matej.

    We're curious what you need the build triggerer info for? We'd like to understand your overall use case here.

  4. Matej Vitásek reporter

    Hey Matt, we migrated to Pipelines from Jenkins. The use case is the Slack notification - we'd see who triggered the build, like in the screenshot. Screen Shot 2017-03-30 at 06.24.48.png

  5. Log in to comment