Have 2 environments 1) Staging 2) Production and both these are in different network.
have created a private agent on one servers in the staging environment. Have implemented CI-CD for the staging environment. Now I need to deploy the artifacts from staging to production environment.
As both the environments are in different network, how can I use the same private agent of staging environment to deploy the code in the production.
There is no difference between your networks for VSTS. That depends from your private agent. I see two ways for your situation:
Is the destination system[production] accessible from source[Staging]?
If accessible, you can add an copy task like [Windows machine file copy / Copy Files Over SSH / FTP upload / Publish Build Artifacts /..] to your destination machine/File share. Release would proceed from here as usual
If not, you could use Hosted agent for CI and point your artifacts to drop folder of your source code. Later in Release, you can select the artifact drop folder as input something like [$(System.DefaultWorkingDirectory)/MyApplication/drop] and deploy to your required location in destination.
This is how I achieved the deployment: 1) In the staging environment build definition, added a copy task. This task copied the artifacts to the shared production drop folder. 2) Created a new production agent in prod environment. 3) The release definition has powershell task which pick up the desired files from the drop folder and does the deplyment. 4) This way both the environments are remain separated, except the drop folder.
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.