Is it possible to use a script for an asynchronous deploy
I would like to execute several steps during my deployment process, specifically:
- Deploy my NuGet packages to NuGet.org
- Tag the specific commit from which the artifacts were created with the version number
- Push additional artifacts to the release on GitHub or some other file storage location (e.g. https://bintray.com/)
For this I have deployment scripts (in MsBuild format in my case) available but I see no way of executing those scripts during the deployment step on AppVeyor. Is there a way to achieve this?
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
Support Staff 1 Posted by Feodor Fitsner on 09 Jun, 2014 08:41 PM
Are you looking to do that from Environments page?
- Feodor
2 Posted by petrikvandervel... on 09 Jun, 2014 08:46 PM
yes probably. More specifically I'm looking to do that separately from the actual build process, i.e. I want to build (compile, test, store the artifacts) and then at a later stage deploy the artifacts for a specific build, at which point I want to run the deployment scripts.
Support Staff 3 Posted by Feodor Fitsner on 09 Jun, 2014 09:49 PM
I see. Well, what I would do to make this work is adding another project running the deployment script. This could be the same repo or a separate one with just deployment script. I'd run this project with "New build" button and "build to be deployed" in environment variables.
In deployment script you can use AppVeyor API (not all methods are documented but you can use Fiddler/Chrome dev tools to discover calls UI makes to API) to list/download artifacts (or you can use API to start pre-configured Environment deployment).
For tagging GitHub repo and creating GitHub releases I'd use GitHub API with personal access token.
4 Posted by petrikvandervel... on 13 Jun, 2014 03:13 AM
Ok, I've got this partially set up now. I've got a project (pvandervelde/nbuildkit-244) for the deployment. I've got my deploy script that should be able to deploy to NuGet.org and push releases to GitHub.
I've also managed to get a Powershell script that installs some applications before executing the build. Now the only problem I have is how to discover the API calls I can make.
I have no idea how to get the information about the API calls.
Is there any more substantial documentation / blogs / websites / help forums that you could point me to which could explain to me how to:
I think if I can do that I can complete this work and get a deployment system up and running.
Support Staff 5 Posted by Feodor Fitsner on 13 Jun, 2014 08:15 PM
To get the last build for specific branch you'll have to go through project history until specific branch is found:
Build details contains
status
field that ispassed
orfailed
.To download build artifacts you should take its build job ID and then use this endpoint:
Let me know if you have any questions.
6 Posted by petrikvandervel... on 14 Jun, 2014 12:37 AM
Ok I'm almost there but there's one thing that I don't quite get. To download artifacts I've tried to get the artifacts from this build: https://ci.appveyor.com/project/pvandervelde/nbuildkit/build/0.0.1+...
The website says the URL should be https://ci.appveyor.com/api/buildjobs/a3ku5qmonn7eh94s/artifacts/bu...
However your suggestion is that it is
https://ci.appveyor.com/api/buildjobs/67753/artifacts/vcs.info.txt
Because the build ID of that job is 67753. Now I'm assuming that the first URL is actually the correct one, but I'm not sure how I get the identifier for the build in that case. The call to the history (with GET https://ci.appveyor.com/api/projects/pvandervelde/nbuildkit/history...) doesn't provide me with that information as far as I can tell.
For that specific build I get the following information:
"buildId": 67753, "jobs": [], "buildNumber": 15, "version": "0.0.1+086-15", "message": "Merge pull request #12 from pvandervelde/issue/releasenotefilter", "messageExtended": "Msbuild: Allow users to specify filter for issue tracker when creating release notes", "branch": "master", "commitId": "a38fe4be604f0be897567040cacd212c3e63171b", "authorName": "Petrik van der Velde", "authorUsername": "pvandervelde", "committerName": "Petrik van der Velde", "committerUsername": "pvandervelde", "committed": "2014-06-11T20:19:54+00:00", "messages": [], "status": "success", "started": "2014-06-11T20:23:23.7002906+00:00", "finished": "2014-06-11T20:24:50.9543631+00:00", "created": "2014-06-11T20:19:56.0652287+00:00", "updated": "2014-06-11T20:24:50.9543631+00:00"
Support Staff 7 Posted by Feodor Fitsner on 14 Jun, 2014 12:49 AM
Use GET api/projects/{accountName}/{projectSlug}/build/{buildVersion} to get build full details including jobs.
- Feodor
8 Posted by petrikvandervel... on 14 Jun, 2014 02:09 AM
Sweet that worked. If you are interested I wrote a powershell script for this which you can find (and use) in the src/ps directory here: https://github.com/pvandervelde/Scripts. It's the appveyor-download-artifacts script.
Thanks for all your help!
9 Posted by petrikvandervel... on 14 Jun, 2014 05:28 AM
Also for all of those who are interested I've managed to set up all of it now and it seems to work. Check out https://ci.appveyor.com/project/pvandervelde/nbuildkit-244 for the working example.
Thanks Feodor for all your assistence :)
petrikvandervelde closed this discussion on 15 Jun, 2014 11:49 PM.