Skip to content

codingsteff/azure-devops-backup-repos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure DevOps - Backup Repositories

Powershell script to download all Azure DevOps git repositories with use of git clone or pull.

Requirements

Azure DevOps Extension for Azure CLI

# login interactive
az devops login

# login with Personal Access Token
az devops login --organization https://dev.azure.com/[ORGANIZATION]

Usage

.\backup-repos.ps1 "organization" "/repos" "[personal-access-token]"

Personal access token is optional, otherwise it uses system configured git credentials.

Run as docker container

docker run /
-e AZURE_DEVOPS_EXT_ORG=contoso /
-e AZURE_DEVOPS_EXT_PAT=xxxxxxxx /
-v /repos:/repos /
codingsteff/azure-devops-backup-repos

Dev

Build local docker container

docker build --pull -t azure-devops-backup-repos .

Create Tags

git tag 1.0.x
git push origin --tags

Docker hub

Build Rules

Type Source becomes => Docker Tag
Branch master latest
Tag /([0-9]+)?(\.[0-9]+)?(\.[0-9]+)/ {\1},{\1}{\2},{sourceref}

Multiple docker tags: Regex with capture groups {\1} for major, {\2} for minor, {soureref} for full tag name

Regexes and automated builds