[CI] Perform the same checkout operations in all the jobs. (#14765)
This commit is contained in:
Родитель
da7b79b796
Коммит
14d399520e
|
@ -30,9 +30,7 @@ parameters:
|
|||
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
persistCredentials: true
|
||||
path: s/xamarin-macios
|
||||
- template: ../common/checkout.yml
|
||||
|
||||
- template: download-artifacts.yml
|
||||
parameters:
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
# Job that will download the other artifact from the build and will add a comment with the contents.
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
persistCredentials: true
|
||||
path: s/xamarin-macios
|
||||
- template: ../common/checkout.yml
|
||||
|
||||
- template: download-artifacts.yml
|
||||
parameters:
|
||||
|
|
|
@ -44,55 +44,8 @@ parameters:
|
|||
default: false # only to be used when testing the CI and we do not need a signed pkg
|
||||
|
||||
steps:
|
||||
- checkout: self # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout
|
||||
clean: true # Executes: git clean -ffdx && git reset --hard HEAD
|
||||
submodules: recursive
|
||||
path: s/xamarin-macios
|
||||
|
||||
|
||||
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
|
||||
- pwsh: |
|
||||
git config remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*'
|
||||
git fetch origin
|
||||
$branch="$(Build.SourceBranch)".Replace("merge", "head")
|
||||
$branch=$branch.Replace("refs", "origin")
|
||||
Write-Host "Checking out branch $branch"
|
||||
git checkout $branch
|
||||
$hash = git rev-parse HEAD
|
||||
Write-Host "##vso[task.setvariable variable=GIT_HASH;isOutput=true]$hash"
|
||||
name: fix_commit
|
||||
displayName: "Undo Github merge"
|
||||
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios
|
||||
- ${{ else }}:
|
||||
- pwsh: |
|
||||
$hash = git rev-parse HEAD
|
||||
Write-Host "##vso[task.setvariable variable=GIT_HASH;isOutput=true]$hash"
|
||||
name: fix_commit
|
||||
displayName: "Undo Github merge"
|
||||
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios
|
||||
|
||||
- checkout: maccore
|
||||
clean: true
|
||||
persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail
|
||||
|
||||
- checkout: templates
|
||||
clean: true
|
||||
|
||||
- checkout: release-scripts
|
||||
clean: true
|
||||
|
||||
- pwsh: |
|
||||
# should we need sudo, no, but someone did something wrong in the images..
|
||||
sudo rm -Rf "$HOME/.git-credentials"
|
||||
git config --global credential.helper store
|
||||
Set-Content -Path "$HOME/.git-credentials" -Value "https://$(GitHub.Token):x-oauth-basic@github.com`n" -NoNewline
|
||||
|
||||
# maccore is special, we use fetch there in some bash scripts, but VSTS uses https.. and some pools don't like the above.. :/
|
||||
cd $(System.DefaultWorkingDirectory)/maccore
|
||||
git remote remove origin
|
||||
git remote add origin https://$(GitHub.Token)@github.com/xamarin/maccore.git
|
||||
git remote # don't add -v else we see the pat
|
||||
displayName: 'Clean git mess from VSTS'
|
||||
- template: ../common/checkout.yml
|
||||
|
||||
- template: ../common/setup.yml
|
||||
parameters:
|
||||
|
|
|
@ -9,10 +9,6 @@ parameters:
|
|||
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
persistCredentials: true
|
||||
path: s/xamarin-macios
|
||||
|
||||
# download the common artifacts + the api diff
|
||||
- template: ../common/download-artifacts.yml
|
||||
parameters:
|
||||
|
|
|
@ -8,7 +8,8 @@ parameters:
|
|||
default: '*' # Supports multiple filters separated by semi-colon such as *.msi;*.nupkg
|
||||
|
||||
steps:
|
||||
|
||||
# Do not use the templates/common/checkout.yaml for this job else the azure upload tool will fail because
|
||||
# it cannot find the correct branch to be used.
|
||||
- checkout: self
|
||||
persistCredentials: true
|
||||
path: s/xamarin-macios
|
||||
|
|
|
@ -16,9 +16,7 @@ parameters:
|
|||
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
persistCredentials: true
|
||||
path: s/xamarin-macios
|
||||
- template: ../common/checkout.yml
|
||||
|
||||
- template: download-artifacts.yml
|
||||
parameters:
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# Template that performs the checkout and fixes a number of small issues we have found between the vsts <-> github integration
|
||||
steps:
|
||||
- checkout: self # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout
|
||||
clean: true # Executes: git clean -ffdx && git reset --hard HEAD
|
||||
submodules: recursive
|
||||
path: s/xamarin-macios
|
||||
|
||||
|
||||
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
|
||||
- pwsh: |
|
||||
git config remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*'
|
||||
git fetch origin
|
||||
$branch="$(Build.SourceBranch)".Replace("merge", "head")
|
||||
$branch=$branch.Replace("refs", "origin")
|
||||
Write-Host "Checking out branch $branch"
|
||||
git checkout $branch
|
||||
$hash = git rev-parse HEAD
|
||||
Write-Host "##vso[task.setvariable variable=GIT_HASH;isOutput=true]$hash"
|
||||
name: fix_commit
|
||||
displayName: "Undo Github merge"
|
||||
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios
|
||||
- ${{ else }}:
|
||||
- pwsh: |
|
||||
$hash = git rev-parse HEAD
|
||||
Write-Host "##vso[task.setvariable variable=GIT_HASH;isOutput=true]$hash"
|
||||
name: fix_commit
|
||||
displayName: "Undo Github merge"
|
||||
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios
|
||||
|
||||
- checkout: maccore
|
||||
clean: true
|
||||
persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail
|
||||
|
||||
- checkout: templates
|
||||
clean: true
|
||||
|
||||
- checkout: release-scripts
|
||||
clean: true
|
||||
|
||||
- pwsh: |
|
||||
# maccore is special, we use fetch there in some bash scripts, but VSTS uses https.. and some pools don't like the above.. :/
|
||||
cd $(System.DefaultWorkingDirectory)/maccore
|
||||
git remote remove origin
|
||||
git remote add origin https://$(GitHub.Token)@github.com/xamarin/maccore.git
|
||||
git remote # don't add -v else we see the pat
|
||||
displayName: 'Clean git mess from VSTS'
|
||||
|
|
@ -1,15 +1,11 @@
|
|||
# Perform gihub cleaning steps
|
||||
|
||||
steps:
|
||||
- checkout: self # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout
|
||||
clean: true # Executes: git clean -ffdx && git reset --hard HEAD
|
||||
submodules: false
|
||||
persistCredentials: true
|
||||
path: s/xamarin-macios
|
||||
|
||||
- template: checkout.yml
|
||||
|
||||
- pwsh: |
|
||||
Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY/tools/devops/automation/scripts/MaciosCI.psd1
|
||||
Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY/xamarin-macios/tools/devops/automation/scripts/MaciosCI.psd1
|
||||
$comments = New-GitHubCommentsObject -Org "xamarin" -Repo "xamarin-macios" -Token $(GitHub.Token)
|
||||
|
||||
$prId = "$(Build.SourceBranch)".Replace("refs/pull/", "").Replace("/merge", "")
|
||||
|
|
|
@ -8,14 +8,10 @@ parameters:
|
|||
default: false
|
||||
|
||||
steps:
|
||||
- checkout: self # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout
|
||||
clean: true # Executes: git clean -ffdx && git reset --hard HEAD
|
||||
submodules: false
|
||||
persistCredentials: true
|
||||
path: s/xamarin-macios
|
||||
- template: checkout.yml
|
||||
|
||||
- pwsh: |
|
||||
Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY/tools/devops/automation/scripts/MaciosCI.psd1
|
||||
Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY/xamarin-macios/tools/devops/automation/scripts/MaciosCI.psd1
|
||||
|
||||
# we are going to use a custom object to store all the configuration of the build, this later
|
||||
# will be uploaded as an artifact so that it can be easily shared with the cascade pipelines
|
||||
|
@ -159,14 +155,14 @@ steps:
|
|||
make LocProject.json
|
||||
displayName: 'Generate LocProject.json'
|
||||
continueOnError: true
|
||||
workingDirectory: $(Build.SourcesDirectory)\tools\devops
|
||||
workingDirectory: $(Build.SourcesDirectory)\xamarin-macios\tools\devops
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: "Update LocProject.json"
|
||||
inputs:
|
||||
targetType: 'filePath'
|
||||
filePath: $(Build.SourcesDirectory)\tools\devops\automation\scripts\update-locproject.ps1
|
||||
arguments: -SourcesDirectory "$(Build.SourcesDirectory)" -LocProjectPath "$(Build.SourcesDirectory)\Localize\LocProject.json"
|
||||
filePath: $(Build.SourcesDirectory)\xamarin-macios\tools\devops\automation\scripts\update-locproject.ps1
|
||||
arguments: -SourcesDirectory "$(Build.SourcesDirectory)\xamarin-macios" -LocProjectPath "$(Build.SourcesDirectory)\xamarin-macios\Localize\LocProject.json"
|
||||
|
||||
- powershell: |
|
||||
git config user.email "valco@microsoft.com"
|
||||
|
|
|
@ -11,10 +11,6 @@ parameters:
|
|||
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
persistCredentials: true
|
||||
path: s/xamarin-macios
|
||||
|
||||
- ${{ if eq(parameters.runTests, true) }}:
|
||||
# Download the Html Report that was added by the tests job.
|
||||
- task: DownloadPipelineArtifact@2
|
||||
|
|
|
@ -30,9 +30,7 @@ parameters:
|
|||
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
persistCredentials: true
|
||||
path: s/xamarin-macios
|
||||
- template: checkout.yml
|
||||
|
||||
- template: download-artifacts.yml
|
||||
parameters:
|
||||
|
|
|
@ -13,9 +13,7 @@ parameters:
|
|||
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
persistCredentials: true
|
||||
path: s/xamarin-macios
|
||||
- template: checkout.yml
|
||||
|
||||
- template: download-artifacts.yml
|
||||
parameters:
|
||||
|
|
|
@ -12,9 +12,7 @@ parameters:
|
|||
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
persistCredentials: true
|
||||
path: s/xamarin-macios
|
||||
- template: checkout.yml
|
||||
|
||||
- ${{ if eq(parameters.provisioningFailed, 'False') }}:
|
||||
- template: download-artifacts.yml
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
steps:
|
||||
|
||||
- checkout: self
|
||||
path: s/xamarin-macios
|
||||
- checkout: maccore
|
||||
persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail
|
||||
- template: ./common/checkout.yml
|
||||
|
||||
- task: CredScan@3
|
||||
displayName: "Run CredScan"
|
||||
|
|
|
@ -14,10 +14,7 @@ parameters:
|
|||
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
path: s/xamarin-macios
|
||||
- checkout: maccore
|
||||
persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail
|
||||
- template: ../common/checkout.yml
|
||||
|
||||
# Write a generic failure message to the failure comment file, so a failure will be reported
|
||||
# if something goes wrong before we successfully complete the tests (in which case we delete the file).
|
||||
|
|
|
@ -11,9 +11,7 @@ parameters:
|
|||
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
path: s/xamarin-macios
|
||||
persistCredentials: true
|
||||
- template: ../common/checkout.yml
|
||||
|
||||
- checkout: macios.ci
|
||||
clean: true
|
||||
|
|
|
@ -49,23 +49,7 @@ parameters:
|
|||
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
path: s/xamarin-macios
|
||||
|
||||
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
|
||||
- pwsh: |
|
||||
git config remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*'
|
||||
git fetch origin
|
||||
$branch="$(Build.SourceBranch)".Replace("merge", "head")
|
||||
$branch=$branch.Replace("refs", "origin")
|
||||
Write-Host "Checking out branch $branch"
|
||||
git checkout $branch
|
||||
git branch -a
|
||||
displayName: "Undo Github merge"
|
||||
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios
|
||||
|
||||
- checkout: maccore
|
||||
persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail
|
||||
- template: ../common/checkout.yml
|
||||
|
||||
- template: ../common/setup.yml
|
||||
parameters:
|
||||
|
|
|
@ -6,10 +6,7 @@ parameters:
|
|||
|
||||
steps:
|
||||
|
||||
- checkout: self
|
||||
path: s/xamarin-macios
|
||||
- checkout: maccore
|
||||
persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail
|
||||
- template: ../common/checkout.yml
|
||||
|
||||
- pwsh : |
|
||||
gci env: | format-table -autosize -wrap
|
||||
|
|
Загрузка…
Ссылка в новой задаче