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

[release/8.0.1xx-xcode15.4] Merge main CI changes into our release branch #21108

Merged
merged 1 commit into from
Aug 24, 2024
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
411 changes: 206 additions & 205 deletions tools/devops/automation/build-pipeline.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tools/devops/automation/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ extends:
forceInsertion: ${{ parameters.forceInsertion }}
skipESRP: ${{ parameters.skipESRP }}
pushNugets: false
pushNugetsToMaestro: false
${{ if ne(length(parameters.testConfigurations), 0)}}:
testConfigurations: ${{ parameters.testConfigurations }}
deviceTestsConfigurations: ${{ parameters.deviceTestsConfigurations }}
Expand Down
4 changes: 4 additions & 0 deletions tools/devops/automation/scripts/bash/compare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ mkdir -p "$CHANGE_DETECTION_RESULTS_DIR"

cd "$XAM_TOP"

if test -z "$PR_ID"; then
PR_ID=$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER
fi

# Figure out the base hash we want to compare against
if [[ $PR_ID ]]; then
git fetch --no-tags --progress https://github.com/xamarin/xamarin-macios +refs/pull/"$PR_ID"/*:refs/remotes/origin/pr/"$PR_ID"/*
Expand Down
41 changes: 24 additions & 17 deletions tools/devops/automation/scripts/generate_agent_logs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,28 @@ param
# the build started

# User name can be anything. It is the personal access token (PAT) token that matters.
$user= "AnyUser"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user, $VstsToken)))
$headers = @{Authorization = "Basic {0}" -f $base64AuthInfo}

# get the url of the build
$url= $Env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI + "$Env:SYSTEM_TEAMPROJECT/_apis/build/builds/" + $Env:BUILD_BUILDID + "?api-version=5.1"
$buildPipeline= Invoke-RestMethod -Uri $url -Headers $headers -Method Get

$start=[DateTime]::Parse($buildPipeline.startTime).ToString("yyyy-MM-dd HH:mm:ss")

$end=Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Write-Host "end time: $end"

if (-not $Predicate) {
log show --style $Style --start "$start" --end "$end" > $Output
} else {
log show --predicate $Predicate --style $Style --start "$start" --end "$end" > $Output
try {
$user= "AnyUser"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user, $VstsToken)))
$headers = @{Authorization = "Basic {0}" -f $base64AuthInfo}

# get the url of the build
$url= $Env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI + "$Env:SYSTEM_TEAMPROJECT/_apis/build/builds/" + $Env:BUILD_BUILDID + "?api-version=5.1"
$buildPipeline= Invoke-RestMethod -Uri $url -Headers $headers -Method Get

$start=[DateTime]::Parse($buildPipeline.startTime).ToString("yyyy-MM-dd HH:mm:ss")

$end=Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Write-Host "end time: $end"

if (-not $Predicate) {
log show --style $Style --start "$start" --end "$end" > $Output
} else {
log show --predicate $Predicate --style $Style --start "$start" --end "$end" > $Output
}
} catch {
Write-Host "Exception occurred: $_"
# Create the output file, because we later try to upload it as an artifact, and *not* uploading
# if there's *no* file is much harder than just creating the file.
New-Item -Path $Output -Value "$_"
}
291 changes: 146 additions & 145 deletions tools/devops/automation/templates/build/build-pkgs.yml
Original file line number Diff line number Diff line change
@@ -1,158 +1,159 @@
# yamllint disable rule:line-length
parameters:
- name: vsdropsPrefix
type: string
- name: vsdropsPrefix
type: string

- name: keyringPass
type: string
- name: keyringPass
type: string

- name: gitHubToken
type: string
- name: gitHubToken
type: string

- name: xqaCertPass
type: string
- name: xqaCertPass
type: string

- name: uploadBinlogs
type: boolean
default: true
- name: uploadBinlogs
type: boolean
default: true

- name: signAndNotarize
type: boolean
default: true
- name: signAndNotarize
type: boolean
default: true

- name: skipESRP
type: boolean
default: false # only to be used when testing the CI and we do not need a signed pkg
- name: skipESRP
type: boolean
default: false # only to be used when testing the CI and we do not need a signed pkg

- name: isPR
type: boolean
- name: isPR
type: boolean

- name: repositoryAlias
type: string
default: self
- name: repositoryAlias
type: string
default: self

- name: commit
type: string
default: HEAD
- name: commit
type: string
default: HEAD

- name: uploadPrefix
type: string
default: '$(MaciosUploadPrefix)'
- name: uploadPrefix
type: string
default: '$(MaciosUploadPrefix)'

steps:
- template: build.yml
parameters:
isPR: ${{ parameters.isPR }}
repositoryAlias: ${{ parameters.repositoryAlias }}
commit: ${{ parameters.commit }}
vsdropsPrefix: ${{ parameters.vsdropsPrefix }}
keyringPass: ${{ parameters.keyringPass }}
gitHubToken: ${{ parameters.gitHubToken }}
xqaCertPass: ${{ parameters.xqaCertPass }}
buildSteps:
# build not signed .pkgs for the SDK
- bash: |
set -x
set -e
rm -Rf $(Build.SourcesDirectory)/package/*.pkg
rm -Rf $(Build.SourcesDirectory)/package/notarized/*.pkg
time make -C $(Build.SourcesDirectory)/xamarin-macios/ package
name: packages
displayName: 'Build Packages'
condition: and(succeeded(), contains(variables['configuration.BuildPkgs'], 'True'))
timeoutInMinutes: 180

# build nugets
- bash: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/build-nugets.sh
displayName: 'Build Nugets'
condition: and(succeeded(), contains(variables['configuration.BuildNugets'], 'True'), ne(variables['ENABLE_DOTNET'], ''))
timeoutInMinutes: 180

- bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/generate-workload-rollback.sh
name: workload_file
displayName: 'Generate "WorkloadRollback.json"'

- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish WorkloadRollback.json'
inputs:
path: $(Build.SourcesDirectory)/WorkloadRollback.json
artifact: '${{ parameters.uploadPrefix }}WorkloadRollback'
continueOnError: true

- bash: |
var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=IOS_PACKAGE_VERSION)
IOS_PACKAGE_VERSION=${var#*=}
IOS_PACKAGE_VERSION=$(echo $IOS_PACKAGE_VERSION | cut -d "+" -f1)

var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=MAC_PACKAGE_VERSION)
MAC_PACKAGE_VERSION=${var#*=}
MAC_PACKAGE_VERSION=$(echo $MAC_PACKAGE_VERSION | cut -d "+" -f1)

PKG_DST="$(Build.SourcesDirectory)/PkgsVersions.json"

echo "{" > $PKG_DST
echo "\"iOS\": \"$IOS_PACKAGE_VERSION\"," >> $PKG_DST
echo "\"macOS\": \"$MAC_PACKAGE_VERSION\"" >> $PKG_DST
echo "}" >> $PKG_DST

echo "PkgVersions.json file contents:"
echo "$(cat $PKG_DST)"
name: pkg_versions_file
displayName: 'Generate PkgsVersions.json'

- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish PkgsVersions.json'
inputs:
path: $(Build.SourcesDirectory)/PkgsVersions.json
artifact: '${{ parameters.uploadPrefix }}PkgsVersions'
continueOnError: true

# upload each of the pkgs into the pipeline artifacts
- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish Build Artifacts'
inputs:
path: $(Build.SourcesDirectory)/package
artifact: '${{ parameters.uploadPrefix }}not-signed-package'
continueOnError: true

- bash: |
set -x
set -e

make -C $(Build.SourcesDirectory)/xamarin-macios/tests package-test-libraries.zip
name: introPkg
displayName: 'Package test libraries dependencies'
continueOnError: true # not a terrible blocking issue
timeoutInMinutes: 60

- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish test libraries dependencies'
inputs:
path: $(Build.SourcesDirectory)/xamarin-macios/tests/package-test-libraries.zip
artifact: '${{ parameters.uploadPrefix }}package-test-libraries'
continueOnError: true

- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish Build.props'
inputs:
path: $(Build.SourcesDirectory)/xamarin-macios/Build.props
artifact: '${{ parameters.uploadPrefix }}Build.props'
continueOnError: true

- ${{ if eq(parameters.uploadBinlogs, true) }}:
# Copy all the binlogs to a separate directory, keeping directory structure.
- script: |
set -x
mkdir -p $(Build.ArtifactStagingDirectory)/all-binlogs
rsync -av --prune-empty-dirs --include '*/' --include '*.binlog' --exclude '*' $(Build.SourcesDirectory)/xamarin-macios $(Build.ArtifactStagingDirectory)/all-binlogs
displayName: Copy all binlogs
continueOnError: true
condition: succeededOrFailed()

# Publish all the binlogs we collected in the previous step
- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish Artifact: All binlogs'
inputs:
path: $(Build.ArtifactStagingDirectory)/all-binlogs
artifact: '${{ parameters.uploadPrefix }}all-binlogs-$(Build.BuildId)-$(System.StageAttempt)-$(System.JobAttempt)'
continueOnError: true
condition: succeededOrFailed()
- template: build.yml
parameters:
isPR: ${{ parameters.isPR }}
repositoryAlias: ${{ parameters.repositoryAlias }}
commit: ${{ parameters.commit }}
vsdropsPrefix: ${{ parameters.vsdropsPrefix }}
keyringPass: ${{ parameters.keyringPass }}
gitHubToken: ${{ parameters.gitHubToken }}
xqaCertPass: ${{ parameters.xqaCertPass }}
buildSteps:
# build not signed .pkgs for the SDK
- bash: |
set -x
set -e
rm -Rf $(Build.SourcesDirectory)/package/*.pkg
rm -Rf $(Build.SourcesDirectory)/package/notarized/*.pkg
time make -C $(Build.SourcesDirectory)/xamarin-macios/ package
name: packages
displayName: 'Build Packages'
condition: and(succeeded(), contains(variables['configuration.BuildPkgs'], 'True'))
timeoutInMinutes: 180

# build nugets
- bash: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/build-nugets.sh
displayName: 'Build Nugets'
condition: and(succeeded(), contains(variables['configuration.BuildNugets'], 'True'), ne(variables['ENABLE_DOTNET'], ''))
timeoutInMinutes: 180

- bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/generate-workload-rollback.sh
name: workload_file
displayName: 'Generate "WorkloadRollback.json"'

- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish WorkloadRollback.json'
inputs:
path: $(Build.SourcesDirectory)/WorkloadRollback.json
artifact: '${{ parameters.uploadPrefix }}WorkloadRollback'
continueOnError: true

- bash: |
var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=IOS_PACKAGE_VERSION)
IOS_PACKAGE_VERSION=${var#*=}
IOS_PACKAGE_VERSION=$(echo $IOS_PACKAGE_VERSION | cut -d "+" -f1)

var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=MAC_PACKAGE_VERSION)
MAC_PACKAGE_VERSION=${var#*=}
MAC_PACKAGE_VERSION=$(echo $MAC_PACKAGE_VERSION | cut -d "+" -f1)

PKG_DST="$(Build.SourcesDirectory)/PkgsVersions.json"

echo "{" > $PKG_DST
echo "\"iOS\": \"$IOS_PACKAGE_VERSION\"," >> $PKG_DST
echo "\"macOS\": \"$MAC_PACKAGE_VERSION\"" >> $PKG_DST
echo "}" >> $PKG_DST

echo "PkgVersions.json file contents:"
echo "$(cat $PKG_DST)"
name: pkg_versions_file
displayName: 'Generate PkgsVersions.json'

- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish PkgsVersions.json'
inputs:
path: $(Build.SourcesDirectory)/PkgsVersions.json
artifact: '${{ parameters.uploadPrefix }}PkgsVersions'
continueOnError: true

# upload each of the pkgs into the pipeline artifacts
- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish Build Artifacts'
inputs:
path: $(Build.SourcesDirectory)/package
artifact: '${{ parameters.uploadPrefix }}not-signed-package'
continueOnError: true

- bash: |
set -x
set -e

make -C $(Build.SourcesDirectory)/xamarin-macios/tests package-test-libraries.zip
name: introPkg
displayName: 'Package test libraries dependencies'
continueOnError: true # not a terrible blocking issue
timeoutInMinutes: 60

- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish test libraries dependencies'
inputs:
path: $(Build.SourcesDirectory)/xamarin-macios/tests/package-test-libraries.zip
artifact: '${{ parameters.uploadPrefix }}package-test-libraries'
continueOnError: true

- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish Build.props'
inputs:
path: $(Build.SourcesDirectory)/xamarin-macios/Build.props
artifact: '${{ parameters.uploadPrefix }}Build.props'
continueOnError: true

- ${{ if eq(parameters.uploadBinlogs, true) }}:
# Copy all the binlogs to a separate directory, keeping directory structure.
- script: |
set -x
mkdir -p $(Build.ArtifactStagingDirectory)/all-binlogs
rsync -av --prune-empty-dirs --include '*/' --include '*.binlog' --exclude '*' $(Build.SourcesDirectory)/xamarin-macios $(Build.ArtifactStagingDirectory)/all-binlogs
displayName: Copy all binlogs
continueOnError: true
condition: succeededOrFailed()

# Publish all the binlogs we collected in the previous step
- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish Artifact: All binlogs'
inputs:
path: $(Build.ArtifactStagingDirectory)/all-binlogs
artifact: '${{ parameters.uploadPrefix }}all-binlogs-$(Build.BuildId)-$(System.StageAttempt)-$(System.JobAttempt)'
continueOnError: true
condition: succeededOrFailed()
Loading
Loading