|
| 1 | +name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) |
| 2 | + |
| 3 | +trigger: |
| 4 | + batch: true |
| 5 | + branches: |
| 6 | + include: |
| 7 | + - master |
| 8 | + paths: |
| 9 | + exclude: |
| 10 | + - /.dependabot/* |
| 11 | + - /.poshchan/* |
| 12 | + - /.github/**/* |
| 13 | + - /.vscode/**/* |
| 14 | + - /.vsts-ci/misc-analysis.yml |
| 15 | + - /tools/**/* |
| 16 | + - .editorconfig |
| 17 | + - .gitattributes |
| 18 | + - .gitignore |
| 19 | + - /docs/**/* |
| 20 | + - /CHANGELOG.md |
| 21 | + - /CONTRIBUTING.md |
| 22 | + - /README.md |
| 23 | + - /LICENSE.txt |
| 24 | + - /CODE_OF_CONDUCT.md |
| 25 | + |
| 26 | +stages: |
| 27 | +- stage: Build |
| 28 | + displayName: Build PowerShell Package |
| 29 | + jobs: |
| 30 | + - job: BuildPkg |
| 31 | + displayName: Build Package |
| 32 | + pool: |
| 33 | + name: 'Package ES CodeHub Lab E' |
| 34 | + steps: |
| 35 | + - powershell: | |
| 36 | + $powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell' |
| 37 | + Invoke-WebRequest -Uri https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -outfile ./install-powershell.ps1 |
| 38 | + ./install-powershell.ps1 -Destination $powerShellPath |
| 39 | + $vstsCommandString = "vso[task.setvariable variable=PATH]$powerShellPath;$env:PATH" |
| 40 | + Write-Host "sending " + $vstsCommandString |
| 41 | + Write-Host "##$vstsCommandString" |
| 42 | + displayName: Install PowerShell Core |
| 43 | +
|
| 44 | + - task: PkgESSetupBuild@10 |
| 45 | + displayName: 'Package ES - Setup Build' |
| 46 | + inputs: |
| 47 | + productName: PSDesiredStateConfiguration |
| 48 | + |
| 49 | + - template: templates/shouldsign.yml |
| 50 | + |
| 51 | + - powershell: | |
| 52 | + Get-ChildItem -Path env: |
| 53 | + displayName: Capture environment |
| 54 | + condition: succeededOrFailed() |
| 55 | +
|
| 56 | + - template: templates/ci-build.yml |
| 57 | + |
| 58 | + - powershell: | |
| 59 | + Write-Verbose "BUILD_OUTPUT_PATH- $env:BUILD_OUTPUT_PATH" -Verbose |
| 60 | + Write-Verbose "SIGNED_OUTPUT_PATH- $env:SIGNED_OUTPUT_PATH" -Verbose |
| 61 | + Copy-Item $env:BUILD_OUTPUT_PATH $env:SIGNED_OUTPUT_PATH -Recurse -Force |
| 62 | + displayName: Copy unsigned files first |
| 63 | +
|
| 64 | + - task: PkgESCodeSign@10 |
| 65 | + displayName: 'CodeSign tools/releaseBuild/signing.xml' |
| 66 | + env: |
| 67 | + SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
| 68 | + inputs: |
| 69 | + signConfigXml: tools/releaseBuild/signing.xml |
| 70 | + inPathRoot: '$(BUILD_OUTPUT_PATH)' |
| 71 | + outPathRoot: '$(SIGNED_OUTPUT_PATH)' |
| 72 | + condition: and(succeeded(), eq(variables['SHOULD_SIGN'], 'true')) |
| 73 | + |
| 74 | + - task: PowerShell@1 |
| 75 | + displayName: 'Create catalog file' |
| 76 | + inputs: |
| 77 | + scriptType: inlineScript |
| 78 | + inlineScript: | |
| 79 | + $signedDir = "$env:SIGNED_OUTPUT_PATH\PSDesiredStateConfiguration" |
| 80 | + New-FileCatalog -CatalogFilePath "$env:SIGNED_OUTPUT_PATH\PSDesiredStateConfiguration\PSDesiredStateConfiguration.cat" -Path "$signedDir" |
| 81 | +
|
| 82 | + - task: PkgESCodeSign@10 |
| 83 | + displayName: 'CodeSign tools/releaseBuild/FileCatalogSigning.xml' |
| 84 | + env: |
| 85 | + SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
| 86 | + inputs: |
| 87 | + signConfigXml: tools/releaseBuild/FileCatalogSigning.xml |
| 88 | + inPathRoot: '$(SIGNED_OUTPUT_PATH)' |
| 89 | + outPathRoot: '$(SIGNED_OUTPUT_PATH)' |
| 90 | + condition: and(succeeded(), eq(variables['SHOULD_SIGN'], 'true')) |
| 91 | + |
| 92 | + - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 |
| 93 | + displayName: 'Component Detection' |
| 94 | + |
| 95 | + - task: AntiMalware@3 |
| 96 | + inputs: |
| 97 | + InputType: 'Basic' |
| 98 | + ScanType: 'CustomScan' |
| 99 | + FileDirPath: '$(SIGNED_OUTPUT_PATH)' |
| 100 | + EnableServices: false |
| 101 | + SupportLogOnError: false |
| 102 | + TreatSignatureUpdateFailureAs: 'Warning' |
| 103 | + SignatureFreshness: 'UpToDate' |
| 104 | + TreatStaleSignatureAs: 'Error' |
| 105 | + |
| 106 | + - task: PoliCheck@1 |
| 107 | + condition: succeededOrFailed() |
| 108 | + inputs: |
| 109 | + targetType: F |
| 110 | + optionsFC: 0 |
| 111 | + optionsXS: 0 |
| 112 | + optionsPE: '1|2|3|4' |
| 113 | + optionsHMENABLE: 0 |
| 114 | + optionsFTPATH: '$(Build.SourcesDirectory)\tools\terms\FileTypeSet.xml' |
| 115 | + |
| 116 | + - task: CredScan@2 |
| 117 | + condition: succeededOrFailed() |
| 118 | + |
| 119 | + # Publish results as artifacts |
| 120 | + - task: PublishSecurityAnalysisLogs@3 |
| 121 | + condition: succeededOrFailed() |
| 122 | + inputs: |
| 123 | + ArtifactName: 'CodeAnalysisLogs' |
| 124 | + ArtifactType: 'Container' |
| 125 | + |
| 126 | + # Publish to TSA server |
| 127 | + # - task: TSAUpload@1 |
| 128 | + # condition: succeededOrFailed() |
| 129 | + # continueOnError: true |
| 130 | + # inputs: |
| 131 | + # tsaVersion: 'TsaV2' |
| 132 | + # codebase: 'Existing' |
| 133 | + # tsaEnvironment: 'PROD' |
| 134 | + # codeBaseName: 'PSDesiredStateConfiguration_20190828' |
| 135 | + # uploadAPIScan: false |
| 136 | + # uploadBinSkim: false |
| 137 | + # uploadCredScan: true |
| 138 | + # uploadFortifySCA: false |
| 139 | + # uploadFxCop: false |
| 140 | + # uploadModernCop: false |
| 141 | + # uploadPoliCheck: true |
| 142 | + # uploadPREfast: false |
| 143 | + # uploadRoslyn: false |
| 144 | + # uploadTSLint: false |
| 145 | + # uploadAsync: true |
| 146 | + |
| 147 | + - pwsh: | |
| 148 | + $(Build.SourcesDirectory)/build.ps1 -Publish -Signed |
| 149 | + displayName: Publish |
| 150 | + timeoutInMinutes: 10 |
0 commit comments