I can think of the following two ways to do this:

   1. If you're using the "Git" material in your pipeline, you already know
   the branch your pipeline is building. You can extract that branch value as
   a parameter in the pipeline, so you can use it on the material and also as
   an argument to the script that builds the docker image or even as a custom
   environment variable in the pipeline.
   2. Or if you prefer to make your script work as expected outside of GoCD
   too, you can try the command as specified on this SO answer
   <https://stackoverflow.com/a/12142066/1058334>. I tested that command
   locally and it works.



On Tue, Mar 5, 2019 at 8:38 PM Dmytro Tolkodubov <[email protected]> wrote:

> Hi all,
> I am have looked trough the list of current env vars supported by the
> gocd: https://docs.gocd.org/current/faq/environment_variables.html but
> did not find any env var representing the current git branch pipeline has
> been run against. Does that env var exist? If it does not, is there any
> other option to reference the current git branch? We want to reference the
> branch name in the outcome docker image tag.
>
> Thanks in advance for your answer,
>
> BR,
> Dima
>
> --
> You received this message because you are subscribed to the Google Groups
> "go-cd" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Ashwanth Kumar / ashwanthkumar.in

-- 
You received this message because you are subscribed to the Google Groups 
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to