programmaticly run build and / or deployment

stevebaker2001's Avatar

stevebaker2001

06 Jun, 2014 08:32 AM

Hi
We are looking at migrating our current CI from teamcity to appveyor
Our standard workflow (commit =>build and test) was nice and easy to setup (after some nuget issues)

we also use the teamcity rest API to kick off custom builds, with a basic process of:
Create aws instance
Kick off teamcity build on given branch and deploy to given ed point using webdeploy

Using appveyor, I cat see anyway to do this? A I missing something, or is it a feature on the roadmap?
If the latter, our use case would be to run a new build specifying:
Branch
Build configuration
End point for webdeploy
Iis path for web deploy

Or in an appveyor world should I change this flow so I get the build on commit process to produce the deployment package and then when we want a custom aws instance just deploy that package ourselves? Or can you add/customise an environment via API and programmatically kick off the deploy of a named artifact?
I guess the first option is similar to the process described here:
http://www.infoq.com/articles/AppVeyor-CI

And a final one, I assume a webdeploy from appveyor will come from an ip anywhere in the azure pool? Just thinking ahead to possible firewall issues if the web deploy port is blocked by default?

Hope that all makes sense
Cheers
Steve

  1. 1 Posted by stevebaker2001 on 06 Jun, 2014 09:17 AM

    stevebaker2001's Avatar

    sorry - just saw the answer here: http://help.appveyor.com/discussions/questions/305-trigger-a-build

    so thats great - though the docs only talk about Teams - no mention I could see of builds. Good to know we can effectively discover the api using chrome tools though.

    For the build api, what parameters can be passed? branch ticks one of ours, but can you do build config? or any environment variables?

  2. Support Staff 2 Posted by Feodor Fitsner on 06 Jun, 2014 05:33 PM

    Feodor Fitsner's Avatar

    To do a build with custom config you should take create project -> update project -> run build -> update project -> run build -> ....

    Though I see it might be interesting to have API method to start a new build with YAML configuration as another parameter ;)

    I will publish docs for Projects and Builds APIs today.

  3. 3 Posted by stevebaker2001 on 06 Jun, 2014 05:45 PM

    stevebaker2001's Avatar

    Or just allow environment vars to be overwritten/set? Ie
    Build{
    Environment:{
    Configuration:release,
    AnotherVar:test
    }
    }

  4. Support Staff 4 Posted by Feodor Fitsner on 06 Jun, 2014 06:46 PM

    Feodor Fitsner's Avatar

    Sounds nice too.

  5. 5 Posted by stevebaker2001 on 09 Jun, 2014 09:43 AM

    stevebaker2001's Avatar

    in the meantime - is there an api we can use to list / get artifacts?
    or to modify and push to an environment?
    My thinking is:
    Option 1: run web deploy locally (similar to the infoq article)
    run build on branch XXX -> list artifacts -> pull artifact locally -> run web deploy Option 2: use a "temp" environment
    run build -> modify TEMP environment endpoint -> push to environment

    my pref would be option #2

    on the ideas above, do you track any of this stuff in public (uservoice etc) or is it all on a Magic List (a la github et al)?

  6. Support Staff 6 Posted by Feodor Fitsner on 09 Jun, 2014 05:03 PM

    Feodor Fitsner's Avatar

    Yes, you can modify environment settings using API. What deployment provider do you use?

  7. 7 Posted by stevebaker2001 on 10 Jun, 2014 03:03 PM

    stevebaker2001's Avatar

    we use web deploy - so think this will all work, one of the guys is running through the steps now

  8. Support Staff 8 Posted by Feodor Fitsner on 10 Jun, 2014 04:25 PM

    Feodor Fitsner's Avatar

    OK, let me know about the results.

  9. 9 Posted by petrikvandervel... on 13 Jun, 2014 05:04 AM

    petrikvandervelde's Avatar

    Has the documentation for Projects and Builds been published anywhere yet? I couldn't find it on the website but I may well have missed it.

  10. Support Staff 10 Posted by Feodor Fitsner on 13 Jun, 2014 05:05 AM

    Feodor Fitsner's Avatar

    REST API?

  11. 11 Posted by petrikvandervel... on 13 Jun, 2014 05:09 AM

    petrikvandervelde's Avatar

    To be honest, anyway I can get information about a project while executing powershell code prior to a build. So either REST API or via the AppVeyor console application or ... However I'm assuming that you meant the REST API in message #3 in this thread.

  12. Support Staff 12 Posted by Feodor Fitsner on 13 Jun, 2014 05:47 AM

    Feodor Fitsner's Avatar

    Yeah, I meant docs for the rest of REST API :)

  13. 13 Posted by JP on 04 Jul, 2014 04:01 PM

    JP's Avatar

    Hey Feodor,

    Have hit a dead end on our programmatic REST API implementation.

    I tried setting the branch to build as a property in the request body of the /builds POST, but it was always building using the one specified in the Project settings.

    So then I started looking at changing that first via a /projects POST. I'm getting an invalid request because ["The RepositoryProvider field is required."], but if I watch the same call in Chrome Dev Tools that property isn't in the payload...

    What are the valid RepositoryProvider values? (We're using GitHub)

  14. Support Staff 14 Posted by Feodor Fitsner on 05 Jul, 2014 04:22 AM

    Feodor Fitsner's Avatar

    POST to /projects means creating a new project. RepositoryProvider can be gitHub, bitBucket, vso and kiln (all camelCase).

    Most probably you should look into PUT /projects which means "update". Though its payload is quite huge at the moment.

  15. 15 Posted by stevebaker2001 on 05 Jul, 2014 09:33 AM

    stevebaker2001's Avatar

    For put, do you have to send the full payload, or can we just send the
    properties we want to update?

  16. Support Staff 16 Posted by Feodor Fitsner on 05 Jul, 2014 10:01 AM

    Feodor Fitsner's Avatar

    Yeah, it's full payload right now, sorry.

  17. 17 Posted by stevebaker2001 on 05 Jul, 2014 11:04 AM

    stevebaker2001's Avatar

    OK. Guess we just run a get, change, then put. Will give that a whirl next
    week

  18. 18 Posted by JP on 09 Jul, 2014 10:53 AM

    JP's Avatar

    Hey Feodor,

    GET --> change --> PUT isn't working for us.. (Using full payload although we're only changing repositoryBranch)

    Any chance you could publish the docs for Projects and Builds?

    Thanks!

  19. Support Staff 19 Posted by Feodor Fitsner on 09 Jul, 2014 11:28 AM

    Feodor Fitsner's Avatar

    If we add "branch" support to POST /builds payload - would it solve the problem?

  20. 20 Posted by JP on 09 Jul, 2014 11:32 AM

    JP's Avatar

    Well I thought it was already in there (http://help.appveyor.com/discussions/questions/305-trigger-a-build) but it wasn't working for me, and that's why I was asking after the docs..

    That would absolutely solve the issue though, yeah :)

  21. Support Staff 21 Posted by Feodor Fitsner on 09 Jul, 2014 11:35 AM

    Feodor Fitsner's Avatar

    That was my fault. There is "branch" in request, but it's not used yet.

    I'll fix that.

  22. 22 Posted by JP on 09 Jul, 2014 12:00 PM

    JP's Avatar

    Ahhh fantastic! Thank you so much for your support! :)

  23. Support Staff 23 Posted by Feodor Fitsner on 14 Jul, 2014 11:47 AM

    Feodor Fitsner's Avatar

    AppVeyor update has been deployed supporting branch parameter in POST /builds request. Give it a try and let me know how it goes.

  24. 24 Posted by JP on 14 Jul, 2014 02:02 PM

    JP's Avatar

    That's perfect. Thanks very much!

  25. 25 Posted by JP on 14 Jul, 2014 04:41 PM

    JP's Avatar

    Would it be possible to get something similar -- a server parameter in POST /deployments request?

  26. Support Staff 26 Posted by Feodor Fitsner on 14 Jul, 2014 05:00 PM

    Feodor Fitsner's Avatar

    Will see if this could be easily added.

  27. 27 Posted by JP on 14 Jul, 2014 05:05 PM

    JP's Avatar

    Our situation is multiple servers in an "environment" farm. So ideal could be environmentId (which we have already) and server? :)

  28. 28 Posted by JP on 18 Jul, 2014 01:52 PM

    JP's Avatar

    Hey Feodor,

    I've been trying to update the `server` for an Environment using PUT, but for some reason even if I copy and paste the exact same payload from the request sent by the UI, I only ever seem to get "Object reference not set to an instance of an object." back.

    What am I doing wrong?

    `$.ajax({type: "PUT", url: "https://ci.appveyor.com/api/environments", data: {"deploymentEnvironmentId":0000, "environmentAccessKey":"xxxxxxxxxxxxxx", ...}});`

  29. Support Staff 29 Posted by Feodor Fitsner on 18 Jul, 2014 02:33 PM

    Feodor Fitsner's Avatar

    Make sure the request is authenticated? Try using some other tool (Fiddler, Postman, etc.) to send the request and see if it goes through.

  30. 30 Posted by JP on 18 Jul, 2014 02:39 PM

    JP's Avatar

    I'm just using Chrome Dev Tools for now, so won't it already be authenticated thanks to the login cookie? Should I be explicitly passing the accountName and bearerToken in the payload?

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

 

01 Oct, 2024 04:27 PM
26 Sep, 2024 03:49 PM
26 Sep, 2024 09:02 AM
25 Sep, 2024 07:07 PM
24 Sep, 2024 08:39 PM
24 Sep, 2024 06:47 AM