How can I add commit ID to build version?

lsmgeb89's Avatar


23 Aug, 2015 03:59 PM

I want to add commit ID to my build version.
I changed the first line of appveyor.yml like below.
version: 0.0.1_%APPVEYOR_REPO_COMMIT%

Now a project is being built and the CONSOLE is showing nothing.
I think something maybe hang due to the wrong format of version.
I want to cancel this build but it doesn't response to me.

So what is the correct format of version to add commit id?
And please help me to cancel the build!!!

Update: now this build is stopped after running nearly 40 minutes.

  1. Support Staff 1 Posted by Feodor Fitsner on 23 Aug, 2015 04:37 PM

    Feodor Fitsner's Avatar

    It won't be expanded like that. There could only two variables within version format: {build} and {branch}.

    If you want to add commit id to a build version you can do that using this API. With a little PS script like that:

    - ps: Update-AppveyorBuild -Version "0.0.$env:appveyor_build_number-$($env:appveyor_repo_commit.substring(0,7))"
  2. 2 Posted by lsmgeb89 on 23 Aug, 2015 04:55 PM

    lsmgeb89's Avatar

    Thank you for your solution and quick reply.
    Another question:
    Can I delete a failure build record in the project history?

  3. Support Staff 3 Posted by Feodor Fitsner on 23 Aug, 2015 04:56 PM

    Feodor Fitsner's Avatar

    Nope, it can't be deleted.

  4. 4 Posted by lsmgeb89 on 23 Aug, 2015 05:06 PM

    lsmgeb89's Avatar

    OK, thx, I want to return something related to my first question.
    How can I refer updated build version in the cmdlet or powershell after adding init script in the init part?
    I use %APPVEYOR_BUILD_VERSION% in the cmd, but it remains the old version number.

  5. Support Staff 5 Posted by Feodor Fitsner on 23 Aug, 2015 05:42 PM

    Feodor Fitsner's Avatar

    It depends on how/when you change build version.

    I've just tested here and it worked:

    Build results:

  6. 6 Posted by lsmgeb89 on 24 Aug, 2015 03:01 AM

    lsmgeb89's Avatar

    After checking my yml file, I have found my problem.
    I restart machine after changing build version.
    So Changing it after restarting machine solved the problem.

    Thank you for your all great help.

  7. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:59 AM.

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