tag:help.appveyor.com,2012-11-13:/discussions/questions/6204-yml-and-deployment-tab-from-uiAppVeyor: Discussion 2018-08-25T02:19:02Ztag:help.appveyor.com,2012-11-13:Comment/431094722017-07-31T21:17:20Z2017-07-31T21:18:25Zyml and deployment tab from UI<div><p>Hope I understood you correctly. And I assume you are using Azure AppService deployment slots.</p>
<p>I believe that you can achieve this with <a href="https://www.appveyor.com/docs/deployment/environment/#overriding-environment-variables">overriding environment variables</a> feature. Environment variables are one of few settings which are being merged from UI with those set in YAML. Idea is to have single Environment, but provide different site name (and hostname because they are different in case of deployment slot) as environment variables.</p>
<p>So step by step:</p>
<ul>
<li>
<p>create single "master" environment</p>
</li>
<li>
<p>use <em>deployment credentials</em> instead of <em>site credentials</em> (those from publishing profile). Thus you do not have different credentials (and variables) for each slot.</p>
</li>
<li>
<p>add the following variables: <code>siteName</code> and <code>hostName</code>. Note that they are the same for default site, but for slots it is <code>sitename__slotname</code> (2 underscores) and <code>sitename-slotname</code> (single dash) for hostname. Use default values of some non-production site or slot so error to be harmless. Or even non-exiting values.</p>
</li>
<li>
<p>Set up this environment deployment with YAML</p>
</li>
</ul>
<pre>
<code>deploy:
- provider: Environment
name: ilyaf4
siteName: $(siteName)
hostName: $(hostName)</code>
</pre>
<ul>
<li>Add variables: <code>siteName</code> and <code>hostName</code> into UI.</li>
</ul>
<p>Now you can always change slot by altering those variables in the UI, while having build configuration in YAML.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/431094722017-07-31T21:22:36Z2017-07-31T21:22:36Zyml and deployment tab from UI<div><p>Better project UI screenshot</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/431094722017-07-31T22:04:32Z2017-07-31T22:04:32Zyml and deployment tab from UI<div><p>No they are not slots, we are always publishing to test slot (we have test, staging, prod) but our service is in multiple countries (so what I showed in the first screen are test env for each country) so we need to be able to choose to which countries we are going to deploy particular version. So for example we have country A, B ,C, D, E and we should be able to deploy only to countries we want for example A and D.</p></div>Lukasztag:help.appveyor.com,2012-11-13:Comment/431094722017-08-01T00:02:18Z2017-08-01T00:02:18Zyml and deployment tab from UI<div><p>So it is not always 1 of 5 countries, but can be say 2 or 3 of them?</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/431094722017-08-01T01:50:36Z2017-08-01T01:50:36Zyml and deployment tab from UI<div><p>You can do something like this:</p>
<pre>
<code>deploy:
- provider: Environment
name: Env-A
on:
deploy_a: true
- provider: Environment
name: Env-B
on:
deploy_b: true
...
- provider: Environment
name: Env-E
on:
deploy_e: true</code>
</pre>
<p>and manage values for environment variables <code>deploy_a</code>, <code>deploy_b</code>, ... <code>deploy_e</code> with UI.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/431094722017-08-01T07:17:29Z2017-08-01T07:17:31Zyml and deployment tab from UI<div><p>that sound good, and how I'll actually deploy based on this variables?</p></div>Lukasztag:help.appveyor.com,2012-11-13:Comment/431094722017-08-01T14:58:58Z2017-08-01T14:58:58Zyml and deployment tab from UI<div><p>The similar way as you do now. As I understand that now you go and manually set <code>BranchThatDoNotExistWillNotPublishThere</code>. With this configuration you will go to <code>Settings > Environment</code> in UI and set appropriate values for those variables. So you will be able to change what country to deploy with UI, while having rest of build configuration in YAML.</p></div>Ilya Finkelshteyn