* refactor existing ci.yml to fit into 1es-redirect

* fix the trailing : on variable names

* add reference point for 1es redirect

* referencing image.yml without leading /

* ensure we use hardcoded os
This commit is contained in:
Scott Beddall 2024-03-28 14:52:54 -07:00 коммит произвёл GitHub
Родитель 47d8b5d86d
Коммит d7e9cb7411
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 211 добавлений и 104 удалений

232
ci.yml
Просмотреть файл

@ -14,116 +14,140 @@ pr:
- release/*
- hotfix/*
variables:
DefaultOptions: '--batch-mode --fail-at-end -Dmaven.wagon.http.pool=false'
LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
MemoryOptions: '-Xmx3072m'
extends:
template: /eng/templates/1es-redirect.yml
parameters:
stages:
- stage: Build
variables:
- name: DefaultOptions
value: '--batch-mode --fail-at-end -Dmaven.wagon.http.pool=false'
- name: LoggingOptions
value: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
- name: MemoryOptions
value: '-Xmx3072m'
- template: /eng/templates/image.yml
jobs:
- job: 'Build'
pool:
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux
stages:
- stage: Build
jobs:
- job: 'Build'
pool:
vmImage: 'ubuntu-22.04'
strategy:
matrix:
Java 8:
ArtifactName: 'java8-packages'
ProfileFlag: '-Djava8'
JavaVersion: '1.8'
# We name this 'packages' because it is the default version we want to ship with.
Java LTS:
ArtifactName: 'packages'
ProfileFlag: '-Djava-lts'
JavaVersion: '1.11'
strategy:
matrix:
Java 8:
ArtifactName: 'java8-packages'
ProfileFlag: '-Djava8'
JavaVersion: '1.8'
# We name this 'packages' because it is the default version we want to ship with.
Java LTS:
ArtifactName: 'packages'
ProfileFlag: '-Djava-lts'
JavaVersion: '1.11'
steps:
- task: Maven@3
displayName: 'Build and Package'
inputs:
mavenPomFile: 'pom.xml'
goals: 'deploy'
options: '$(DefaultOptions) $(ProfileFlag) -T 1C -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true --settings eng/settings.xml -DaltDeploymentRepository="local::default::file:///${project.basedir}/output"'
mavenOptions: '$(LoggingOptions) $(MemoryOptions)'
javaHomeOption: 'JDKVersion'
jdkVersionOption: $(JavaVersion)
jdkArchitectureOption: 'x64'
publishJUnitResults: false
steps:
- task: Maven@3
displayName: 'Build and Package'
inputs:
mavenPomFile: 'pom.xml'
goals: 'deploy'
options: '$(DefaultOptions) $(ProfileFlag) -T 1C -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true --settings eng/settings.xml -DaltDeploymentRepository="local::default::file:///${project.basedir}/output"'
mavenOptions: '$(LoggingOptions) $(MemoryOptions)'
javaHomeOption: 'JDKVersion'
jdkVersionOption: $(JavaVersion)
jdkArchitectureOption: 'x64'
publishJUnitResults: false
- task: Maven@3
displayName: 'Run SpotBugs, Checkstyle, and Javadoc'
inputs:
mavenPomFile: pom.xml
options: '$(DefaultOptions) --no-transfer-progress -DskipTests -Dgpg.skip'
mavenOptions: '$(MemoryOptions)'
javaHomeOption: 'JDKVersion'
jdkVersionOption: $(JavaVersion)
jdkArchitectureOption: 'x64'
publishJUnitResults: false
goals: 'verify'
- task: Maven@3
displayName: 'Run SpotBugs, Checkstyle, and Javadoc'
inputs:
mavenPomFile: pom.xml
options: '$(DefaultOptions) --no-transfer-progress -DskipTests -Dgpg.skip'
mavenOptions: '$(MemoryOptions)'
javaHomeOption: 'JDKVersion'
jdkVersionOption: $(JavaVersion)
jdkArchitectureOption: 'x64'
publishJUnitResults: false
goals: 'verify'
- script: |
cp output/com/microsoft/azure/qpid-proton-j-extensions/**/* $(Build.ArtifactStagingDirectory)
rm $(Build.ArtifactStagingDirectory)/*.sha1
rm $(Build.ArtifactStagingDirectory)/*.md5
displayName: Flatten and copy build outputs
- script: |
cp output/com/microsoft/azure/qpid-proton-j-extensions/**/* $(Build.ArtifactStagingDirectory)
rm $(Build.ArtifactStagingDirectory)/*.sha1
rm $(Build.ArtifactStagingDirectory)/*.md5
displayName: Flatten and copy build outputs
- publish: $(Build.ArtifactStagingDirectory)
artifact: $(ArtifactName)
displayName: 'Publish outputs to $(ArtifactName) artifact'
- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish outputs to $(ArtifactName) artifact'
inputs:
artifactName: $(ArtifactName)
targetPath: $(Build.ArtifactStagingDirectory)
- job: 'Test'
strategy:
matrix:
Linux - Java 8:
OSName: 'Linux'
OSVmImage: 'ubuntu-22.04'
ProfileFlag: '-Djava8'
JavaVersion: '1.8'
macOS - Java 8:
OSName: 'macOS'
OSVmImage: 'macOS-13'
ProfileFlag: '-Djava8'
JavaVersion: '1.8'
Windows - Java 8:
OSName: 'Windows'
OSVmImage: 'windows-2022'
ProfileFlag: '-Djava8'
JavaVersion: '1.8'
Linux - Java LTS:
OSName: 'Linux'
OSVmImage: 'ubuntu-22.04'
ProfileFlag: '-Djava-lts'
JavaVersion: '1.11'
macOS - Java LTS:
OSName: 'macOS'
OSVmImage: 'macOS-13'
ProfileFlag: '-Djava-lts'
JavaVersion: '1.11'
Windows - Java LTS:
OSName: 'Windows'
OSVmImage: 'windows-2022'
ProfileFlag: '-Djava-lts'
JavaVersion: '1.11'
- job:
displayName: 'Test'
strategy:
matrix:
Linux - Java 8:
OSName: 'Linux'
OSVmImage: 'ubuntu-22.04'
ProfileFlag: '-Djava8'
JavaVersion: '1.8'
Linux - Java LTS:
OSName: 'Linux'
OSVmImage: 'ubuntu-22.04'
ProfileFlag: '-Djava-lts'
JavaVersion: '1.11'
pool:
vmImage: $(OSVmImage)
pool:
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux
steps:
- task: Maven@3
displayName: 'Run Tests'
inputs:
mavenPomFile: 'pom.xml'
options: '$(DefaultOptions) $(ProfileFlag) --settings eng/settings.xml'
mavenOptions: '-Xmx3072m $(LoggingOptions)'
javaHomeOption: 'JDKVersion'
jdkVersionOption: $(JavaVersion)
jdkArchitectureOption: 'x64'
publishJUnitResults: false
goals: 'test'
steps:
- template: /eng/templates/test-steps.yml
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
mergeTestResults: true
testRunTitle: '$(OSName) on Java $(JavaVersion)'
- job:
displayName: 'Test'
strategy:
matrix:
Windows - Java 8:
OSName: 'Windows'
OSVmImage: 'windows-2022'
ProfileFlag: '-Djava8'
JavaVersion: '1.8'
Windows - Java LTS:
OSName: 'Windows'
OSVmImage: 'windows-2022'
ProfileFlag: '-Djava-lts'
JavaVersion: '1.11'
pool:
name: $(WINDOWSPOOL)
image: $(WINDOWSVMIMAGE)
os: windows
steps:
- template: /eng/templates/test-steps.yml
- job:
displayName: 'Test'
strategy:
matrix:
macOS - Java 8:
OSName: 'macOS'
OSVmImage: 'macOS-13'
ProfileFlag: '-Djava8'
JavaVersion: '1.8'
macOS - Java LTS:
OSName: 'macOS'
OSVmImage: 'macOS-13'
ProfileFlag: '-Djava-lts'
JavaVersion: '1.11'
pool:
name: $(MACPOOL)
vmImage: $(MACVMIMAGE)
os: macOS
steps:
- template: /eng/templates/test-steps.yml

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

@ -0,0 +1,40 @@
resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
parameters:
- name: stages
type: stageList
default: []
- name: UseOfficial
type: boolean
default: true
extends:
${{ if and(parameters.UseOfficial, eq(variables['System.TeamProject'], 'internal')) }}:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
${{ else }}:
template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
settings:
skipBuildTagsForGitHubPullRequests: true
sdl:
sourceAnalysisPool:
name: azsdk-pool-mms-win-2022-general
image: azsdk-pool-mms-win-2022-1espt
os: windows
sourceRepositoriesToScan:
exclude:
- repository: azure-sdk-build-tools
eslint:
enabled: false
justificationForDisabling: 'ESLint injected task has failures because it uses an old version of mkdirp. We should not fail for tools not controlled by the repo. See: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=3499746'
psscriptanalyzer:
compiled: true
break: true
policy: M365
stages: ${{ parameters.stages }}

24
eng/templates/image.yml Normal file
Просмотреть файл

@ -0,0 +1,24 @@
# Default pool image selection. Set as variable so we can override at pipeline level
variables:
- name: LINUXPOOL
value: azsdk-pool-mms-ubuntu-2204-general
- name: WINDOWSPOOL
value: azsdk-pool-mms-win-2022-general
- name: MACPOOL
value: Azure Pipelines
- name: LINUXVMIMAGE
value: azsdk-pool-mms-ubuntu-2204-1espt
- name: WINDOWSVMIMAGE
value: azsdk-pool-mms-win-2022-1espt
- name: MACVMIMAGE
value: macos-13
# Values required for pool.os field in 1es pipeline templates
- name: LINUXOS
value: linux
- name: WINDOWSOS
value: windows
- name: MACOS
value: macOS

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

@ -0,0 +1,19 @@
# relies on variable settings set from calling previous build steps
steps:
- task: Maven@3
displayName: 'Run Tests'
inputs:
mavenPomFile: 'pom.xml'
options: '$(DefaultOptions) $(ProfileFlag) --settings eng/settings.xml'
mavenOptions: '-Xmx3072m $(LoggingOptions)'
javaHomeOption: 'JDKVersion'
jdkVersionOption: $(JavaVersion)
jdkArchitectureOption: 'x64'
publishJUnitResults: false
goals: 'test'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
mergeTestResults: true
testRunTitle: '$(OSName) on Java $(JavaVersion)'