Karolis, As Aravind pointed out earlier in this thread, you can't use Environment variables <https://support.thoughtworks.com/hc/en-us/articles/213253966-Parameters-and-Environment-Variables> for Git Branch expansion, instead you should be using Parameters <https://docs.gocd.io/current/configuration/admin_use_parameters_in_configuration.html> .
Reading through the thread, if you're having fixed number of branches that you want to track progress and make it flow through your CD workflow, consider using templates <https://docs.gocd.io/current/configuration/pipeline_templates.html> and multiple pipelines. Instead if you just want to build different branches (aka feature branches) against the repo, consider using the Git Feature Branch plugin <https://github.com/ashwanthkumar/gocd-build-github-pull-requests#get-started> or Github Pull Requests plugin if you're based out of Github. The former plugin would build for any branches in a git repo, while the latter builds only Pull Requests sent on Github. HTH PS: I'm the co-author of the above plugins. On Tue, Apr 4, 2017 at 3:59 PM, Karolis Blaževičius <[email protected]> wrote: > Same problem here! > > > On Tuesday, April 15, 2014 at 1:38:27 AM UTC+3, [email protected] wrote: >> >> Hello folks: >> >> I am trying to allow Go users to specify a git branch when they use the >> "Trigger with options" feature of GUI, or use the PIPELINE API to launch a >> pipe. Unfrotunately my atempts have not yet succeeded. >> >> I created an environmental variable GIT_BRANCH and put ${GIT_BRANCH} in >> the "Branch" text box that is on the "Edit Material - Git" page. >> When I try to run the pipeline via the GUI, a red failure notice came up >> in the lower left hand corner of the screen, and when I selected this >> notice received a pop up box that read >> >> Modification check failed for material: URL: >> http://path/to/repository.git, Branch: ${GIT_BRANCH} [Apr-14 14:49:17] >> ERROR: fatal: ambiguous argument 'origin/${GIT_BRANCH}': unknown revision >> or path not in the working tree. ERROR: Use '--' to separate paths from >> revisions >> >> Except that the actual URL different. >> >> In the "Basic Settings" page of a pipline the default "Label Template" >> is set to >> >> >> ${COUNT} >> >> >> Since an evniomental variable is used to set to specify a template, it >> seemed reasonable to attempt to use an envrionmental variable to specify a >> branch. >> >> I also tried using ${env.GIT_BRANCH}, ${go.GIT_BRANCH} and $GIT_BRANCH as >> well, and each time the paramter is not treated as a parameter (not >> expanded). >> >> I removed the attempt to set the branch, and added a job that executed >> /usr/bin/env, ran the pipeline and in the console ouptut contqained both >> >> >> [go] setting environment variable 'GIT_BRANCH' to value 'develop' >> >> and >> >> GIT_BRANCH=develop >> >> Thus the paramter is being set. >> >> I was able to use a parameter to specify a gt branch, but I assume that >> a parameter's value is not meant to be overwitten.when a pipeline is >> started. >> >> >> I am using Ubuntu linux, release 3.11.0-19-generic. >> >> Has anybody else been able to use a variable to specify a branch? If so, >> were you succesful, and what operating system where you using? >> >> Thank you >> >> Steven Widom >> [email protected] <https://profiles.google.com/?hl=en&tab=gX> >> >> P.S. I am speaking for myself, not my employer. >> >> >> > -- > 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.
