mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 22:26:56 +00:00
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:
@@ -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'
|
||||
|
||||
14
images.CI/download-repo.ps1
Normal file
14
images.CI/download-repo.ps1
Normal 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
|
||||
Reference in New Issue
Block a user