Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
53c374a
Adding toolchain build step.
PawelWMS Jun 13, 2023
b8af4c8
Fixing download.
PawelWMS Jun 13, 2023
237b2e6
Speed-up downloads and builds.
PawelWMS Jun 13, 2023
80efb38
Refactoring.
PawelWMS Jun 13, 2023
a7bebc5
Moving building to pipeline.
PawelWMS Jun 13, 2023
9f467bd
YAML fix.
PawelWMS Jun 13, 2023
c70ca67
Remove free-standing script.
PawelWMS Jun 14, 2023
389226c
Add publishing.
PawelWMS Jun 14, 2023
d79a9d0
Fixing publishing.
PawelWMS Jun 14, 2023
b036756
Fixing publishing.
PawelWMS Jun 14, 2023
f567e8b
Add manual publishing.
PawelWMS Jun 14, 2023
cd8f499
Add manual publishing 2.
PawelWMS Jun 14, 2023
7975fc5
Test.
PawelWMS Jun 14, 2023
9332a7f
Test.
PawelWMS Jun 14, 2023
394786a
Test.
PawelWMS Jun 14, 2023
1066ab8
Test.
PawelWMS Jun 14, 2023
1a02699
Test.
PawelWMS Jun 14, 2023
fd8e6c6
Test.
PawelWMS Jun 14, 2023
2204eb9
Clean-up.
PawelWMS Jun 14, 2023
2cb4b3b
Clean-up.
PawelWMS Jun 14, 2023
eee8cea
Clean-up.
PawelWMS Jun 14, 2023
f5b9d59
Adding comments.
PawelWMS Jun 14, 2023
9f430a4
Always publish,
PawelWMS Jun 14, 2023
4df8c4f
Fixing build.
PawelWMS Jun 14, 2023
7647b43
Revert "Fixing build."
PawelWMS Jun 14, 2023
263f943
Adding conditional publishing.
PawelWMS Jun 14, 2023
1e12741
Revert "Adding conditional publishing."
PawelWMS Jun 14, 2023
514d216
Moving pipeline.
PawelWMS Jun 14, 2023
fe74b06
Extracting raw toolchain download to a separate template.
PawelWMS Jun 15, 2023
ed5d301
Extracting raw toolchain download to a separate template.
PawelWMS Jun 16, 2023
8f1e694
Clean-up.
PawelWMS Jun 16, 2023
169240f
Moving agent pools to pipeline variables.
PawelWMS Jun 16, 2023
f6f5e7c
Removing unused trigger setting.
PawelWMS Jun 16, 2023
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
62 changes: 0 additions & 62 deletions .pipelines/PackageBuildPRCheck.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .pipelines/livepatching/BuildLivepatch.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

set -e

ROOT_DIR="$(git rev-parse --show-toplevel)"
Expand Down
3 changes: 3 additions & 0 deletions .pipelines/livepatching/BuildLivepatchSigned.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

set -e

ROOT_DIR="$(git rev-parse --show-toplevel)"
Expand Down
93 changes: 93 additions & 0 deletions .pipelines/prchecks/PackageBuildPRCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# 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
# - agentPool_AMD64
# - agentPool_ARM64
# - agentVMName_AMD64
# - agentVMName_ARM64

trigger: none

parameters:
- name: buildConfiguration
type: object
default:
- name: "AMD64"
agentPool: "$(agentPool_AMD64)"
agentVMName: "$(agentVMName_AMD64)"
rawToolchainCacheURL: "$(rawToolchainCacheURL_AMD64)"
rawToolchainExpectedHash: "f56df34b90915c93f772d3961bf5e9eeb8c1233db43dd92070214e4ce6b72894"
- name: "ARM64"
agentPool: "$(agentPool_ARM64)"
agentVMName: "$(agentVMName_ARM64)"
rawToolchainCacheURL: "$(rawToolchainCacheURL_ARM64)"
rawToolchainExpectedHash: "65de43b3bdcfdaac71df1f11fd1f830a8109b1eb9d7cb6cbc2e2d0e929d0ef76"

resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main

extends:
template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates
parameters:
featureFlags:
runOnHost: true
globalSdl:
credscan:
suppressionsFile: .config/CredScanSuppressions.json
stages:
- ${{ each configuration in parameters.buildConfiguration }}:
- stage: Toolchain_${{ configuration.name }}
jobs:
- job: Build
pool:
type: linux
isCustom: true
name: ${{ configuration.agentPool }}
vmImage: ${{ configuration.agentVMName }}
variables:
ob_outputDirectory: $(Build.ArtifactStagingDirectory)
steps:
- template: .pipelines/templates/RawToolchainDownload.yml@self
parameters:
rawToolchainCacheURL: ${{ configuration.rawToolchainCacheURL }}
rawToolchainExpectedHash: ${{ configuration.rawToolchainExpectedHash }}

- template: .pipelines/templates/ToolchainBuild.yml@self
parameters:
buildArtifactsFolder: $(ob_outputDirectory)

# 1. Automatic publishing seems to be broken in the OneBranch templates when the build runs directly on the agent host.
# Once that's fixed, we should remove this step.
# 2. The value for 'artifact' cannot be changed, as this is the only value OneBranch accepts.
# We cannot also use pre-defined variables like "drop_$(System.StageName)_$(Agent.JobName)", to automatically track name changes.
- task: PublishPipelineArtifact@1
inputs:
artifact: drop_Toolchain_${{ configuration.name }}_Build
targetPath: $(ob_outputDirectory)
condition: always()
displayName: 'Publish toolchain artifacts'

- stage: RPMs_${{ configuration.name }}
dependsOn: Toolchain_${{ configuration.name }}
jobs:
- job: Build
pool:
type: linux
isCustom: true
name: ${{ configuration.agentPool }}
vmImage: ${{ configuration.agentVMName }}
strategy:
matrix:
regular:
runCheck: 'false'
ptest:
runCheck: 'true'
steps:
- template: .pipelines/templates/PackageBuild.yml@self
parameters:
isCheckBuild: '$(runCheck)'
37 changes: 37 additions & 0 deletions .pipelines/templates/RawToolchainDownload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
parameters:
- name: coreRepoRoot
type: string
default: "$(Build.SourcesDirectory)"

- name: rawToolchainCacheURL
type: string

- name: rawToolchainExpectedHash
type: string

steps:
- bash: |
set -e

raw_toolchain_file_path="${{ parameters.coreRepoRoot }}/build/toolchain/toolchain_from_container.tar.gz"

echo "-- Downloading cached raw toolchain."

mkdir -p "$(dirname "$raw_toolchain_file_path")"
if ! wget --quiet --timeout=30 --continue "$RAW_TOOLCHAIN_URL" -O "$raw_toolchain_file_path"; then
echo "-- ERROR: failed to download raw toolchain cache." >&2
exit 1
fi

# Verifying toolchain's SHA-256 hash.
cache_sha256=$(sha256sum "$raw_toolchain_file_path" | cut -d' ' -f1)
if [[ "$cache_sha256" != "${{ parameters.rawToolchainExpectedHash }}" ]]; then
echo "-- ERROR: raw toolchain hash verification failed. Expected (${{ parameters.rawToolchainExpectedHash }}). Got ($cache_sha256)." >&2
exit 1
fi
echo "-- Raw toolchain hash OK."

touch "$raw_toolchain_file_path"
env:
RAW_TOOLCHAIN_URL: ${{ parameters.rawToolchainCacheURL }}
displayName: "Populate raw toolchain"
40 changes: 37 additions & 3 deletions .pipelines/templates/ToolchainBuild.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
parameters:
- name: buildArtifactsFolder
type: string
default: "$(Build.ArtifactStagingDirectory)"

- name: coreRepoRoot
type: string
default: "$(Build.SourcesDirectory)"

steps:
- script: |
echo "The used architecture is: $(uname -m)"
displayName: 'Use parameter'
- bash: sudo make -C "${{ parameters.coreRepoRoot }}/toolkit" "-j$(nproc)" toolchain QUICK_REBUILD=y
displayName: "Build toolchain"

- bash: |
failed_rpms_log="${{ parameters.coreRepoRoot }}/build/logs/toolchain/failures.txt"

if [[ -f "$failed_rpms_log" ]]; then
echo "List of RPMs that failed to build:" >&2
cat "$failed_rpms_log" >&2
else
echo "Build failed - no specific RPM" >&2
fi
condition: failed()
displayName: "Print failed RPMs"

- bash: |
published_artifacts_dir="${{ parameters.buildArtifactsFolder }}/ARTIFACTS"
mkdir -p "$published_artifacts_dir"
cp "${{ parameters.coreRepoRoot }}"/build/toolchain/toolchain_built_{,s}rpms_all.tar.gz "$published_artifacts_dir"
Comment thread
PawelWMS marked this conversation as resolved.
condition: succeeded()
displayName: "Copy artifacts for publishing"

- bash: |
published_logs_dir="${{ parameters.buildArtifactsFolder }}/LOGS"
mkdir -p "$published_logs_dir"
tar -C "${{ parameters.coreRepoRoot }}/build/logs/toolchain" -czf "$published_logs_dir/toolchain.logs.tar.gz" .
condition: always()
displayName: "Copy logs for publishing"