Preventing master CI run when a commit a made on a feature branch

akshay's Avatar

akshay

29 Jun, 2017 07:59 PM

Currently, when I push a commit to a feature branch (linked to a Github PR), appveyor triggers two builds – one for the commit on the PR, and another one for the commit against master. How do I prevent the latter?

My appveyor.yml doesn't specificy this, since I want the feature branches to build.

branches:
  only:
    - master

Thanks

  1. Support Staff 1 Posted by Ilya Finkelshte... on 29 Jun, 2017 08:41 PM

    Ilya Finkelshteyn's Avatar

    Could you please elaborate scenario a little bit? My understanding is the following:

    • You created initial PR
      • Both feature and master branch builds triggered and this is OK
    • You created another commit to the same feature branch
      • Both feature and master branch builds triggered but this time you what it happen only in feature branch

    Is my understanding correct?

  2. 2 Posted by akshay on 29 Jun, 2017 08:53 PM

    akshay's Avatar

    So say I have a branch X. I push a commit to that branch X. I want only that branch X to build, not master. In case a PR has been created for that branch I want it to behave in the same way (i.e. only branch X should build).

    When this PR gets merged into master, only then master should build.

    How do I do this?

  3. Support Staff 3 Posted by Ilya Finkelshte... on 30 Jun, 2017 06:54 PM

    Ilya Finkelshteyn's Avatar

    OK, now I understand. We have opposite feature, option to set Do not build feature branches with open Pull Requests. We might think of implementing something like *Do not build virtual merge on *, can you please provide some business justification, in what scenario you do not need virtual merge?

    As workaround we can propose to edit YAML only in feature branch to have

    branches:
      only:
        - <feature_branch>
    
    and then revert this change before merge. Changes in YAML themselves can be done with [skip ci] or [ci skip] anywhere to commit message, to avoid triggering unneeded builds. I admin that this is not most elegant solution though...

    Ilya.

  4. 4 Posted by akshay on 30 Jun, 2017 07:13 PM

    akshay's Avatar

    Our test phase is a heavy weight and un-conventional. It tests the building
    of images etc. We use the GH PR feature which checks that the PR must
    update with the master before the merge can happen. This ensures the PR is
    update with master before a merge, and that a corresponding CI run against
    the latest master has happened. So, we would like the flexibility to not
    run the virtual merges on every commit on a feature branch, and instead
    rely on the CI run triggered by the commit of master merging into the
    feature branch.

  5. Support Staff 5 Posted by Ilya Finkelshte... on 01 Jul, 2017 12:54 AM

    Ilya Finkelshteyn's Avatar

    Do you need this for clean build history, or to free up number of parallel jobs? If later, you can also call one of exit commands at init stage if APPVEYOR_REPO_BRANCH is master and APPVEYOR_PULL_REQUEST_NUMBER is not NULL (or DEFINED if you use CMD). Job will be stopped immediately, though some time will be still lost on job/VM creation.
    In any case I created GH issue to track this feature request.

  6. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:18 AM.

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