Save environment variables after build and set them again when deploying that specific build
This would be a helpful feature so manual deployments work as well as automated deployments. The build process sets some important environment variables that normally carry over to the deploy process. Currently I cannot use manual deploy with an AppVeyor Agent unless I set the proper variables on the environment settings page. Some of these variables include $env:APPLICATION_SITE_NAME which is set with $env:website_name in the appveyor.yml file. Another variable named website_env varies between builds and becomes part of the web address making it critical for proper deployment.
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
1 Posted by Owen McDonnell on 26 Jul, 2019 10:17 PM
Sorry for the delay in getting back to you. We were running a few workaround experiments.
Can you share some more details about your deployment approach. Do you deploy different builds from the same project or are different projects using the same deployment environment? Also, to what kind of server are you deploying?
2 Posted by jeremiah on 26 Jul, 2019 10:58 PM
We have multiple projects deploying to the same environment, which is a Windows 2012 server running IIS for internal testing. When deployment has failed due to problems on the server, or perhaps it succeeded and we have since made changes on the server and we want to try it again, we'd like an easy way to redo the deployment exactly as it was done the first time.
Basically saving all the environment variables that exist after a build and setting them again on deploy would solve the problem. Each specific build would have it's own set of saved environment variables. The deploy process could read these from a file or database and set them before starting the deployment.
3 Posted by Owen McDonnell on 29 Jul, 2019 02:54 PM
I see.
What you could do is set something like the following in the
install:
stage of your build,and then, make sure you specify that artifact.
And finally, include a
before-deploy.ps1
file in your zipped project artifact with something like the following...Does it make sense?
4 Posted by jeremiah on 29 Jul, 2019 05:54 PM
That makes sense, but what about variables set in the AppVeyor Agent settings such as deploy_website and hostname? We set these dynamically with environment variables such as $(websitezip_hostname). I think the environment variables need to be set before the deployment agent starts running?
5 Posted by Owen McDonnell on 29 Jul, 2019 09:36 PM
Sure, if you need them to be set on the target server, you can put them in the file as well, otherwise they are used for deployment purposes only.
6 Posted by jeremiah on 12 Aug, 2019 09:55 PM
I think we are talking about different things. I want to save the AppVeyor agent deployment settings that were set at build time as seen above, which uses evaluations like $(websitezip_site_name) to set "site_name". Is there any way to save the appveyor agent settings that were set for that particular build and reuse them if a manual deploy is performed?
7 Posted by Owen McDonnell on 14 Aug, 2019 06:20 PM
I'm not sure if you specifically mean the web UI by manual deploy, but you could use the json file as a basis for scripting an api call which passes along those variables.
Ilya Finkelshteyn closed this discussion on 14 Oct, 2019 09:01 PM.