Skip to content

Commit

Permalink
migrate 1es template pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
wangmingliang-ms committed Jan 17, 2024
1 parent 20b23e4 commit 03904d3
Show file tree
Hide file tree
Showing 3 changed files with 448 additions and 0 deletions.
140 changes: 140 additions & 0 deletions .azure-pipelines/build-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# This pipeline was generated from the classic pipeline "[IntelliJ] build-feature(endgame)-pull-request" on 2024-01-08 with https://aka.ms/1ESPTMigration (v1.1.0): https://dev.azure.com/mseng/VSJava/_build?definitionId=10967
#
# The following items require attention:
# Variables were exported from the classic pipeline, confirm that `variables` values do not contain private information. If a variable contains private information, follow the guidance on handling secret variables: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/set-secret-variables
# No trigger found, defaulting to 'none'. Update the trigger as needed.
# No name found, setting the default value '$(Date:yyyyMMdd).$(Rev:r)'. This value determines how your pipeline runs are numbered. Update the name as needed: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/run-number?view=azure-devops&tabs=yaml

name: $(Date:yyyyMMdd).$(Rev:r)
variables:
- name: Codeql.Enabled
value: true
- name: GRADLE_USER_HOME
value: $(Pipeline.Workspace)/.gradle
- name: TOOLKIT_BRANCH
value: nonexistent-branch
- name: USERPROFILE
value: /home/vsts
resources:
repositories:
- repository: self
type: git
ref: refs/heads/develop
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
trigger: none
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
parameters:
pool:
name: 1ES_JavaTooling_Pool
image: windows-latest
os: windows
customBuildTags:
- MigrationTooling-mseng-VSJava-10967-Tool
stages:
- stage: Stage
jobs:
- job: Job_1
displayName: Agent job 1
templateContext:
outputs:
- output: pipelineArtifact
artifactName: drop
targetPath: $(build.artifactstagingdirectory)/zip
displayName: "Publish Artifact: drop"
condition: succeededOrFailed()
steps:
- checkout: self
clean: true
fetchTags: false
- task: JavaToolInstaller@0
displayName: Use Java 17
inputs:
versionSpec: "17"
jdkArchitectureOption: x64
jdkSourceOption: PreInstalled
- task: ms-devlabs.utilitytasks.task-Shellpp.Shellpp@0
displayName: Prepare Environment
inputs:
type: InlineScript
script: |-
# Set Environment Variables
export JAVA_HOME=$JAVA_HOME_17_X64
export PATH=$JAVA_HOME/bin:$PATH
echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME"
echo "##vso[task.setvariable variable=PATH]$PATH"
- task: ms-devlabs.utilitytasks.task-Shellpp.Shellpp@0
displayName: Build Toolkit Libs($(TOOLKIT_BRANCH) || $(System.PullRequest.SourceBranch) || $(System.PullRequest.TargetBranch) || develop)
inputs:
type: InlineScript
script: |-
CUSTOM_BRANCH=$(TOOLKIT_BRANCH)
SOURCE_BRANCH=$(System.PullRequest.SourceBranch)
TARGET_BRANCH=$(System.PullRequest.TargetBranch)
ls ~/.m2/repository/com/microsoft/azure/azure-toolkit-*
cd ..
git clone https://github.com/microsoft/azure-maven-plugins.git
cd azure-maven-plugins
custom_existed_in_remote=$(git ls-remote --heads origin ${CUSTOM_BRANCH})
source_existed_in_remote=$(git ls-remote --heads origin ${SOURCE_BRANCH})
target_existed_in_remote=$(git ls-remote --heads origin ${TARGET_BRANCH})
if [[ -n ${custom_existed_in_remote} ]]; then
BRANCH=$CUSTOM_BRANCH
elif [[ -n ${source_existed_in_remote} ]]; then
BRANCH=$SOURCE_BRANCH
elif [[ -n ${target_existed_in_remote} ]]; then
BRANCH=$TARGET_BRANCH
fi
echo "build azure-toolkit-libs: $BRANCH"
git fetch origin $BRANCH
git checkout $BRANCH
git branch
mvn clean install -f azure-toolkit-libs/pom.xml -B -T 4 -Dmaven.test.skip=true -Dmdep.analyze.skip=true -Dmaven.source.skip=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip || exit -1
ls ~/.m2/repository/com/microsoft/azure/azure-toolkit-*
echo "cleaning up battlefield."
cd ../
rm -rf ./azure-maven-plugins
exit 0
- task: ms-devlabs.utilitytasks.task-Shellpp.Shellpp@0
displayName: Build Utils
inputs:
type: InlineScript
script: ./gradlew buildUtils -x buildToolkitsLib || exit -1
- task: ms-devlabs.utilitytasks.task-Shellpp.Shellpp@0
displayName: Build IntelliJ
inputs:
type: InlineScript
script: cd PluginsAndFeatures/azure-toolkit-for-intellij && ./gradlew clean buildPlugin -s
- task: ms-devlabs.utilitytasks.task-Shellpp.Shellpp@0
displayName: Rename & Upload Checkstyle reports
condition: succeededOrFailed()
inputs:
type: InlineScript
script: |-
./gradlew --stop
sudo apt-get install rename
echo "BUILD_NUMBER = $(Build.BuildNumber)"
DATE=`date +%m-%d-%Y`
rename "s/.zip/.develop.$(Build.BuildNumber).${DATE}.zip/" artifacts/*.zip
continueOnError: true
- task: CopyFiles@2
displayName: "Copy Files to: $(build.artifactstagingdirectory)/zip"
condition: succeededOrFailed()
inputs:
SourceFolder: $(Build.Repository.LocalPath)/PluginsAndFeatures/azure-toolkit-for-intellij/build/distributions
Contents: "**/*.zip"
TargetFolder: $(build.artifactstagingdirectory)/zip
continueOnError: true
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: "Manifest Generator "
inputs:
BuildDropPath: $(build.artifactstagingdirectory)/zip
166 changes: 166 additions & 0 deletions .azure-pipelines/sign-for-dev-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# This pipeline was generated from the classic pipeline "[IntelliJ] sign-for-dev-release" on 2024-01-16 with https://aka.ms/1ESPTMigration (v1.1.0): https://dev.azure.com/mseng/VSJava/_build?definitionId=11383
#
# The following items require attention:
# Variables were exported from the classic pipeline, confirm that `variables` values do not contain private information. If a variable contains private information, follow the guidance on handling secret variables: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/set-secret-variables
# Agent Queue 'Azure Pipelines' was used with unrecognized Agent Specification, vmImage property must be specified to determine image - https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#software
# No trigger found, defaulting to 'none'. Update the trigger as needed.
# No name found, setting the default value '$(Date:yyyyMMdd).$(Rev:r)'. This value determines how your pipeline runs are numbered. Update the name as needed: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/run-number?view=azure-devops&tabs=yaml
# The pipeline uses service connection "vscjavaci_codesign", you will need to grant the new pipeline access: https://dev.azure.com/mseng/VSJava/_settings/adminservices?resourceId=d5f51b85-6feb-48f6-a077-37426b5911f4

