Add current commit into logs for custom builds (#1419)

* Show latest commit for custom repos

* Remove unused variables from templates

* Add Get-LatestCommit function

* Fix in synopsis

* Remove SSH_Password variables from Windows Images

* Rename download-customrepo

* Fix in synopsis
This commit is contained in:
Maksim Petrov
2020-08-24 12:31:51 +03:00
committed by GitHub
parent ba17c75613
commit f97706e248
9 changed files with 39 additions and 40 deletions

View File

@@ -17,13 +17,10 @@ jobs:
displayName: 'Download custom repository'
condition: and(ne(variables['CUSTOM_REPOSITORY_URL'], ''), ne(variables['CUSTOM_REPOSITORY_BRANCH'], ''))
inputs:
targetType: 'inline'
script: |
Write-Host "Clean up default repository"
Remove-Item -path './*' -Recurse -Force
Write-Host "Download $(CUSTOM_REPOSITORY_BRANCH) branch from $(CUSTOM_REPOSITORY_URL)"
$env:GIT_REDIRECT_STDERR = '2>&1'
git clone $(CUSTOM_REPOSITORY_URL) . -b $(CUSTOM_REPOSITORY_BRANCH) --single-branch --depth 1
targetType: 'filePath'
filePath: ./images.CI/download-repo.ps1
arguments: -RepoUrl $(CUSTOM_REPOSITORY_URL) `
-RepoBranch $(CUSTOM_REPOSITORY_BRANCH)
- task: PowerShell@2
displayName: 'Build VM'

View File

@@ -0,0 +1,14 @@
param(
[String] [Parameter (Mandatory=$true)] $RepoUrl,
[String] [Parameter (Mandatory=$true)] $RepoBranch
)
Write-Host "Clean up default repository"
Remove-Item -path './*' -Recurse -Force
Write-Host "Download ${RepoBranch} branch from ${RepoUrl}"
$env:GIT_REDIRECT_STDERR = '2>&1'
git clone $RepoUrl . -b $RepoBranch --single-branch --depth 1
Write-Host "Latest commit:"
git log --pretty=format:"Date: %cd; Commit: %H - %s; Author: %an <%ae>" -1