Skip to content

Commit 4b2db53

Browse files
committed
Merge branch 'main' into 2.0
2 parents 9be1704 + a8d7f4b commit 4b2db53

File tree

253 files changed

+17710
-592
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+17710
-592
lines changed

.github/workflows/go-test-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
sudo env "PATH=$PATH" make go-test-coverage
8989
9090
- name: Upload test coverage
91-
uses: actions/upload-artifact@v2.1.4
91+
uses: actions/upload-artifact@v4
9292
with:
9393
name: TestCoverage
9494
path: toolkit/out/tools/test_coverage_report.html

.github/workflows/lint-specs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
fi
9898
exit 0
9999
100-
- uses: actions/upload-artifact@v2
100+
- uses: actions/upload-artifact@v4
101101
if: ${{ always() }}
102102
with:
103103
name: linted_specs

.pipelines/containerSourceData/busybox/Dockerfile-Busybox

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ RUN mkdir /staging \
3333
&& pushd /staging \
3434
&& rm -rf boot media mnt opt run \
3535
&& rm -rf usr/lib/sysimage \
36-
&& rm -rf var/cache \
37-
&& rm -rf var/lib/rpm; \
36+
&& rm -rf var/cache; \
3837
ln -vL /staging/usr/sbin/busybox /staging/bin/; \
3938
chroot /staging /bin/busybox --install -s /bin
4039

.pipelines/containerSourceData/scripts/BuildGoldenContainer.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ set -e
5757
# -j OUTPUT -k ./rpms.tar.gz -l ~/CBL-Mariner/.pipelines/containerSourceData \
5858
# -m "false" -n "false" -p development -q "false" -u "true"
5959

60-
while getopts ":a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:" OPTIONS; do
60+
while getopts ":a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:" OPTIONS; do
6161
case ${OPTIONS} in
6262
a ) BASE_IMAGE_NAME_FULL=$OPTARG;;
6363
b ) ACR=$OPTARG;;
@@ -81,6 +81,7 @@ while getopts ":a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:" OPTIONS; do
8181
t ) SBOM_SCRIPT=$OPTARG;;
8282
u ) DISTROLESS=$OPTARG;;
8383
v ) VERSION_EXTRACT_CMD=$OPTARG;;
84+
w ) TOOLCHAIN_RPMS_TARBALL=$OPTARG;;
8485

8586
\? )
8687
echo "Error - Invalid Option: -$OPTARG" 1>&2
@@ -124,6 +125,7 @@ function print_inputs {
124125
echo "SBOM_TOOL_PATH -> $SBOM_TOOL_PATH"
125126
echo "SBOM_SCRIPT -> $SBOM_SCRIPT"
126127
echo "DISTROLESS -> $DISTROLESS"
128+
echo "TOOLCHAIN_RPMS_TARBALL -> $TOOLCHAIN_RPMS_TARBALL"
127129
}
128130