name: $(Date:yyyyMMdd).$(Rev:r)
variables:
- name: Codeql.Enabled
value: true
resources:
repositories:
- repository: self
type: git
ref: refs/heads/wangmi/1es
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
trigger: none
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
parameters:
pool:
name: 1ES_JavaTooling_Pool
image: 1ES_JavaTooling_Ubuntu-2004
os: linux
sdl:
sourceAnalysisPool:
name: 1ES_JavaTooling_Pool
image: 1ES_JavaTooling_Windows_2022
os: windows
customBuildTags:
- MigrationTooling-mseng-VSJava-11383-Tool
stages:
- stage: Stage
jobs:
- job: Job_1
displayName: Build and Sign Azure Plugin for IntelliJ
templateContext:
outputs:
- output: pipelineArtifact
artifactName: drop
targetPath: $(build.artifactstagingdirectory)
displayName: "Publish Artifact: drop"
steps:
- checkout: self
fetchTags: false
- script: |
CUSTOM_BRANCH=$(BRANCH)
if [[ -n ${CUSTOM_BRANCH} ]]; then
git fetch origin $(BRANCH)
git checkout $(BRANCH)
else
echo "no need to switch branch"
fi
displayName: switch to $(BRANCH)
- task: JavaToolInstaller@0
displayName: Use Java 17
inputs:
versionSpec: "17"
jdkArchitectureOption: x64
jdkSourceOption: PreInstalled
- task: Bash@3
displayName: Set up environment and resources
inputs:
targetType: inline
script: |-
# Set Environment Variables
export JAVA_HOME=$JAVA_HOME_17_X64
export PATH=$JAVA_HOME/bin:$PATH
echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME"
echo "##vso[task.setvariable variable=PATH]$PATH"
- task: Bash@3
displayName: Build Toolkit Libs@$(TOOLKIT_BRANCH)
inputs:
targetType: inline
script: |-
TARGET_BRANCH=$(TOOLKIT_BRANCH)
ls ~/.m2/repository/com/microsoft/azure/azure-toolkit-*
cd ..
git clone https://github.com/microsoft/azure-maven-plugins.git
cd azure-maven-plugins
echo "build azure-toolkit-libs: $TARGET_BRANCH"
git fetch origin $TARGET_BRANCH
git checkout $TARGET_BRANCH
git branch
mvn clean install -T 4 -Dmaven.test.skip=true -Dmdep.analyze.skip=true -Dmaven.source.skip=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip -B|| exit -1
ls ~/.m2/repository/com/microsoft/azure/azure-toolkit-*
echo "cleaning up battlefield."
cd ../
rm -rf ./azure-maven-plugins
exit 0
- task: Bash@3
displayName: Build Utils
inputs:
targetType: inline
script: |-
# Write your commands here
# ./gradlew buildUtils || exit -1
mvn install -f ./Utils/pom.xml -T 1C -Dcheckstyle.skip=true
- task: Bash@3
displayName: Build IntelliJ
inputs:
targetType: inline
script: |
(cd PluginsAndFeatures/azure-toolkit-for-intellij && ./gradlew clean buildPlugin -s -Papplicationinsights.key=$(INTELLIJ_KEY) -PneedPatchVersion=$(IS_FOR_DEV_RELEASE) -Psources=false -Porg.gradle.configureondemand=false -Porg.gradle.daemon=false -Porg.gradle.unsafe.configuration-cache=false -Porg.gradle.caching=false)
mkdir -p ./artifacts/intellij/
cp ./PluginsAndFeatures/azure-toolkit-for-intellij/build/distributions/*.zip ./artifacts/intellij/azure-toolkit-for-intellij.zip
unzip ./artifacts/intellij/azure-toolkit-for-intellij.zip -d ./artifacts/intellij/folder
rm ./artifacts/intellij/azure-toolkit-for-intellij.zip
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
displayName: Sign IntelliJ
inputs:
ConnectedServiceName: vscjavaci_codesign
FolderPath: artifacts/intellij/folder
Pattern: azure-intellij-*.jar, azure-toolkit-*.jar, azuretools-core-*.jar,azure-explorer-common-*.jar,hdinsight-node-common-*.jar, azure-sdk-reference-book.jar
signConfigType: inlineSignParams
inlineOperation: |-
[
{
"KeyCode" : "$(KEY_CODE)",
"OperationCode" : "JavaSign",
"Parameters" : {
"SigAlg" : "SHA256withRSA",
"Timestamp" : "-tsa http://sha256timestamp.ws.digicert.com/sha256/timestamp"
},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "$(KEY_CODE)",
"OperationCode" : "JavaVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
- task: Bash@3
displayName: Build IntelliJ Package
inputs:
targetType: inline
script: |
# Write your commands here
(cd ./artifacts/intellij/folder && zip -r ../../azure-toolkit-for-intellij-$(Build.BuildNumber).zip ./azure-toolkit-for-intellij/)
- task: CopyFiles@2
displayName: "Copy Files to: $(build.artifactstagingdirectory)"
inputs:
SourceFolder: $(system.defaultworkingdirectory)/artifacts
Contents: "*.zip"
TargetFolder: $(build.artifactstagingdirectory)
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: "Manifest Generator "
inputs:
BuildDropPath: $(build.artifactstagingdirectory)
Loading

0 comments on commit 03904d3

Please sign in to comment.