[CI] Perform the same checkout operations in all the jobs. (#14765)
This commit is contained in:
Родитель
da7b79b796
Коммит
14d399520e
|
@ -30,9 +30,7 @@ parameters:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
- template: ../common/checkout.yml
|
||||||
persistCredentials: true
|
|
||||||
path: s/xamarin-macios
|
|
||||||
|
|
||||||
- template: download-artifacts.yml
|
- template: download-artifacts.yml
|
||||||
parameters:
|
parameters:
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# Job that will download the other artifact from the build and will add a comment with the contents.
|
# Job that will download the other artifact from the build and will add a comment with the contents.
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
- template: ../common/checkout.yml
|
||||||
persistCredentials: true
|
|
||||||
path: s/xamarin-macios
|
|
||||||
|
|
||||||
- template: download-artifacts.yml
|
- template: download-artifacts.yml
|
||||||
parameters:
|
parameters:
|
||||||
|
|
|
@ -44,55 +44,8 @@ parameters:
|
||||||
default: false # only to be used when testing the CI and we do not need a signed pkg
|
default: false # only to be used when testing the CI and we do not need a signed pkg
|
||||||
|
|
||||||
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: recursive
|
|
||||||
path: s/xamarin-macios
|
|
||||||
|
|
||||||
|
- template: ../common/checkout.yml
|
||||||
- ${{ 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/setup.yml
|
- template: ../common/setup.yml
|
||||||
parameters:
|
parameters:
|
||||||
|
|
|
@ -9,10 +9,6 @@ parameters:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
|
||||||
persistCredentials: true
|
|
||||||
path: s/xamarin-macios
|
|
||||||
|
|
||||||
# download the common artifacts + the api diff
|
# download the common artifacts + the api diff
|
||||||
- template: ../common/download-artifacts.yml
|
- template: ../common/download-artifacts.yml
|
||||||
parameters:
|
parameters:
|
||||||
|
|
|
@ -8,7 +8,8 @@ parameters:
|
||||||
default: '*' # Supports multiple filters separated by semi-colon such as *.msi;*.nupkg
|
default: '*' # Supports multiple filters separated by semi-colon such as *.msi;*.nupkg
|
||||||
|
|
||||||
steps:
|
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
|
- checkout: self
|
||||||
persistCredentials: true
|
persistCredentials: true
|
||||||
path: s/xamarin-macios
|
path: s/xamarin-macios
|
||||||
|
|
|
@ -16,9 +16,7 @@ parameters:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
- template: ../common/checkout.yml
|
||||||
persistCredentials: true
|
|
||||||
path: s/xamarin-macios
|
|
||||||
|
|
||||||
- template: download-artifacts.yml
|
- template: download-artifacts.yml
|
||||||
parameters:
|
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
|
# Perform gihub cleaning steps
|
||||||
|
|
||||||
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: |
|
- 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)
|
$comments = New-GitHubCommentsObject -Org "xamarin" -Repo "xamarin-macios" -Token $(GitHub.Token)
|
||||||
|
|
||||||
$prId = "$(Build.SourceBranch)".Replace("refs/pull/", "").Replace("/merge", "")
|
$prId = "$(Build.SourceBranch)".Replace("refs/pull/", "").Replace("/merge", "")
|
||||||
|
|
|
@ -8,14 +8,10 @@ parameters:
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- checkout: self # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout
|
- template: checkout.yml
|
||||||
clean: true # Executes: git clean -ffdx && git reset --hard HEAD
|
|
||||||
submodules: false
|
|
||||||
persistCredentials: true
|
|
||||||
path: s/xamarin-macios
|
|
||||||
|
|
||||||
- pwsh: |
|
- 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
|
# 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
|
# 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
|
make LocProject.json
|
||||||
displayName: 'Generate LocProject.json'
|
displayName: 'Generate LocProject.json'
|
||||||
continueOnError: true
|
continueOnError: true
|
||||||
workingDirectory: $(Build.SourcesDirectory)\tools\devops
|
workingDirectory: $(Build.SourcesDirectory)\xamarin-macios\tools\devops
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: "Update LocProject.json"
|
displayName: "Update LocProject.json"
|
||||||
inputs:
|
inputs:
|
||||||
targetType: 'filePath'
|
targetType: 'filePath'
|
||||||
filePath: $(Build.SourcesDirectory)\tools\devops\automation\scripts\update-locproject.ps1
|
filePath: $(Build.SourcesDirectory)\xamarin-macios\tools\devops\automation\scripts\update-locproject.ps1
|
||||||
arguments: -SourcesDirectory "$(Build.SourcesDirectory)" -LocProjectPath "$(Build.SourcesDirectory)\Localize\LocProject.json"
|
arguments: -SourcesDirectory "$(Build.SourcesDirectory)\xamarin-macios" -LocProjectPath "$(Build.SourcesDirectory)\xamarin-macios\Localize\LocProject.json"
|
||||||
|
|
||||||
- powershell: |
|
- powershell: |
|
||||||
git config user.email "valco@microsoft.com"
|
git config user.email "valco@microsoft.com"
|
||||||
|
|
|
@ -11,10 +11,6 @@ parameters:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
|
||||||
persistCredentials: true
|
|
||||||
path: s/xamarin-macios
|
|
||||||
|
|
||||||
- ${{ if eq(parameters.runTests, true) }}:
|
- ${{ if eq(parameters.runTests, true) }}:
|
||||||
# Download the Html Report that was added by the tests job.
|
# Download the Html Report that was added by the tests job.
|
||||||
- task: DownloadPipelineArtifact@2
|
- task: DownloadPipelineArtifact@2
|
||||||
|
|
|
@ -30,9 +30,7 @@ parameters:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
- template: checkout.yml
|
||||||
persistCredentials: true
|
|
||||||
path: s/xamarin-macios
|
|
||||||
|
|
||||||
- template: download-artifacts.yml
|
- template: download-artifacts.yml
|
||||||
parameters:
|
parameters:
|
||||||
|
|
|
@ -13,9 +13,7 @@ parameters:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
- template: checkout.yml
|
||||||
persistCredentials: true
|
|
||||||
path: s/xamarin-macios
|
|
||||||
|
|
||||||
- template: download-artifacts.yml
|
- template: download-artifacts.yml
|
||||||
parameters:
|
parameters:
|
||||||
|
|
|
@ -12,9 +12,7 @@ parameters:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
- template: checkout.yml
|
||||||
persistCredentials: true
|
|
||||||
path: s/xamarin-macios
|
|
||||||
|
|
||||||
- ${{ if eq(parameters.provisioningFailed, 'False') }}:
|
- ${{ if eq(parameters.provisioningFailed, 'False') }}:
|
||||||
- template: download-artifacts.yml
|
- template: download-artifacts.yml
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
- template: ./common/checkout.yml
|
||||||
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
|
|
||||||
|
|
||||||
- task: CredScan@3
|
- task: CredScan@3
|
||||||
displayName: "Run CredScan"
|
displayName: "Run CredScan"
|
||||||
|
|
|
@ -14,10 +14,7 @@ parameters:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
- template: ../common/checkout.yml
|
||||||
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
|
|
||||||
|
|
||||||
# Write a generic failure message to the failure comment file, so a failure will be reported
|
# 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).
|
# if something goes wrong before we successfully complete the tests (in which case we delete the file).
|
||||||
|
|
|
@ -11,9 +11,7 @@ parameters:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
- template: ../common/checkout.yml
|
||||||
path: s/xamarin-macios
|
|
||||||
persistCredentials: true
|
|
||||||
|
|
||||||
- checkout: macios.ci
|
- checkout: macios.ci
|
||||||
clean: true
|
clean: true
|
||||||
|
|
|
@ -49,23 +49,7 @@ parameters:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
- template: ../common/checkout.yml
|
||||||
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/setup.yml
|
- template: ../common/setup.yml
|
||||||
parameters:
|
parameters:
|
||||||
|
|
|
@ -6,10 +6,7 @@ parameters:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- checkout: self
|
- template: ../common/checkout.yml
|
||||||
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
|
|
||||||
|
|
||||||
- pwsh : |
|
- pwsh : |
|
||||||
gci env: | format-table -autosize -wrap
|
gci env: | format-table -autosize -wrap
|
||||||
|
|
Загрузка…
Ссылка в новой задаче