Azure pipeline copy file task











up vote
0
down vote

favorite
1












We're trying to get some CI/CD up in here, so I'm trying to deploy a webservice via the Azure Dev Ops pipeline, but I'm running into an issue with the Web.configs. So far I've gone down the route of having a config per environment (DEV, QA, PROD) and figured I'd simply have the build process copy the relevant file on top of it with the copy file task. Everything was already zipped up at the release step so I did it at the build step.



I get the following output from the copy step:



2018-11-19T16:46:17.2133815Z found 1 files
2018-11-19T16:46:17.2141470Z Copying D:a1sBridgeConfigsQAWeb.config
to D:a1sWeb.config
2018-11-19T16:46:17.2226220Z ##[section]Finishing: Set Web.config to QA


I have it set to overwrite at the destination.



It looks like it's got the right files at the right directory, but when it gets to deployment, I still see the same (uncopied) Web.config at the root directory. Any ideas what might be happening here?



Alternatively, is there a good way to move the file around after deployment? It looks like the copy file task only has access to what's in the build artifact where everything is zipped up, and unzipping it sounds like the wrong idea to me.



Any help is appreciated, thanks!



Note: I was hoping to use this copy file thing instead of the various transform options because it seems simpler and I like having the separate configs in source control.










share|improve this question
























  • Just realized this copy thing isn't going to work if it's at the build step if I want to take the pipeline to QA and then Production, so moving the file after deployment seems like the better option.
    – Josh Bowdish
    Nov 19 at 17:14















up vote
0
down vote

favorite
1












We're trying to get some CI/CD up in here, so I'm trying to deploy a webservice via the Azure Dev Ops pipeline, but I'm running into an issue with the Web.configs. So far I've gone down the route of having a config per environment (DEV, QA, PROD) and figured I'd simply have the build process copy the relevant file on top of it with the copy file task. Everything was already zipped up at the release step so I did it at the build step.



I get the following output from the copy step:



2018-11-19T16:46:17.2133815Z found 1 files
2018-11-19T16:46:17.2141470Z Copying D:a1sBridgeConfigsQAWeb.config
to D:a1sWeb.config
2018-11-19T16:46:17.2226220Z ##[section]Finishing: Set Web.config to QA


I have it set to overwrite at the destination.



It looks like it's got the right files at the right directory, but when it gets to deployment, I still see the same (uncopied) Web.config at the root directory. Any ideas what might be happening here?



Alternatively, is there a good way to move the file around after deployment? It looks like the copy file task only has access to what's in the build artifact where everything is zipped up, and unzipping it sounds like the wrong idea to me.



Any help is appreciated, thanks!



Note: I was hoping to use this copy file thing instead of the various transform options because it seems simpler and I like having the separate configs in source control.










share|improve this question
























  • Just realized this copy thing isn't going to work if it's at the build step if I want to take the pipeline to QA and then Production, so moving the file after deployment seems like the better option.
    – Josh Bowdish
    Nov 19 at 17:14













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





We're trying to get some CI/CD up in here, so I'm trying to deploy a webservice via the Azure Dev Ops pipeline, but I'm running into an issue with the Web.configs. So far I've gone down the route of having a config per environment (DEV, QA, PROD) and figured I'd simply have the build process copy the relevant file on top of it with the copy file task. Everything was already zipped up at the release step so I did it at the build step.



I get the following output from the copy step:



2018-11-19T16:46:17.2133815Z found 1 files
2018-11-19T16:46:17.2141470Z Copying D:a1sBridgeConfigsQAWeb.config
to D:a1sWeb.config
2018-11-19T16:46:17.2226220Z ##[section]Finishing: Set Web.config to QA


I have it set to overwrite at the destination.



It looks like it's got the right files at the right directory, but when it gets to deployment, I still see the same (uncopied) Web.config at the root directory. Any ideas what might be happening here?



Alternatively, is there a good way to move the file around after deployment? It looks like the copy file task only has access to what's in the build artifact where everything is zipped up, and unzipping it sounds like the wrong idea to me.



Any help is appreciated, thanks!



Note: I was hoping to use this copy file thing instead of the various transform options because it seems simpler and I like having the separate configs in source control.










share|improve this question















We're trying to get some CI/CD up in here, so I'm trying to deploy a webservice via the Azure Dev Ops pipeline, but I'm running into an issue with the Web.configs. So far I've gone down the route of having a config per environment (DEV, QA, PROD) and figured I'd simply have the build process copy the relevant file on top of it with the copy file task. Everything was already zipped up at the release step so I did it at the build step.



I get the following output from the copy step:



