0

Im using a Azure VM for the first time (linux, Ubuntu 18) and Ive been tasked with setting a pipeline/release for continuous development for a simple website

Its supposed to work like this: when master branch is commited to Azure, automatically run the pipeline and release to deploy it to a directory in the VM (theres is no build involved, is a simple Wordpress site)

I managed to get it working like this:

  1. Ive set a pipeline that just gets the code from the git and copies it to $(Build.ArtifactStagingDirectory) (using a Copy Files task)
  2. than it publishes it as an artifact (using Publish Artifact task)

Then a release pipeline that does the following:

  1. copies the artifact files to the directory (using Copy Files task again)

It is working but it doenst seems good. Theres some obvious problems:

  1. is slow: it will copy all files every time, not just what was changed
  2. if I delete a file, it wont be deleted on the deploy directory

So what I want is some way to sync the git commit with the site directory, overwriting only changed files and deleting any deleted files, ignoring files and directories on .git-ignore etc

Seems simple (I know how to do it with git hooks) but I just cant find a way to do it in Azure DevOps

Is it possible? Can anyone give me a direction?

3
  • Upload using rsync ? Commented Oct 24, 2020 at 7:17
  • can you elabore? Im pretty new at azure Commented Oct 28, 2020 at 20:14
  • Hello, didn't get your latest information. Is there any update on this issue? Please check if the answer below helps you and feel free to comment. Commented Nov 2, 2020 at 9:42

1 Answer 1

1

Azure release pipeline: synce files with commit

Azure devops build/release does not support build/release only changed files since only build/release changed files not always meaningful and can't achieve what the project intend to release.

But we could compare each time upload/publish files -> compare with the new committed information -> publish only changed files:

Inline powershell:

cd $(System.DefaultWorkingDirectory) get-childitem $(System.DefaultWorkingDirectory) -recurse | Foreach { $lastupdatetime=$_.LastWriteTime; $nowtime=get-date; if(($nowtime - $lastupdatetime).totalhours -le 48) { Write-Host $_.fullname } else{ remove-item $_.fullname -Recurse -Force } } 

Above powershell scripts will list all files that have been modified in the past 48 hours.

You could check this thread for some more details.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.