Reputation: 1623
I'm learning a bit about git and devops and I'm trying to deploy a a couple of scripts using azure devops pipelines.
The flow that i have in mind is something like:
Git trigger -> git pull command -> run a test command
In the repository I have this folder structure:
project
|
└───folder1
│ file111.txt
│ file112.txt
│ ...
│
└───folder2
│ file111.txt
│ file112.txt
│ ...
│
└───folder3
│ file111.txt
│ file112.txt
│ ...
However, for the deploy, The folder1 is part of 1 VM (this VM only gonna have this folder) and the other 2 folders gonna be in another VM.
Finally, the folder3 needs to be into the folder2 in the VM.
The structure in the VM,s will be:
VM1:
folder1
│ file111.txt
│ file112.txt
VM2:
folder2
│ file011.txt
│ file012.txt
│ │
│ └───folder3
│ │ file111.txt
│ │ file112.txt
Any idea how i can du this using git? from your experience, this is the best approach to do this?
I'm thinking I can use the Copy file Task but I'm not sure if I can copy only the files added/modified in the repo.
Thanks in advance
Upvotes: 0
Views: 302
Reputation: 3592
The build agent working directory is the folder you will use to accomplish your requirement. When you add your Azure pipeline .yml file on a github repository the source code will be downloaded automatically on the sourcesDirectory. The default working directory for devOps agents is C:\agent\work
.
Your repository if you do not have multiple checkouts will be downloaded into $(Pipeline.Workspace)/s/
In the .YML file you can add an AzureFileCopy
task to copy on the selected VM. For example you can have two or three tasks depending on your copy needs.
- task: AzureFileCopy@4
inputs:
SourcePath: '$(Pipeline.Workspace)/s/folder2'
azureSubscription: 'subscription'
Destination: 'AzureVMs'
storage: 'rmstaccount'
resourceGroup: 'rg'
MachineNames: 'vmName'
vmsAdminUserName: 'username'
vmsAdminPassword: 'password'
TargetPath: 'destinationFolder'
skipCACheck: false
Azure File Copy arguments:
Upvotes: 2