0

I am new to devops, and I have been googling around, but I cannot find an answer to this simple question:

How do I make my Azure windows VM automatically pull all changes to local repo from master branch?

I could just schedule pull commands on the machine, but that does not seem very Devops to me. All windows guides I can find are more centered around pushing code to their other services.

So do I just manually add 'copy file' segments in the devops pipeline, for all the scripts I wish to deliver to the VM? It's the only way I see from the pipeline.

Sorry if this is too basic.

Kaffe
  • 3
  • 3
  • To be sure that I understood you. Do you want to send source code? Or compiled app? If source code - do you have git repo on that macine configured? Or do you want to send files without having git on VM? – Krzysztof Madej May 13 '20 at 10:18
  • Thanks for answering. Yes just send raw source code, the git repo is configured on the VM. So essentially just do a git pull automatically on the server, when code is pushed to master – Kaffe May 13 '20 at 11:55
  • May I ask why do you need this? – Krzysztof Madej May 13 '20 at 12:59
  • Yes, I have some python code getting called by another program on the VM. And it is just cumbersome to go into the machine and pull every time I update the code. – Kaffe May 13 '20 at 13:15

1 Answers1

0

You can use SSH task and call command like cd /home/dev/<repo> && git pull

# SSH
# Run shell commands or a script on a remote machine using SSH
- task: SSH@0
  inputs:
    sshEndpoint: 
    runOptions: 'inline'
    inline: cd /home/dev/<repo> && git pull

For endpoint:

The name of an SSH service connection containing connection details for the remote machine. The hostname or IP address of the remote machine, the port number, and the user name are required to create an SSH service connection.

  • The private key and the passphrase must be specified for authentication.
  • A password can be used to authenticate to remote Linux machines, but this is not supported for macOS or Windows systems.
Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107