Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync eng/common directory with azure-sdk-tools for PR 9698 #1794

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions eng/common/pipelines/templates/jobs/prepare-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,21 @@ jobs:
- '!sdk/**/recordings/*'
- '!sdk/**/SessionRecords/*'
- '!sdk/**/session-records/*'
${{ if endsWith(parameters.Repository, '-pr') }}:
TokenToUseForAuth: $(azuresdk-github-pat)

- template: /eng/common/pipelines/templates/steps/install-pipeline-generation.yml
- template: /eng/common/pipelines/templates/steps/set-default-branch.yml

- pwsh: |
Write-Host "Setting up pipeline variables"
if ("${{ parameters.Repository }}" -match "Azure/azure-sdk-for-(?<prefix>[^-]*)(?<pr>-pr)?") {
$prefix = $matches['prefix']
$devOpsPath = "\$prefix"
if ("${{ parameters.Repository }}" -match "Azure/azure-sdk-for-(?<lang>[^-]*)(?<pr>-pr)?") {
$lang = $matches['lang']
$devOpsPath = "\$lang"
$prefix = $lang
if ($matches['pr']) {
$devOpsPath = "${devOpsPath}\pr"
$prefix = "${prefix}-pr"
$prefix += "-pr"
Write-Host "##vso[task.setvariable variable=ProjectForPRValidation]internal"
}
Write-Host "Prefix = $prefix"
Expand All @@ -79,8 +83,8 @@ jobs:
$testServiceConnections = '"Azure" "azure-sdk-tests" "azure-sdk-tests-preview" "azure-sdk-tests-public" "Azure SDK Test Resources - LiveTestSecrets"'
$internalServiceConnections = '"Azure" "Azure SDK Artifacts" "Azure SDK Engineering System" "opensource-api-connection" "AzureSDKEngKeyVault Secrets"'

# Map the language prefix to the appropriate variable groups
switch ($prefix)
# Map the language to the appropriate variable groups
switch ($lang)
{
"java" {
$internalVariableGroups = '$(AzureSDK_Maven_Release_Pipeline_Secrets) $(Release_Secrets_for_GitHub) $(APIReview_AutoCreate_Configurations)'
Expand Down Expand Up @@ -115,7 +119,7 @@ jobs:
$generateUnifiedWeekly = 'true'
}
default {
Write-Error "Prefix '$prefix' is not recognized."
Write-Error "Language '$lang' is not recognized."
exit 1
}
}
Expand Down
16 changes: 16 additions & 0 deletions eng/common/pipelines/templates/steps/sparse-checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,21 @@ parameters:
- name: SkipCheckoutNone
type: boolean
default: false
- name: TokenToUseForAuth
type: string
default: ''

steps:
- ${{ if not(parameters.SkipCheckoutNone) }}:
- checkout: none

- ${{ if ne(parameters.TokenToUseForAuth, '') }}:
- pwsh: |
$base64Token = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nobody:${{ parameters.TokenToUseForAuth }}"))
Write-Host "##vso[task.setvariable variable=_base64AuthToken;issecret=true;]$base64Token"
git config set --global "http.extraheader" "AUTHORIZATION: basic $base64Token"
displayName: Setup git config auth header

- task: PowerShell@2
${{ if eq(length(parameters.Repositories), 1) }}:
displayName: 'Sparse checkout ${{ parameters.Repositories[0].Name }}'
Expand Down Expand Up @@ -126,3 +136,9 @@ steps:
}
pwsh: true
workingDirectory: $(System.DefaultWorkingDirectory)

- ${{ if ne(parameters.TokenToUseForAuth, '') }}:
- pwsh: |
git config unset --global "http.extraheader"
displayName: Removing git config auth header
condition: always()
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:
ConfigFileDir: $(Build.ArtifactStagingDirectory)/PackageInfo

steps:
- ${{ if and(ne(variables['Skip.PackageValidation'], 'true'), eq(variables['System.TeamProject'], 'internal')) }}:
- ${{ if and(ne(variables['Skip.PackageValidation'], 'true'), and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))) }}:
- pwsh: |
echo "##vso[task.setvariable variable=SetAsReleaseBuild]false"
displayName: "Set as release build"
Expand Down