Trying to update an App.config value based on a Jenkins parameterized build selection










0















So, like the title suggests, I've got a jenkins build / job that I'm wanting to parameterize with different options for the different environments that it could be executed against (dev, qa, cert, stage, prod, etc.). The 2nd part of what I'm wanting to accomplish is based on what the user selects from the environment dropdown (dev, qa, cert, etc.) it would then update the App.config file with that environment value so the same automation job could be ran in multiple environments for multiple deployment validations.



This is my first shot at creating my parameterized list:
enter image description here



And then, based on what option is selected, I would want to update the environment value in App.config with the selected value.



Here is what the App.config looks like (just basic xml):



<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="Environment" value="QA" />
<!--DEV is default value -->
<!--
DRIVER Parameters for installed web browsers
C = Chrome
CH = Headless Chrome
F = Firefox
E = Microsoft Edge
IE = Internet Ex
-->
<add key="Browser" value="C" />
</appSettings>
</configuration>


I was playing around with some of the different options that jenkins provides for parameterized builds and reading some tutorials but nothing that directly answered my question. A lot of what I was finding was based around CI/CD and builds triggering other builds in different environments.



Any help is always appreciated. Thanks!










share|improve this question






















  • It is easy if you use a pipeline script. Is that an option for you?

    – Michael
    Nov 13 '18 at 20:58











  • I'm not sure what a pipeline script is so it's hard for me to say one way or another.

    – user1818298
    Nov 14 '18 at 13:03











  • Here's some info about Jenkins Pipeline as Code jenkins.io/solutions/pipeline

    – Michael
    Nov 14 '18 at 13:09















0















So, like the title suggests, I've got a jenkins build / job that I'm wanting to parameterize with different options for the different environments that it could be executed against (dev, qa, cert, stage, prod, etc.). The 2nd part of what I'm wanting to accomplish is based on what the user selects from the environment dropdown (dev, qa, cert, etc.) it would then update the App.config file with that environment value so the same automation job could be ran in multiple environments for multiple deployment validations.



This is my first shot at creating my parameterized list:
enter image description here



And then, based on what option is selected, I would want to update the environment value in App.config with the selected value.



Here is what the App.config looks like (just basic xml):



<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="Environment" value="QA" />
<!--DEV is default value -->
<!--
DRIVER Parameters for installed web browsers
C = Chrome
CH = Headless Chrome
F = Firefox
E = Microsoft Edge
IE = Internet Ex
-->
<add key="Browser" value="C" />
</appSettings>
</configuration>


I was playing around with some of the different options that jenkins provides for parameterized builds and reading some tutorials but nothing that directly answered my question. A lot of what I was finding was based around CI/CD and builds triggering other builds in different environments.



Any help is always appreciated. Thanks!










share|improve this question






















  • It is easy if you use a pipeline script. Is that an option for you?

    – Michael
    Nov 13 '18 at 20:58











  • I'm not sure what a pipeline script is so it's hard for me to say one way or another.

    – user1818298
    Nov 14 '18 at 13:03











  • Here's some info about Jenkins Pipeline as Code jenkins.io/solutions/pipeline

    – Michael
    Nov 14 '18 at 13:09













0












0








0








So, like the title suggests, I've got a jenkins build / job that I'm wanting to parameterize with different options for the different environments that it could be executed against (dev, qa, cert, stage, prod, etc.). The 2nd part of what I'm wanting to accomplish is based on what the user selects from the environment dropdown (dev, qa, cert, etc.) it would then update the App.config file with that environment value so the same automation job could be ran in multiple environments for multiple deployment validations.



This is my first shot at creating my parameterized list:
enter image description here



And then, based on what option is selected, I would want to update the environment value in App.config with the selected value.



Here is what the App.config looks like (just basic xml):



<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="Environment" value="QA" />
<!--DEV is default value -->
<!--
DRIVER Parameters for installed web browsers
C = Chrome
CH = Headless Chrome
F = Firefox
E = Microsoft Edge
IE = Internet Ex
-->
<add key="Browser" value="C" />
</appSettings>
</configuration>


I was playing around with some of the different options that jenkins provides for parameterized builds and reading some tutorials but nothing that directly answered my question. A lot of what I was finding was based around CI/CD and builds triggering other builds in different environments.



Any help is always appreciated. Thanks!










share|improve this question














So, like the title suggests, I've got a jenkins build / job that I'm wanting to parameterize with different options for the different environments that it could be executed against (dev, qa, cert, stage, prod, etc.). The 2nd part of what I'm wanting to accomplish is based on what the user selects from the environment dropdown (dev, qa, cert, etc.) it would then update the App.config file with that environment value so the same automation job could be ran in multiple environments for multiple deployment validations.



This is my first shot at creating my parameterized list:
enter image description here



And then, based on what option is selected, I would want to update the environment value in App.config with the selected value.



Here is what the App.config looks like (just basic xml):



<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="Environment" value="QA" />
<!--DEV is default value -->
<!--
DRIVER Parameters for installed web browsers
C = Chrome
CH = Headless Chrome
F = Firefox
E = Microsoft Edge
IE = Internet Ex
-->
<add key="Browser" value="C" />
</appSettings>
</configuration>


I was playing around with some of the different options that jenkins provides for parameterized builds and reading some tutorials but nothing that directly answered my question. A lot of what I was finding was based around CI/CD and builds triggering other builds in different environments.



Any help is always appreciated. Thanks!







c# jenkins nunit






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 20:14









user1818298user1818298

70111




70111












  • It is easy if you use a pipeline script. Is that an option for you?

    – Michael
    Nov 13 '18 at 20:58











  • I'm not sure what a pipeline script is so it's hard for me to say one way or another.

    – user1818298
    Nov 14 '18 at 13:03











  • Here's some info about Jenkins Pipeline as Code jenkins.io/solutions/pipeline

    – Michael
    Nov 14 '18 at 13:09

















  • It is easy if you use a pipeline script. Is that an option for you?

    – Michael
    Nov 13 '18 at 20:58











  • I'm not sure what a pipeline script is so it's hard for me to say one way or another.

    – user1818298
    Nov 14 '18 at 13:03











  • Here's some info about Jenkins Pipeline as Code jenkins.io/solutions/pipeline

    – Michael
    Nov 14 '18 at 13:09
















It is easy if you use a pipeline script. Is that an option for you?

– Michael
Nov 13 '18 at 20:58





It is easy if you use a pipeline script. Is that an option for you?

– Michael
Nov 13 '18 at 20:58













I'm not sure what a pipeline script is so it's hard for me to say one way or another.

– user1818298
Nov 14 '18 at 13:03





I'm not sure what a pipeline script is so it's hard for me to say one way or another.

– user1818298
Nov 14 '18 at 13:03













Here's some info about Jenkins Pipeline as Code jenkins.io/solutions/pipeline

– Michael
Nov 14 '18 at 13:09





Here's some info about Jenkins Pipeline as Code jenkins.io/solutions/pipeline

– Michael
Nov 14 '18 at 13:09












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53288801%2ftrying-to-update-an-app-config-value-based-on-a-jenkins-parameterized-build-sele%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53288801%2ftrying-to-update-an-app-config-value-based-on-a-jenkins-parameterized-build-sele%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

Evgeni Malkin