2018-11-19T16:46:17.2133815Z found 1 files
2018-11-19T16:46:17.2141470Z Copying D:a1sBridgeConfigsQAWeb.config
to D:a1sWeb.config
2018-11-19T16:46:17.2226220Z ##[section]Finishing: Set Web.config to QA


I have it set to overwrite at the destination.



It looks like it's got the right files at the right directory, but when it gets to deployment, I still see the same (uncopied) Web.config at the root directory. Any ideas what might be happening here?



Alternatively, is there a good way to move the file around after deployment? It looks like the copy file task only has access to what's in the build artifact where everything is zipped up, and unzipping it sounds like the wrong idea to me.



Any help is appreciated, thanks!



Note: I was hoping to use this copy file thing instead of the various transform options because it seems simpler and I like having the separate configs in source control.







web-config azure-devops






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 21:08









Daniel Mann

36.5k65884




36.5k65884










asked Nov 19 at 17:13









Josh Bowdish

31




31












  • Just realized this copy thing isn't going to work if it's at the build step if I want to take the pipeline to QA and then Production, so moving the file after deployment seems like the better option.
    – Josh Bowdish
    Nov 19 at 17:14


















  • Just realized this copy thing isn't going to work if it's at the build step if I want to take the pipeline to QA and then Production, so moving the file after deployment seems like the better option.
    – Josh Bowdish
    Nov 19 at 17:14
















Just realized this copy thing isn't going to work if it's at the build step if I want to take the pipeline to QA and then Production, so moving the file after deployment seems like the better option.
– Josh Bowdish
Nov 19 at 17:14




Just realized this copy thing isn't going to work if it's at the build step if I want to take the pipeline to QA and then Production, so moving the file after deployment seems like the better option.
– Josh Bowdish
Nov 19 at 17:14












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










You've in part answered your own question. You'll need to do this copy work in a release pipeline rather than build so that the copy of the file can be contextual to the environment it has to function within.



For this reason you'll probably need to emit the web configs into the build artifact. Maybe copy them into a "configs" directory in $(build.artifactstagingdirectory). Then in your release pipeline it will download your artifact which will include your "configs" directory and all the environment configs and you can have a release pipeline task that based on the environment its in copies the right file from the "configs" directory in the artifact and copies it in-place to the root directory of the deployed web app.






share|improve this answer





















  • Thanks! This worked perfectly. One issue - I wasn't able to find a correct pre-determined variable for the root directory of my web app, I kept finding agent based stuff. Do you know if there is a variable for the root directory? Giving the absolute path on the machine is working though.
    – Josh Bowdish
    Nov 21 at 19:38










  • The agent doesn't have this intimate knowledge of where apps root directories are going to be deployed to as it is agnostic of the technology or platforms it can deploy to (i.e. deploying a apache java app is different to a .NET Web App on IIS). The only knowledge it really has is around the agent itself and it's directory placement then any System/Custom environment variables. Glad you got it working :-)
    – Colin B
    Nov 22 at 12:58











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',
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%2f53379618%2fazure-pipeline-copy-file-task%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










You've in part answered your own question. You'll need to do this copy work in a release pipeline rather than build so that the copy of the file can be contextual to the environment it has to function within.



For this reason you'll probably need to emit the web configs into the build artifact. Maybe copy them into a "configs" directory in $(build.artifactstagingdirectory). Then in your release pipeline it will download your artifact which will include your "configs" directory and all the environment configs and you can have a release pipeline task that based on the environment its in copies the right file from the "configs" directory in the artifact and copies it in-place to the root directory of the deployed web app.






share|improve this answer





















  • Thanks! This worked perfectly. One issue - I wasn't able to find a correct pre-determined variable for the root directory of my web app, I kept finding agent based stuff. Do you know if there is a variable for the root directory? Giving the absolute path on the machine is working though.
    – Josh Bowdish
    Nov 21 at 19:38










  • The agent doesn't have this intimate knowledge of where apps root directories are going to be deployed to as it is agnostic of the technology or platforms it can deploy to (i.e. deploying a apache java app is different to a .NET Web App on IIS). The only knowledge it really has is around the agent itself and it's directory placement then any System/Custom environment variables. Glad you got it working :-)
    – Colin B
    Nov 22 at 12:58















up vote
0
down vote



accepted










You've in part answered your own question. You'll need to do this copy work in a release pipeline rather than build so that the copy of the file can be contextual to the environment it has to function within.



For this reason you'll probably need to emit the web configs into the build artifact. Maybe copy them into a "configs" directory in $(build.artifactstagingdirectory). Then in your release pipeline it will download your artifact which will include your "configs" directory and all the environment configs and you can have a release pipeline task that based on the environment its in copies the right file from the "configs" directory in the artifact and copies it in-place to the root directory of the deployed web app.






