简体   繁体   中英

Azure pipeline copy file task

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:\a\1\s\Bridge\Configs\QA\Web.config 
to D:\a\1\s\Web.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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM