Skip to content

Commit

Permalink
Merge branch 'main' into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jslobodzian committed Oct 4, 2024
2 parents 9be1704 + a8d7f4b commit 4b2db53
Show file tree
Hide file tree
Showing 253 changed files with 17,710 additions and 592 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
sudo env "PATH=$PATH" make go-test-coverage
- name: Upload test coverage
uses: actions/upload-artifact@v2.1.4
uses: actions/upload-artifact@v4
with:
name: TestCoverage
path: toolkit/out/tools/test_coverage_report.html
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
fi
exit 0
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: linted_specs
Expand Down
3 changes: 1 addition & 2 deletions .pipelines/containerSourceData/busybox/Dockerfile-Busybox
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ RUN mkdir /staging \
&& pushd /staging \
&& rm -rf boot media mnt opt run \
&& rm -rf usr/lib/sysimage \
&& rm -rf var/cache \
&& rm -rf var/lib/rpm; \
&& rm -rf var/cache; \
ln -vL /staging/usr/sbin/busybox /staging/bin/; \
chroot /staging /bin/busybox --install -s /bin

Expand Down
10 changes: 9 additions & 1 deletion .pipelines/containerSourceData/scripts/BuildGoldenContainer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ set -e
# -j OUTPUT -k ./rpms.tar.gz -l ~/CBL-Mariner/.pipelines/containerSourceData \
# -m "false" -n "false" -p development -q "false" -u "true"

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
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
case ${OPTIONS} in
a ) BASE_IMAGE_NAME_FULL=$OPTARG;;
b ) ACR=$OPTARG;;
Expand All @@ -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
t ) SBOM_SCRIPT=$OPTARG;;
u ) DISTROLESS=$OPTARG;;
v ) VERSION_EXTRACT_CMD=$OPTARG;;
w ) TOOLCHAIN_RPMS_TARBALL=$OPTARG;;

\? )
echo "Error - Invalid Option: -$OPTARG" 1>&2
Expand Down Expand Up @@ -124,6 +125,7 @@ function print_inputs {
echo "SBOM_TOOL_PATH -> $SBOM_TOOL_PATH"
echo "SBOM_SCRIPT -> $SBOM_SCRIPT"
echo "DISTROLESS -> $DISTROLESS"
echo "TOOLCHAIN_RPMS_TARBALL -> $TOOLCHAIN_RPMS_TARBALL"
}

function validate_inputs {
Expand Down Expand Up @@ -167,6 +169,11 @@ function validate_inputs {
exit 1
fi

if [[ ! -f $TOOLCHAIN_RPMS_TARBALL ]]; then
echo "Error - No TOOLCHAIN_RPMS_TARBALL tarball found."
exit 1
fi

if [ ! -d "$CONTAINER_SRC_DIR" ]; then
echo "Error - Container source directory does not exist."
exit 1
Expand Down Expand Up @@ -262,6 +269,7 @@ function prepare_docker_directory {

# Copy files into docker context directory
tar -xf "$RPMS_TARBALL" -C "$HOST_MOUNTED_DIR"/
tar -xf "$TOOLCHAIN_RPMS_TARBALL" -C "$HOST_MOUNTED_DIR/RPMS"/
cp -v "$CONTAINER_SRC_DIR/marinerLocalRepo.repo" "$HOST_MOUNTED_DIR"/
}

Expand Down
74 changes: 57 additions & 17 deletions .pipelines/prchecks/PackageBuildPRCheck.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

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

trigger: none

Expand All @@ -13,15 +11,15 @@ parameters:
type: object
default:
- name: "AMD64"
agentPool: "$(DEV_AMD64_Managed)" # Pool defined inside the "Agent pools (DEV)" variable group.
agentPool: "$(DEV_AMD64_Managed)"
maxCPUs: "$(($(nproc) / 2))"
rawToolchainCacheURL: "$(rawToolchainCacheURL_AMD64)"
rawToolchainExpectedHash: "f56df34b90915c93f772d3961bf5e9eeb8c1233db43dd92070214e4ce6b72894"
rawToolchainCacheURL: "$(rawToolchainCacheURL_AMD64_2.0)"
rawToolchainExpectedHash: "$(rawToolchainCacheHash_AMD64_2.0)"
- name: "ARM64"
agentPool: "$(DEV_ARM64_Managed)" # Pool defined inside the "Agent pools (DEV)" variable group.
agentPool: "$(DEV_ARM64_Managed)"
maxCPUs: "$(($(nproc) / 3))"
rawToolchainCacheURL: "$(rawToolchainCacheURL_ARM64)"
rawToolchainExpectedHash: "65de43b3bdcfdaac71df1f11fd1f830a8109b1eb9d7cb6cbc2e2d0e929d0ef76"
rawToolchainCacheURL: "$(rawToolchainCacheURL_ARM64_2.0)"
rawToolchainExpectedHash: "$(rawToolchainCacheHash_ARM64_2.0)"
- name: debug
type: boolean
default: false
Expand All @@ -36,12 +34,15 @@ resources:

variables:
- group: "Agent pools (DEV)"
- group: "Raw toolchain info"
- name: rpmsArtifactNameBase
value: RPMs
- name: toolchainArtifactNameBase
value: Toolchain
- name: toolchainTestsArtifactNameBase
value: Toolchain_tests
- name: system.debug
value: '${{ parameters.debug }}'
value: "${{ parameters.debug }}"

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

- script: echo "##vso[task.setvariable variable=toolchainArtifactName;isOutput=true]$(ob_artifactBaseName)"
name: "ToolchainArtifactName"
Expand All @@ -100,9 +104,8 @@ extends:
isCustom: true
name: ${{ configuration.agentPool }}
variables:
ob_artifactBaseName: ${{ variables.rpmsArtifactNameBase }}_${{ configuration.name }}_$(System.JobAttempt)
ob_artifactBaseName: $(rpmsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
ob_outputDirectory: $(Build.ArtifactStagingDirectory)
testListFromToolchain: $[ stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['CalculateToolchainPackageRetestList.toolchainPackageRetestList'] ]
toolchainArtifactName: $[ stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['ToolchainArtifactName.toolchainArtifactName'] ]
steps:
- template: .pipelines/templates/PackageBuild.yml@self
Expand All @@ -112,25 +115,62 @@ extends:
isCheckBuild: true
isQuickRebuildPackages: true
isUseCCache: true
outputArtifactsFolder: $(ob_outputDirectory)
maxCPU: "${{ configuration.maxCPUs }}"
outputArtifactsFolder: $(ob_outputDirectory)
pipArtifactFeeds: "mariner/Mariner-Pypi-Feed"
selfRepoName: self
testSuiteName: "[${{ configuration.name }}] Package test"
testRerunList: "$(testListFromToolchain)"

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

- task: PublishPipelineArtifact@1
inputs:
artifact: ${{ variables.rpmsArtifactNameBase }}_${{ configuration.name }}_$(System.JobAttempt)
artifact: $(rpmsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
targetPath: $(ob_outputDirectory)
condition: always()
displayName: "Publish packages build artifacts"

- stage: sodiff_${{ configuration.name }}
- stage: Toolchain_tests_${{ configuration.name }}
dependsOn: Toolchain_${{ configuration.name }}
jobs:
- job: TestToolchainPackages
condition: stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['CalculateToolchainPackageRetestList.toolchainPackageRetestList']
pool:
type: linux
isCustom: true
name: ${{ configuration.agentPool }}
variables:
ob_artifactBaseName: $(toolchainTestsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
ob_outputDirectory: $(Build.ArtifactStagingDirectory)
testListFromToolchain: $[ stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['CalculateToolchainPackageRetestList.toolchainPackageRetestList'] ]
toolchainArtifactName: $[ stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['ToolchainArtifactName.toolchainArtifactName'] ]
steps:
- template: .pipelines/templates/PackageBuild.yml@self
parameters:
checkBuildRetries: "1"
customToolchainArtifactName: $(toolchainArtifactName)
isAllowToolchainRebuilds: true
isCheckBuild: true
isQuickRebuildPackages: true
isUseCCache: true
maxCPU: "${{ configuration.maxCPUs }}"
outputArtifactsFolder: $(ob_outputDirectory)
pipArtifactFeeds: "mariner/Mariner-Pypi-Feed"
selfRepoName: self
srpmPackList: "$(testListFromToolchain)"
testRerunList: "$(testListFromToolchain)"
testSuiteName: "[${{ configuration.name }}] Toolchain test"

- task: PublishPipelineArtifact@1
inputs:
artifact: $(toolchainTestsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
targetPath: $(ob_outputDirectory)
condition: always()
displayName: "Publish toolchain build artifacts"

- stage: Sodiff_${{ configuration.name }}
dependsOn: RPMs_${{ configuration.name }}
jobs:
- job: Sodiff_Check
Expand Down
53 changes: 39 additions & 14 deletions .pipelines/templates/PackageBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ parameters:
# - name: build-artifacts
# rpmsTarball: cache.tar.gz

- name: isAllowToolchainRebuilds
type: string
default: "default"
values:
- "default"
- "false"
- "true"

- name: isCheckBuild
type: string
default: "default"
Expand Down Expand Up @@ -105,6 +113,14 @@ parameters:
type: string
default: "srpms.tar.gz"

- name: packageBuildList
type: string
default: ""

- name: packageRebuildList
type: string
default: ""

- name: pipArtifactFeeds
type: string
default: ""
Expand Down Expand Up @@ -184,20 +200,14 @@ steps:
check_build_retries_arg="CHECK_BUILD_RETRIES=${{ parameters.checkBuildRetries }}"
fi
if [[ ${{ parameters.isDeltaBuild }} == "true" ]]; then
delta_fetch_arg="DELTA_FETCH=y"
elif [[ ${{ parameters.isDeltaBuild }} == "false" ]]; then
delta_fetch_arg="DELTA_FETCH=n"
fi
if [[ -n "${{ parameters.maxCascadingRebuilds }}" ]]; then
max_cascading_rebuilds_arg="MAX_CASCADING_REBUILDS=${{ parameters.maxCascadingRebuilds }}"
if [[ -n "${{ parameters.customToolchainArtifactName }}" ]]; then
toolchain_archive_arg="TOOLCHAIN_ARCHIVE=$(toolchainArchive)"
fi
if [[ ${{ parameters.isQuickRebuildPackages }} == "true" ]]; then
quick_rebuild_packages_arg="QUICK_REBUILD_PACKAGES=y"
elif [[ ${{ parameters.isQuickRebuildPackages }} == "false" ]]; then
quick_rebuild_packages_arg="QUICK_REBUILD_PACKAGES=n"
if [[ ${{ parameters.isAllowToolchainRebuilds }} == "true" ]]; then
allow_toolchain_rebuilds_arg="ALLOW_TOOLCHAIN_REBUILDS=y"
elif [[ ${{ parameters.isAllowToolchainRebuilds }} == "false" ]]; then
allow_toolchain_rebuilds_arg="ALLOW_TOOLCHAIN_REBUILDS=n"
fi
if [[ ${{ parameters.isCheckBuild }} == "true" ]]; then
Expand All @@ -206,8 +216,16 @@ steps:
run_check_arg="RUN_CHECK=n"
fi
if [[ -n "${{ parameters.customToolchainArtifactName }}" ]]; then
toolchain_archive_arg="TOOLCHAIN_ARCHIVE=$(toolchainArchive)"
if [[ ${{ parameters.isDeltaBuild }} == "true" ]]; then
delta_fetch_arg="DELTA_FETCH=y"
elif [[ ${{ parameters.isDeltaBuild }} == "false" ]]; then
delta_fetch_arg="DELTA_FETCH=n"
fi
if [[ ${{ parameters.isQuickRebuildPackages }} == "true" ]]; then
quick_rebuild_packages_arg="QUICK_REBUILD_PACKAGES=y"
elif [[ ${{ parameters.isQuickRebuildPackages }} == "false" ]]; then
quick_rebuild_packages_arg="QUICK_REBUILD_PACKAGES=n"
fi
if [[ ${{ parameters.isUseCCache }} == "true" ]]; then
Expand All @@ -216,15 +234,22 @@ steps:
use_ccache_arg="USE_CCACHE=n"
fi
if [[ -n "${{ parameters.maxCascadingRebuilds }}" ]]; then
max_cascading_rebuilds_arg="MAX_CASCADING_REBUILDS=${{ parameters.maxCascadingRebuilds }}"
fi
sudo make -C "${{ parameters.buildRepoRoot }}/toolkit" build-packages -j$(nproc) \
CONCURRENT_PACKAGE_BUILDS=${{ parameters.concurrentPackageBuilds }} \
CONFIG_FILE="" \
MAX_CPU="${{ parameters.maxCPU }}" \
PACKAGE_BUILD_LIST="${{ parameters.packageBuildList }}" \
PACKAGE_REBUILD_LIST="${{ parameters.packageRebuildList }}" \
REBUILD_TOOLS=y \
REPO_LIST="${{ parameters.extraPackageRepos }}" \
SPECS_DIR="${{ parameters.buildRepoRoot }}/${{ parameters.specsFolderPath }}" \
SRPM_PACK_LIST="${{ parameters.srpmPackList }}" \
TEST_RERUN_LIST="${{ parameters.testRerunList }}" \
$allow_toolchain_rebuilds_arg \
$check_build_retries_arg \
$delta_fetch_arg \
$max_cascading_rebuilds_arg \
Expand Down
22 changes: 12 additions & 10 deletions .pipelines/templates/PackageTestResultsAnalysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,16 @@ steps:
- ${{ if parameters.failOnTestFailures }}:
- bash: |
report_path="${{ parameters.testsWorkspace }}/${{ parameters.reportFileName }}"
if [[ ! -f "$report_path" ]]; then
echo "##[error]Test report not found at '$report_path'."
exit 1
fi
if ! grep -q '^<testsuites.*failures="0"' "$report_path"; then
echo "##[error]Test report has failing tests. See the 'Tests' tab for details."
exit 1
fi
report_path="${{ parameters.testsWorkspace }}/${{ parameters.reportFileName }}"
if [[ ! -f "$report_path" ]]; then
echo "##[error]Test report not found at '$report_path'."
exit 1
fi
# The "failures" attribute indicates completed tests where at least one of the test cases failed.
# The "errors" attribute indicates tests, which failed to complete for whatever reason.
if grep -qP '^<testsuites.*(errors|failures)="(?!0)' "$report_path"; then
echo "##[error]Test report has failing tests. See the 'Tests' tab for details."
exit 1
fi
displayName: "Verify all tests passed"
Loading

0 comments on commit 4b2db53

Please sign in to comment.