share|improve this answer





















  • Thanks! This worked perfectly. One issue - I wasn't able to find a correct pre-determined variable for the root directory of my web app, I kept finding agent based stuff. Do you know if there is a variable for the root directory? Giving the absolute path on the machine is working though.
    – Josh Bowdish
    Nov 21 at 19:38










  • The agent doesn't have this intimate knowledge of where apps root directories are going to be deployed to as it is agnostic of the technology or platforms it can deploy to (i.e. deploying a apache java app is different to a .NET Web App on IIS). The only knowledge it really has is around the agent itself and it's directory placement then any System/Custom environment variables. Glad you got it working :-)
    – Colin B
    Nov 22 at 12:58













up vote
0
down vote



accepted







up vote
0
down vote



accepted






You've in part answered your own question. You'll need to do this copy work in a release pipeline rather than build so that the copy of the file can be contextual to the environment it has to function within.



For this reason you'll probably need to emit the web configs into the build artifact. Maybe copy them into a "configs" directory in $(build.artifactstagingdirectory). Then in your release pipeline it will download your artifact which will include your "configs" directory and all the environment configs and you can have a release pipeline task that based on the environment its in copies the right file from the "configs" directory in the artifact and copies it in-place to the root directory of the deployed web app.






share|improve this answer












You've in part answered your own question. You'll need to do this copy work in a release pipeline rather than build so that the copy of the file can be contextual to the environment it has to function within.



For this reason you'll probably need to emit the web configs into the build artifact. Maybe copy them into a "configs" directory in $(build.artifactstagingdirectory). Then in your release pipeline it will download your artifact which will include your "configs" directory and all the environment configs and you can have a release pipeline task that based on the environment its in copies the right file from the "configs" directory in the artifact and copies it in-place to the root directory of the deployed web app.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 at 18:52









Colin B

1666




1666












  • Thanks! This worked perfectly. One issue - I wasn't able to find a correct pre-determined variable for the root directory of my web app, I kept finding agent based stuff. Do you know if there is a variable for the root directory? Giving the absolute path on the machine is working though.
    – Josh Bowdish
    Nov 21 at 19:38










  • The agent doesn't have this intimate knowledge of where apps root directories are going to be deployed to as it is agnostic of the technology or platforms it can deploy to (i.e. deploying a apache java app is different to a .NET Web App on IIS). The only knowledge it really has is around the agent itself and it's directory placement then any System/Custom environment variables. Glad you got it working :-)
    – Colin B
    Nov 22 at 12:58


















  • Thanks! This worked perfectly. One issue - I wasn't able to find a correct pre-determined variable for the root directory of my web app, I kept finding agent based stuff. Do you know if there is a variable for the root directory? Giving the absolute path on the machine is working though.
    – Josh Bowdish
    Nov 21 at 19:38










  • The agent doesn't have this intimate knowledge of where apps root directories are going to be deployed to as it is agnostic of the technology or platforms it can deploy to (i.e. deploying a apache java app is different to a .NET Web App on IIS). The only knowledge it really has is around the agent itself and it's directory placement then any System/Custom environment variables. Glad you got it working :-)
    – Colin B
    Nov 22 at 12:58
















Thanks! This worked perfectly. One issue - I wasn't able to find a correct pre-determined variable for the root directory of my web app, I kept finding agent based stuff. Do you know if there is a variable for the root directory? Giving the absolute path on the machine is working though.
– Josh Bowdish
Nov 21 at 19:38




Thanks! This worked perfectly. One issue - I wasn't able to find a correct pre-determined variable for the root directory of my web app, I kept finding agent based stuff. Do you know if there is a variable for the root directory? Giving the absolute path on the machine is working though.
– Josh Bowdish
Nov 21 at 19:38












The agent doesn't have this intimate knowledge of where apps root directories are going to be deployed to as it is agnostic of the technology or platforms it can deploy to (i.e. deploying a apache java app is different to a .NET Web App on IIS). The only knowledge it really has is around the agent itself and it's directory placement then any System/Custom environment variables. Glad you got it working :-)
– Colin B
Nov 22 at 12:58




The agent doesn't have this intimate knowledge of where apps root directories are going to be deployed to as it is agnostic of the technology or platforms it can deploy to (i.e. deploying a apache java app is different to a .NET Web App on IIS). The only knowledge it really has is around the agent itself and it's directory placement then any System/Custom environment variables. Glad you got it working :-)
– Colin B
Nov 22 at 12:58


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53379618%2fazure-pipeline-copy-file-task%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

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen