Is there a way to use environment variables for url and branch for materials in GOCD

42 views Asked by At

Background: the release branch changes every time when we do a release, e.g. the release branch name like release-100, release-101 ....

In my release pipeline, I want to make the branch attribute an environment for material, so we can use the trigger with options to edit this value dynamically. But I found it doesn't work with the following config:

"environment_variables": [
    {
      "name": "BRANCH",
      "value": "release-101"
    }
]
...
"materials": [
    {
      "url": "git_repo.git",
      "branch": "${BRANCH}",  # not work, and also #{BRANCH}
      "shallow_clone": false,
      "filter": {
        "ignore": [],
        "whitelist": []
      },
      "destination": "ansible-deploy",
      "auto_update": true,
      "type": "git",
      "name": "ansible-deploy"
    }
 ]

someone knows whether this is possible? Thanks.

BTW: you may advise to edit the material revision number when using trigger pipeline with options, but since the release branch will not contain commits after it's cut off, the GOCD can not found the revisions neither.

0

There are 0 answers