-
Notifications
You must be signed in to change notification settings - Fork 679
Added delta toolchain build to automated PR check #5687
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
Merged
PawelWMS
merged 33 commits into
microsoft:main
from
PawelWMS:pawelwi/add_toolchain_build
Jun 21, 2023
Merged
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 b8af4c8
Fixing download.
PawelWMS 237b2e6
Speed-up downloads and builds.
PawelWMS 80efb38
Refactoring.
PawelWMS a7bebc5
Moving building to pipeline.
PawelWMS 9f467bd
YAML fix.
PawelWMS c70ca67
Remove free-standing script.
PawelWMS 389226c
Add publishing.
PawelWMS d79a9d0
Fixing publishing.
PawelWMS b036756
Fixing publishing.
PawelWMS f567e8b
Add manual publishing.
PawelWMS cd8f499
Add manual publishing 2.
PawelWMS 7975fc5
Test.
PawelWMS 9332a7f
Test.
PawelWMS 394786a
Test.
PawelWMS 1066ab8
Test.
PawelWMS 1a02699
Test.
PawelWMS fd8e6c6
Test.
PawelWMS 2204eb9
Clean-up.
PawelWMS 2cb4b3b
Clean-up.
PawelWMS eee8cea
Clean-up.
PawelWMS f5b9d59
Adding comments.
PawelWMS 9f430a4
Always publish,
PawelWMS 4df8c4f
Fixing build.
PawelWMS 7647b43
Revert "Fixing build."
PawelWMS 263f943
Adding conditional publishing.
PawelWMS 1e12741
Revert "Adding conditional publishing."
PawelWMS 514d216
Moving pipeline.
PawelWMS fe74b06
Extracting raw toolchain download to a separate template.
PawelWMS ed5d301
Extracting raw toolchain download to a separate template.
PawelWMS 8f1e694
Clean-up.
PawelWMS 169240f
Moving agent pools to pipeline variables.
PawelWMS f6f5e7c
Removing unused trigger setting.
PawelWMS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| 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" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.