129131
function validate_inputs {
@@ -167,6 +169,11 @@ function validate_inputs {
167169
exit 1
168170
fi
169171

172+
if [[ ! -f $TOOLCHAIN_RPMS_TARBALL ]]; then
173+
echo "Error - No TOOLCHAIN_RPMS_TARBALL tarball found."
174+
exit 1
175+
fi
176+
170177
if [ ! -d "$CONTAINER_SRC_DIR" ]; then
171178
echo "Error - Container source directory does not exist."
172179
exit 1
@@ -262,6 +269,7 @@ function prepare_docker_directory {
262269

263270
# Copy files into docker context directory
264271
tar -xf "$RPMS_TARBALL" -C "$HOST_MOUNTED_DIR"/
272+
tar -xf "$TOOLCHAIN_RPMS_TARBALL" -C "$HOST_MOUNTED_DIR/RPMS"/
265273
cp -v "$CONTAINER_SRC_DIR/marinerLocalRepo.repo" "$HOST_MOUNTED_DIR"/
266274
}
267275

.pipelines/prchecks/PackageBuildPRCheck.yml

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4-
# Since we're boosting our builds by using a private, pre-compiled raw toolchain
5-
# the pipeline requires defining the following variables outside of the YAML:
6-
# - rawToolchainCacheURL_AMD64
7-
# - rawToolchainCacheURL_ARM64
4+
# The "agentPool" parameter is defined in the "Agent pools (DEV)" variable group.
5+
# The "rawToolchain*" parameters are defined in the "Raw toolchain info" variable group.
86

97
trigger: none
108

@@ -13,15 +11,15 @@ parameters:
1311
type: object
1412
default:
1513
- name: "AMD64"
16-
agentPool: "$(DEV_AMD64_Managed)" # Pool defined inside the "Agent pools (DEV)" variable group.
14+
agentPool: "$(DEV_AMD64_Managed)"
1715
maxCPUs: "$(($(nproc) / 2))"
18-
rawToolchainCacheURL: "$(rawToolchainCacheURL_AMD64)"
19-
rawToolchainExpectedHash: "f56df34b90915c93f772d3961bf5e9eeb8c1233db43dd92070214e4ce6b72894"
16+
rawToolchainCacheURL: "$(rawToolchainCacheURL_AMD64_2.0)"
17+
rawToolchainExpectedHash: "$(rawToolchainCacheHash_AMD64_2.0)"
2018
- name: "ARM64"
21-
agentPool: "$(DEV_ARM64_Managed)" # Pool defined inside the "Agent pools (DEV)" variable group.
19+
agentPool: "$(DEV_ARM64_Managed)"
2220
maxCPUs: "$(($(nproc) / 3))"
23-
rawToolchainCacheURL: "$(rawToolchainCacheURL_ARM64)"
24-
rawToolchainExpectedHash: "65de43b3bdcfdaac71df1f11fd1f830a8109b1eb9d7cb6cbc2e2d0e929d0ef76"
21+
rawToolchainCacheURL: "$(rawToolchainCacheURL_ARM64_2.0)"
22+
rawToolchainExpectedHash: "$(rawToolchainCacheHash_ARM64_2.0)"
2523
- name: debug
2624
type: boolean
2725
default: false
@@ -36,12 +34,15 @@ resources:
3634

3735
variables:
3836
- group: "Agent pools (DEV)"
37+
- group: "Raw toolchain info"
3938
- name: rpmsArtifactNameBase
4039
value: RPMs
4140
- name: toolchainArtifactNameBase
4241
value: Toolchain
42+
- name: toolchainTestsArtifactNameBase
43+
value: Toolchain_tests
4344
- name: system.debug
44-
value: '${{ parameters.debug }}'
45+
value: "${{ parameters.debug }}"
4546

4647
extends:
4748
template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates
@@ -75,6 +76,9 @@ extends:
7576
# Toolchain package tests should be run through the full package build, calculate the list of packages that should be re-tested
7677
# and make it available to the next stage via an output variable: 'CalculateToolchainPackageRetestList.toolchainPackageRetestList'
7778
- template: .pipelines/templates/ToolchainCalculatePackageRetests.yml@self
79+
parameters:
80+
# GCC fails to build as a regular package.
81+
ignoredSpecs: ["gcc"]
7882

7983
- script: echo "##vso[task.setvariable variable=toolchainArtifactName;isOutput=true]$(ob_artifactBaseName)"
8084
name: "ToolchainArtifactName"
@@ -100,9 +104,8 @@ extends:
100104
isCustom: true
101105
name: ${{ configuration.agentPool }}
102106
variables:
103-
ob_artifactBaseName: ${{ variables.rpmsArtifactNameBase }}_${{ configuration.name }}_$(System.JobAttempt)
107+
ob_artifactBaseName: $(rpmsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
104108
ob_outputDirectory: $(Build.ArtifactStagingDirectory)
105-
testListFromToolchain: $[ stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['CalculateToolchainPackageRetestList.toolchainPackageRetestList'] ]
106109
toolchainArtifactName: $[ stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['ToolchainArtifactName.toolchainArtifactName'] ]
107110
steps:
108111
- template: .pipelines/templates/PackageBuild.yml@self
@@ -112,25 +115,62 @@ extends:
112115
isCheckBuild: true
113116
isQuickRebuildPackages: true
114117
isUseCCache: true
115-
outputArtifactsFolder: $(ob_outputDirectory)
116118
maxCPU: "${{ configuration.maxCPUs }}"
119+
outputArtifactsFolder: $(ob_outputDirectory)
117120
pipArtifactFeeds: "mariner/Mariner-Pypi-Feed"
118121
selfRepoName: self
119122
testSuiteName: "[${{ configuration.name }}] Package test"
120-
testRerunList: "$(testListFromToolchain)"
121123

122124
- script: echo "##vso[task.setvariable variable=rpmsArtifactName;isOutput=true]$(ob_artifactBaseName)"
123125
name: "RPMsArtifactName"
124126
displayName: "Set variable for published artifact name"
125127

126128
- task: PublishPipelineArtifact@1
127129
inputs:
128-
artifact: ${{ variables.rpmsArtifactNameBase }}_${{ configuration.name }}_$(System.JobAttempt)
130+
artifact: $(rpmsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
129131
targetPath: $(ob_outputDirectory)
130132
condition: always()
131133
displayName: "Publish packages build artifacts"
132134

133-
- stage: sodiff_${{ configuration.name }}
135+
- stage: Toolchain_tests_${{ configuration.name }}
136+
dependsOn: Toolchain_${{ configuration.name }}
137+
jobs:
138+
- job: TestToolchainPackages
139+
condition: stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['CalculateToolchainPackageRetestList.toolchainPackageRetestList']
140+
pool:
141+
type: linux
142+
isCustom: true
143+
name: ${{ configuration.agentPool }}
144+
variables:
145+
ob_artifactBaseName: $(toolchainTestsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
146+
ob_outputDirectory: $(Build.ArtifactStagingDirectory)
147+
testListFromToolchain: $[ stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['CalculateToolchainPackageRetestList.toolchainPackageRetestList'] ]
148+
toolchainArtifactName: $[ stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['ToolchainArtifactName.toolchainArtifactName'] ]
149+
steps:
150+
- template: .pipelines/templates/PackageBuild.yml@self
151+
parameters:
152+
checkBuildRetries: "1"
153+
customToolchainArtifactName: $(toolchainArtifactName)
154+
isAllowToolchainRebuilds: true
155+
isCheckBuild: true
156+
isQuickRebuildPackages: true
157+
isUseCCache: true
158+
maxCPU: "${{ configuration.maxCPUs }}"
159+
outputArtifactsFolder: $(ob_outputDirectory)
160+
pipArtifactFeeds: "mariner/Mariner-Pypi-Feed"
161+
selfRepoName: self
162+
srpmPackList: "$(testListFromToolchain)"
163+
testRerunList: "$(testListFromToolchain)"
164+
testSuiteName: "[${{ configuration.name }}] Toolchain test"
165+
166+
- task: PublishPipelineArtifact@1
167+
inputs:
168+
artifact: $(toolchainTestsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
169+
targetPath: $(ob_outputDirectory)
170+
condition: always()
171+
displayName: "Publish toolchain build artifacts"
172+
173+
- stage: Sodiff_${{ configuration.name }}
134174
dependsOn: RPMs_${{ configuration.name }}
135175
jobs:
136176
- job: Sodiff_Check

.pipelines/templates/PackageBuild.yml

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ parameters:
3737
# - name: build-artifacts
3838
# rpmsTarball: cache.tar.gz
3939

40+
- name: isAllowToolchainRebuilds
41+
type: string
42+
default: "default"
43+
values:
44+
- "default"
45+
- "false"
46+
- "true"
47+
4048
- name: isCheckBuild
4149
type: string
4250
default: "default"
@@ -105,6 +113,14 @@ parameters:
105113
type: string
106114
default: "srpms.tar.gz"
107115

116+
- name: packageBuildList
117+
type: string
118+
default: ""
119+
120+
- name: packageRebuildList
121+
type: string
122+
default: ""
123+
108124
- name: pipArtifactFeeds
109125
type: string
110126
default: ""
@@ -184,20 +200,14 @@ steps:
184200
check_build_retries_arg="CHECK_BUILD_RETRIES=${{ parameters.checkBuildRetries }}"
185201
fi
186202
187-
if [[ ${{ parameters.isDeltaBuild }} == "true" ]]; then
188-
delta_fetch_arg="DELTA_FETCH=y"
189-
elif [[ ${{ parameters.isDeltaBuild }} == "false" ]]; then
190-
delta_fetch_arg="DELTA_FETCH=n"
191-
fi
192-
193-
if [[ -n "${{ parameters.maxCascadingRebuilds }}" ]]; then
194-
max_cascading_rebuilds_arg="MAX_CASCADING_REBUILDS=${{ parameters.maxCascadingRebuilds }}"
203+
if [[ -n "${{ parameters.customToolchainArtifactName }}" ]]; then
204+
toolchain_archive_arg="TOOLCHAIN_ARCHIVE=$(toolchainArchive)"
195205
fi
196206
197-
if [[ ${{ parameters.isQuickRebuildPackages }} == "true" ]]; then
198-
quick_rebuild_packages_arg="QUICK_REBUILD_PACKAGES=y"
199-
elif [[ ${{ parameters.isQuickRebuildPackages }} == "false" ]]; then
200-
quick_rebuild_packages_arg="QUICK_REBUILD_PACKAGES=n"
207+
if [[ ${{ parameters.isAllowToolchainRebuilds }} == "true" ]]; then
208+
allow_toolchain_rebuilds_arg="ALLOW_TOOLCHAIN_REBUILDS=y"
209+
elif [[ ${{ parameters.isAllowToolchainRebuilds }} == "false" ]]; then
210+
allow_toolchain_rebuilds_arg="ALLOW_TOOLCHAIN_REBUILDS=n"
201211
fi
202212
203213
if [[ ${{ parameters.isCheckBuild }} == "true" ]]; then
@@ -206,8 +216,16 @@ steps:
206216
run_check_arg="RUN_CHECK=n"
207217
fi
208218
209-
if [[ -n "${{ parameters.customToolchainArtifactName }}" ]]; then
210-
toolchain_archive_arg="TOOLCHAIN_ARCHIVE=$(toolchainArchive)"
219+
if [[ ${{ parameters.isDeltaBuild }} == "true" ]]; then
220+
delta_fetch_arg="DELTA_FETCH=y"
221+
elif [[ ${{ parameters.isDeltaBuild }} == "false" ]]; then
222+
delta_fetch_arg="DELTA_FETCH=n"
223+
fi
224+
225+
if [[ ${{ parameters.isQuickRebuildPackages }} == "true" ]]; then
226+
quick_rebuild_packages_arg="QUICK_REBUILD_PACKAGES=y"
227+
elif [[ ${{ parameters.isQuickRebuildPackages }} == "false" ]]; then
228+
quick_rebuild_packages_arg="QUICK_REBUILD_PACKAGES=n"
211229
fi
212230
213231
if [[ ${{ parameters.isUseCCache }} == "true" ]]; then
@@ -216,15 +234,22 @@ steps:
216234
use_ccache_arg="USE_CCACHE=n"
217235
fi
218236
237+
if [[ -n "${{ parameters.maxCascadingRebuilds }}" ]]; then
238+
max_cascading_rebuilds_arg="MAX_CASCADING_REBUILDS=${{ parameters.maxCascadingRebuilds }}"
239+
fi
240+
219241
sudo make -C "${{ parameters.buildRepoRoot }}/toolkit" build-packages -j$(nproc) \
220242
CONCURRENT_PACKAGE_BUILDS=${{ parameters.concurrentPackageBuilds }} \
221243
CONFIG_FILE="" \
222244
MAX_CPU="${{ parameters.maxCPU }}" \
245+
PACKAGE_BUILD_LIST="${{ parameters.packageBuildList }}" \
246+
PACKAGE_REBUILD_LIST="${{ parameters.packageRebuildList }}" \
223247
REBUILD_TOOLS=y \
224248
REPO_LIST="${{ parameters.extraPackageRepos }}" \
225249
SPECS_DIR="${{ parameters.buildRepoRoot }}/${{ parameters.specsFolderPath }}" \
226250
SRPM_PACK_LIST="${{ parameters.srpmPackList }}" \
227251
TEST_RERUN_LIST="${{ parameters.testRerunList }}" \
252+
$allow_toolchain_rebuilds_arg \
228253
$check_build_retries_arg \
229254
$delta_fetch_arg \
230255
$max_cascading_rebuilds_arg \

.pipelines/templates/PackageTestResultsAnalysis.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,16 @@ steps:
281281
282282
- ${{ if parameters.failOnTestFailures }}:
283283
- bash: |
284-
report_path="${{ parameters.testsWorkspace }}/${{ parameters.reportFileName }}"
285-
if [[ ! -f "$report_path" ]]; then
286-
echo "##[error]Test report not found at '$report_path'."
287-
exit 1
288-
fi
289-
290-
if ! grep -q '^<testsuites.*failures="0"' "$report_path"; then
291-
echo "##[error]Test report has failing tests. See the 'Tests' tab for details."
292-
exit 1
293-
fi
284+
report_path="${{ parameters.testsWorkspace }}/${{ parameters.reportFileName }}"
285+
if [[ ! -f "$report_path" ]]; then
286+
echo "##[error]Test report not found at '$report_path'."
287+
exit 1
288+
fi
289+
290+
# The "failures" attribute indicates completed tests where at least one of the test cases failed.
291+
# The "errors" attribute indicates tests, which failed to complete for whatever reason.
292+
if grep -qP '^<testsuites.*(errors|failures)="(?!0)' "$report_path"; then
293+
echo "##[error]Test report has failing tests. See the 'Tests' tab for details."
294+
exit 1
295+
fi
294296
displayName: "Verify all tests passed"

0 commit comments

Comments
 (0)