msbuild

Форк
0
/
source-build.yml 
129 строк · 6.0 Кб
1
parameters:
2
  # This template adds arcade-powered source-build to CI.
3

4
  # This is a 'steps' template, and is intended for advanced scenarios where the existing build
5
  # infra has a careful build methodology that must be followed. For example, a repo
6
  # (dotnet/runtime) might choose to clone the GitHub repo only once and store it as a pipeline
7
  # artifact for all subsequent jobs to use, to reduce dependence on a strong network connection to
8
  # GitHub. Using this steps template leaves room for that infra to be included.
9

10
  # Defines the platform on which to run the steps. See 'eng/common/templates/job/source-build.yml'
11
  # for details. The entire object is described in the 'job' template for simplicity, even though
12
  # the usage of the properties on this object is split between the 'job' and 'steps' templates.
13
  platform: {}
14

15
steps:
16
# Build. Keep it self-contained for simple reusability. (No source-build-specific job variables.)
17
- script: |
18
    set -x
19
    df -h
20

21
    # If building on the internal project, the artifact feeds variable may be available (usually only if needed)
22
    # In that case, call the feed setup script to add internal feeds corresponding to public ones.
23
    # In addition, add an msbuild argument to copy the WIP from the repo to the target build location.
24
    # This is because SetupNuGetSources.sh will alter the current NuGet.config file, and we need to preserve those
25
    # changes.
26
    internalRestoreArgs=
27
    if [ '$(dn-bot-dnceng-artifact-feeds-rw)' != '$''(dn-bot-dnceng-artifact-feeds-rw)' ]; then
28
      # Temporarily work around https://github.com/dotnet/arcade/issues/7709
29
      chmod +x $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
30
      $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh $(Build.SourcesDirectory)/NuGet.config $(dn-bot-dnceng-artifact-feeds-rw)
31
      internalRestoreArgs='/p:CopyWipIntoInnerSourceBuildRepo=true'
32

33
      # The 'Copy WIP' feature of source build uses git stash to apply changes from the original repo.
34
      # This only works if there is a username/email configured, which won't be the case in most CI runs.
35
      git config --get user.email
36
      if [ $? -ne 0 ]; then
37
        git config user.email dn-bot@microsoft.com
38
        git config user.name dn-bot
39
      fi
40
    fi
41

42
    # If building on the internal project, the internal storage variable may be available (usually only if needed)
43
    # In that case, add variables to allow the download of internal runtimes if the specified versions are not found
44
    # in the default public locations.
45
    internalRuntimeDownloadArgs=
46
    if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then
47
      internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://dotnetbuilds.blob.core.windows.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)'
48
    fi
49

50
    buildConfig=Release
51
    # Check if AzDO substitutes in a build config from a variable, and use it if so.
52
    if [ '$(_BuildConfig)' != '$''(_BuildConfig)' ]; then
53
      buildConfig='$(_BuildConfig)'
54
    fi
55

56
    officialBuildArgs=
57
    if [ '${{ and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}' = 'True' ]; then
58
      officialBuildArgs='/p:DotNetPublishUsingPipelines=true /p:OfficialBuildId=$(BUILD.BUILDNUMBER)'
59
    fi
60

61
    targetRidArgs=
62
    if [ '${{ parameters.platform.targetRID }}' != '' ]; then
63
      targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}'
64
    fi
65

66
    runtimeOsArgs=
67
    if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then
68
      runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}'
69
    fi
70

71
    baseOsArgs=
72
    if [ '${{ parameters.platform.baseOS }}' != '' ]; then
73
      baseOsArgs='/p:BaseOS=${{ parameters.platform.baseOS }}'
74
    fi
75

76
    publishArgs=
77
    if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then
78
      publishArgs='--publish'
79
    fi
80

81
    assetManifestFileName=SourceBuild_RidSpecific.xml
82
    if [ '${{ parameters.platform.name }}' != '' ]; then
83
      assetManifestFileName=SourceBuild_${{ parameters.platform.name }}.xml
84
    fi
85

86
    ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \
87
      --configuration $buildConfig \
88
      --restore --build --pack $publishArgs -bl \
89
      $officialBuildArgs \
90
      $internalRuntimeDownloadArgs \
91
      $internalRestoreArgs \
92
      $targetRidArgs \
93
      $runtimeOsArgs \
94
      $baseOsArgs \
95
      /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \
96
      /p:ArcadeBuildFromSource=true \
97
      /p:AssetManifestFileName=$assetManifestFileName
98
  displayName: Build
99

100
# Upload build logs for diagnosis.
101
- task: CopyFiles@2
102
  displayName: Prepare BuildLogs staging directory
103
  inputs:
104
    SourceFolder: '$(Build.SourcesDirectory)'
105
    Contents: |
106
      **/*.log
107
      **/*.binlog
108
      artifacts/source-build/self/prebuilt-report/**
109
    TargetFolder: '$(Build.StagingDirectory)/BuildLogs'
110
    CleanTargetFolder: true
111
  continueOnError: true
112
  condition: succeededOrFailed()
113

114
- task: PublishPipelineArtifact@1
115
  displayName: Publish BuildLogs
116
  inputs:
117
    targetPath: '$(Build.StagingDirectory)/BuildLogs'
118
    artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt)
119
  continueOnError: true
120
  condition: succeededOrFailed()
121

122
# Manually inject component detection so that we can ignore the source build upstream cache, which contains
123
# a nupkg cache of input packages (a local feed).
124
# This path must match the upstream cache path in property 'CurrentRepoSourceBuiltNupkgCacheDir'
125
# in src\Microsoft.DotNet.Arcade.Sdk\tools\SourceBuild\SourceBuildArcade.targets
126
- task: ComponentGovernanceComponentDetection@0
127
  displayName: Component Detection (Exclude upstream cache)
128
  inputs:
129
    ignoreDirectories: '$(Build.SourcesDirectory)/artifacts/source-build/self/src/artifacts/obj/source-built-upstream-cache'
130

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.