{branch} in version is always "master" for merge requests

eduard.braun2's Avatar

eduard.braun2

05 Oct, 2018 10:58 PM

In https://ci.appveyor.com/project/inkscape/inkscape/ I have specified version like
"version: '{branch}-{build}'"

This worked well so far and allowed to differentiate branches, however with the added support for GitLab merge requests {branch} will always be the name of the target branch, not the source branch.

What's the rationale behind using the target branch name and is there a way to include the name of the source branch instead?

  1. Support Staff 1 Posted by Ilya Finkelshte... on 06 Oct, 2018 01:41 AM

    Ilya Finkelshteyn's Avatar

    We have a whole bunch of PR-related variables:

    APPVEYOR_PULL_REQUEST_NUMBER
    APPVEYOR_PULL_REQUEST_TITLE
    APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME
    APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
    APPVEYOR_PULL_REQUEST_HEAD_COMMIT
    

    They are documented here, we need to remove GitHub only part from doc.

  2. 2 Posted by eduard.braun2 on 06 Oct, 2018 11:50 AM

    eduard.braun2's Avatar

    Oh, so I can use general environment variables in "version" field for a build now?

    Past support material I found suggested only two special variables ({branch} and {build}) were allowed here.

  3. Support Staff 3 Posted by Ilya Finkelshte... on 08 Oct, 2018 07:37 PM

    Ilya Finkelshteyn's Avatar

    Yes, those are special "shortcut" variables. But you can add other variables with standard variable syntax, e.g. $(APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH).

    However I believe that in your case you need to conditionally use main branch for push builds and head branch for MR builds. For that you can update build from command line and use APPVEYOR_REPO_BRANCH for push builds (simple condition is that APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH is empty string).

    By the way I feel good proposing this now as side effects described here will not happen no more :)

  4. Ilya Finkelshteyn closed this discussion on 08 Oct, 2018 07:37 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac