Reg : to find the build is triggered through API.

Arun's Avatar

Arun

23 Aug, 2018 07:36 PM

Hi Team,

Using the curl command (curl -sS --header "Content-type: application/json" "https://ci.appveyor.com//api/projects/accountName/repo") i am able to find , whether a build is a tag push or not by using this variable ("isTag":true,).

Similarly is there a variable to find, whether the build is triggered from an API event (Invoke-Restmethod -uri 'https://ci.appveyor.com/api/builds' -Headers $headersAppveyor -Method POST -Body $body) or not.

  1. Support Staff 1 Posted by Ilya Finkelshte... on 24 Aug, 2018 02:28 AM

    Ilya Finkelshteyn's Avatar

    isTag is not variable, but rather a property of the build object accessible over REST API.

    There are actually few environment variables you may be interested in:

    APPVEYOR_SCHEDULED_BUILD - True if the build runs by scheduler
    APPVEYOR_FORCED_BUILD (True or undefined) - builds started by “New build” button or from the same API
    APPVEYOR_RE_BUILD (True or undefined) - build started by “Re-build commit/PR” button of from the same
    

    However they are not available over UI or REST API after build finished. If you need to see them for completed build, you can add them to the build message, for example at init stage:

    install:
    - ps: Add-AppveyorMessage -Message "APPVEYOR_FORCED_BUILD: $(!!$env:APPVEYOR_FORCED_BUILD)"
    

    After this you can see it in Messages tab for completed build in UI, or with API using the following URL:

    https://ci.appveyor.com/api/buildjobs/<JobId>/messages
    

    JobId you can get from URL you mention above. If you have multiple jobs in build matrix, you can use JobId from the first one.

    This is kind of hack, thogh it should serve your needs. We plan better approach, it is tracked in https://github.com/appveyor/ci/issues/2468.

  2. Ilya Finkelshteyn closed this discussion on 24 Oct, 2018 09:00 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