This commit is contained in:
tracyboehrer 2021-07-02 14:35:10 -05:00 коммит произвёл GitHub
Родитель 4be3f74c24
Коммит 58c233df13
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 348 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,348 @@
# 'Allow scripts to access the OAuth token' was selected in pipeline. Add the following YAML to any steps requiring access:
# env:
# MY_ACCESS_TOKEN: $(System.AccessToken)
# Variable 'PackageVersion' was defined in the Variables tab
# Variable 'PassPhrase' was defined in the Variables tab
# Variable Group 'JavaVariableGroup' was defined in the Variables tab
# Variable Group 'JavaSigningVariableGroup' was defined in the Variables tab
# Cron Schedules have been converted using UTC Time Zone and may need to be updated for your location
schedules:
- cron: 0 3 * * 1,2,3,4,5
branches:
include:
- bruce/javasigning12-2
resources:
repositories:
- repository: self
type: git
ref: main
jobs:
- job: Phase_1
displayName: Phase 1
cancelTimeoutInMinutes: 1
pool:
vmImage: windows-2019
steps:
- checkout: self
persistCredentials: True
- task: tagBuildOrRelease@0
displayName: Tag Build with package version
inputs:
tags: PackageVersion=$(PackageVersion)
- task: PowerShell@2
displayName: Maven set versions in pom files
inputs:
targetType: inline
script: >
Write-Host "version = $(PackageVersion)"
Write-Host "Setting module versions"
mvn versions:set -DnewVersion="$(PackageVersion)" --no-transfer-progress
Write-Host "Setting sample versions"
mvn versions:set -DnewVersion="$(PackageVersion)" -f samples\servlet-echo\pom.xml --no-transfer-progress
mvn versions:set -DnewVersion="$(PackageVersion)" -f samples\02.echo-bot\pom.xml --no-transfer-progress
mvn versions:set -DnewVersion="$(PackageVersion)" -f samples\03.welcome-user\pom.xml --no-transfer-progress
mvn versions:set -DnewVersion="$(PackageVersion)" -f samples\08.suggested-actions\pom.xml --no-transfer-progress
mvn versions:set -DnewVersion="$(PackageVersion)" -f samples\16.proactive-messages\pom.xml --no-transfer-progress
mvn versions:set -DnewVersion="$(PackageVersion)" -f samples\45.state-management\pom.xml --no-transfer-progress
mvn versions:set -DnewVersion="$(PackageVersion)" -f samples\47.inspection\pom.xml --no-transfer-progress
Write-Host "Setting Sample dependency versions"
mvn versions:use-dep-version -f samples\servlet-echo\pom.xml -Dincludes='com.microsoft.bot:bot-integration-core' -DdepVersion="$(PackageVersion)" -DforceVersion=true
mvn versions:use-dep-version -f samples\02.echo-bot\pom.xml -Dincludes='com.microsoft.bot:bot-integration-core' -DdepVersion="$(PackageVersion)" -DforceVersion=true
mvn versions:use-dep-version -f samples\03.welcom-user\pom.xml -Dincludes='com.microsoft.bot:bot-integration-core' -DdepVersion="$(PackageVersion)" -DforceVersion=true
mvn versions:use-dep-version -f samples\08.suggested-actions\pom.xml -Dincludes='com.microsoft.bot:bot-integration-core' -DdepVersion="$(PackageVersion)" -DforceVersion=true
mvn versions:use-dep-version -f samples\16.proactive-messages\pom.xml -Dincludes='com.microsoft.bot:bot-integration-core' -DdepVersion="$(PackageVersion)" -DforceVersion=true
mvn versions:use-dep-version -f samples\45.state-management\pom.xml -Dincludes='com.microsoft.bot:bot-integration-core' -DdepVersion="$(PackageVersion)" -DforceVersion=true
mvn versions:use-dep-version -f samples\47.inspection\pom.xml -Dincludes='com.microsoft.bot:bot-integration-core' -DdepVersion="$(PackageVersion)" -DforceVersion=true
Write-Host "Completed"
- task: PowerShell@2
displayName: Import signing keys
continueOnError: True
timeoutInMinutes: 1
inputs:
targetType: inline
script: >+
gpg --version
Write-Host "Public key:"
$file = "public.pgp";
$key = "$(PgpSigningPublicKey)";
# Restore the missing newlines to the key
$cut1 = $key.Substring(0, 80).LastIndexOf('-') + 2;
$cut2 = $key.Substring($cut1).IndexOf('-') + $cut1;
$firstLine = $key.Substring(0, $cut1)
$lastLine = $key.Substring($cut2)
$middleLine = $key.Substring($cut1, $cut2 - $cut1);
$middleLine = $middleLine.Replace(" ", "`r`n");
$key2 = -Join ($firstLine, "`r`n", $middleLine, $lastLine);
New-Item -Path $file -ItemType "file" -Value $key2;
#'-------------'; get-content "$file"; '==================='
gpg --import $file
Remove-Item $file
Write-Host "Private key:"
$file = "private.pgp";
$key = "$(PgpSigningPrivateKey)";
$passPhrase = "$(PassPhrase)";
$cut1 = $key.Substring(0, 80).LastIndexOf('-') + 2;
$cut2 = $key.Substring($cut1).IndexOf('-') + $cut1;
$firstLine = $key.Substring(0, $cut1)
$lastLine = $key.Substring($cut2)
$middleLine = $key.Substring($cut1, $cut2 - $cut1);
$middleLine = $middleLine.Replace(" ", "`r`n");
$key2 = -Join ($firstLine, "`r`n", $middleLine, $lastLine);
New-Item -Path $file -ItemType "file" -Value $key2;
gpg --allow-secret-key-import --import $file
Remove-Item $file
- task: PowerShell@2
displayName: '[Diagnostics] Show pom files'
condition: succeededOrFailed()
enabled: False
inputs:
targetType: inline
script: >-
$file = "$(Build.SourcesDirectory)\pom.xml";
$xml = New-Object XML;
$xml.Load($file);
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable)
$nsm.AddNamespace('ns', $xml.DocumentElement.NamespaceURI)
$element = $xml.SelectSingleNode('//ns:version', $nsm)
#$element.InnerText = "$(PackageVersion)"
#$xml.Save($file);
Write-Host $file '+++++++++++++++++++++++++++++++++++';
Write-Host $element.InnerText
get-content $file;
$file = "$(Build.SourcesDirectory)\libraries\bot-builder\pom.xml";
$xml = New-Object XML;
$xml.Load($file);
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable)
$nsm.AddNamespace('ns', $xml.DocumentElement.NamespaceURI)
$element = $xml.SelectSingleNode('//ns:version', $nsm)
#$element.InnerText = "$(PackageVersion)"
#$xml.Save($file);
Write-Host $file '+++++++++++++++++++++++++++++++++++';
Write-Host $element.InnerText
get-content $file;
$file = "$(Build.SourcesDirectory)\libraries\bot-schema\pom.xml";
$xml = New-Object XML;
$xml.Load($file);
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable)
$nsm.AddNamespace('ns', $xml.DocumentElement.NamespaceURI)
$element = $xml.SelectSingleNode('//ns:version', $nsm)
#$element.InnerText = "$(PackageVersion)"
#$xml.Save($file);
Write-Host $file '+++++++++++++++++++++++++++++++++++';
Write-Host $element.InnerText
get-content $file;
$file = "$(Build.SourcesDirectory)\libraries\bot-connector\pom.xml";
$xml = New-Object XML;
$xml.Load($file);
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable)
$nsm.AddNamespace('ns', $xml.DocumentElement.NamespaceURI)
$element = $xml.SelectSingleNode('//ns:version', $nsm)
#$element.InnerText = "$(PackageVersion)"
#$xml.Save($file);
Write-Host $file '+++++++++++++++++++++++++++++++++++';
Write-Host $element.InnerText
get-content $file;
$file = "$(Build.SourcesDirectory)\samples\bot-connector-sample\pom.xml";
$xml = New-Object XML;
$xml.Load($file);
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable)
$nsm.AddNamespace('ns', $xml.DocumentElement.NamespaceURI)
$element = $xml.SelectSingleNode('//ns:version', $nsm)
#$element.InnerText = "$(PackageVersion)"
#$xml.Save($file);
Write-Host $file '+++++++++++++++++++++++++++++++++++';
Write-Host $element.InnerText
get-content $file;
- task: Maven@3
displayName: Maven Install (this signs)
inputs:
goals: 'install -P devops '
options: -e --no-transfer-progress -Drepo.id=ConversationalAI -Drepo.url=https://pkgs.dev.azure.com/ConversationalAI/BotFramework/_packaging/SDK/maven/v1 -Dexclude.tests=
codeCoverageTool: JaCoCo
findbugsAnalysisEnabled: true
- task: Maven@3
displayName: 'Maven Package '
enabled: False
inputs:
goals: package -P devops
options: -e --no-transfer-progress
findbugsAnalysisEnabled: true
- task: Maven@3
displayName: Maven Deploy
condition: "and(succeeded(), or(eq(variables['Build.Reason'], 'Schedule'), eq(variables['publish'], 'true'))) "
enabled: False
inputs:
goals: deploy
options: --settings $(Build.SourcesDirectory)/settings.xml -Dinternal.repo.username=$(MavenUsername) -Dinternal.repo.password=$(MavenPassword) --no-transfer-progress
testRunTitle: Bot.Builder-Java Tests
checkstyleAnalysisEnabled: true
pmdAnalysisEnabled: true
findbugsAnalysisEnabled: true
- task: Maven@3
displayName: Maven deploy to scratch
enabled: False
inputs:
goals: deploy
options: --settings $(Build.SourcesDirectory)/settings.xml -Dinternal.repo.username=$(JavaMygetUserName) -Dinternal.repo.password=$(JavaMygetApiKey) -e --no-transfer-progress
publishJUnitResults: false
- task: CopyFiles@2
displayName: Copy deployment files to staging packages directory
inputs:
SourceFolder: $(system.defaultworkingdirectory)
Contents: >-
libraries/*/target/*.jar
libraries/*/target/*.jar.asc
samples/*/target/*.jar
samples/*/target/*.jar.asc
libraries/*/pom.xml
samples/*/pom.xml
settings.xml
pom.xml
TargetFolder: $(Build.ArtifactStagingDirectory)/packages
- task: PublishBuildArtifacts@1
displayName: Publish deployment files to artifacts
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)/packages
- task: PowerShell@2
displayName: Dir workspace
condition: succeededOrFailed()
continueOnError: True
inputs:
targetType: inline
script: >-
pushd ..
Get-ChildItem -Recurse -Force
...