Custom Version for Pull Requests

jrichardson's Avatar


14 Jun, 2019 06:16 PM

Right now, PRs to master create a new build, which I want, but they use the version settings for master (I use per branch configurations).

Master is considered to always be deployable for CI/CD, and for other branches, we can use the version number as a proxy for this (master builds to v2.0 and other branches to v0.0), so that anything in the v2.0 branch is deployable. We use docker and push built images to an image repo on successful builds, but PR's are getting mixed in the image sequence, so you have to look at AppVeyor to determine which docker images are legitimately from master.

I like the PR integration with GitHub and Bitbucket, because it makes PR's much easier to vet. We can even set up rules where you're not allowed to merge to master unless the last commit successfully built in AppVeyor, which is awesome for CI/CD stability! So I don't want to just turn off the PR builds.

Is there a way to do any of the following:

  • Use a different version (v0.0.{build}) for instance, for PRs to master, but still use v2.0.{build} for the actual commits on master.
  • Detect a PR build during the build and don't upload artifacts/images.
    • Addendum to this, could I prevent the build from a PR be not deployable, but still successful.
  1. 1 Posted by Owen McDonnell on 15 Jun, 2019 03:37 AM

    Owen McDonnell's Avatar

    The much simpler solution to your custom build version problem is to make use of the Pull Requests do not increment build number setting in General tab of project settings. Or if you are using yaml config file the setting is pull_requests.do_not_increment_build_number: true

    As for customizing artifact push based on PR build you could conditionally check for APPVEYOR_PULL_REQUEST_NUMBER environment variable and if it is set, push your artifact.

    And about your last question, PR builds are not deployable by default. In fact, only private repos are allowed to be deployed.

  2. Ilya Finkelshteyn closed this discussion on 15 Aug, 2019 09:01 PM.

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

Keyboard shortcuts


? 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