Skip to content

Commit 59eb7d0

Browse files
Merge pull request #11430 from microsoft/hanli/fix-pipeline
Fix sign stable pipeline for intellij
2 parents 6049427 + c7b6247 commit 59eb7d0

File tree

1 file changed

+77
-89
lines changed

1 file changed

+77
-89
lines changed

.azure-pipelines/sign-for-stable-release.yml

Lines changed: 77 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -6,133 +6,121 @@ resources:
66
repositories:
77
- repository: self
88
type: git
9-
ref: refs/heads/wangmi/1es
10-
- repository: 1esPipelines
9+
ref: refs/heads/main
10+
- repository: MicroBuildTemplate
1111
type: git
12-
name: 1ESPipelineTemplates/1ESPipelineTemplates
13-
ref: refs/tags/release
12+
name: 1ESPipelineTemplates/MicroBuildTemplate
1413
trigger: none
1514
extends:
16-
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
15+
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
1716
parameters:
1817
pool:
19-
name: 1ES_JavaTooling_Pool
20-
image: 1ES_JavaTooling_Ubuntu-2004
21-
os: linux
22-
timeoutInMinutes: 360
23-
sdl:
24-
sourceAnalysisPool:
25-
name: 1ES_JavaTooling_Pool
26-
image: 1ES_JavaTooling_Windows_2022
27-
os: windows
28-
customBuildTags:
29-
- MigrationTooling-mseng-VSJava-10780-Tool
18+
name: VSEngSS-MicroBuild2022-1ES
19+
os: windows # allowed values: windows, linux, or macOS. The default value is windows.
20+
featureFlags:
21+
disableNetworkIsolation: true
3022
stages:
3123
- stage: Stage
3224
jobs:
33-
- job: Job_1
34-
displayName: Build and Sign Azure Plugin for IntelliJ
25+
- job: Build_and_Sign
26+
displayName: Build and Sign Plugin
3527
timeoutInMinutes: 360
3628
templateContext:
29+
mb:
30+
signing:
31+
enabled: true
32+
signType: real
33+
signWithProd: true
34+
zipSources: false
35+
useEsrpCli: true
36+
feedSource: 'https://mseng.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json'
3737
outputs:
3838
- output: pipelineArtifact
3939
artifactName: drop
4040
targetPath: $(build.artifactstagingdirectory)/drop
4141
displayName: "Publish Artifact: drop"
4242
steps:
4343
- checkout: self
44+
clean: true
4445
fetchTags: false
45-
- task: Bash@3
46-
displayName: Prepare JDK environment
46+
- task: PowerShell@2
47+
displayName: Install JDK 17
4748
inputs:
4849
targetType: inline
4950
script: |
50-
# Create a directory for the JDK
51-
mkdir -p $HOME/java
52-
cd $HOME/java
53-
54-
# Download Adoptium/Temurin JDK 17.0.7
55-
echo "Downloading Java 17.0.7..."
56-
wget -q https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.7%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz
57-
58-
# Extract the archive
59-
echo "Extracting Java 17.0.7..."
60-
tar -xzf OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz
61-
rm OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz
62-
63-
# Set JAVA_HOME and add to PATH
64-
export JAVA_HOME=$HOME/java/jdk-17.0.7+7
65-
export PATH=$JAVA_HOME/bin:$PATH
66-
67-
echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME"
68-
echo "##vso[task.setvariable variable=PATH]$PATH"
69-
- task: Bash@3
70-
displayName: Build Utils
51+
# Download Adoptium/Temurin JDK 17.0.12
52+
Write-Host "Downloading Java 17.0.12..."
53+
$source = "https://download.oracle.com/java/17/archive/jdk-17.0.12_windows-x64_bin.zip"
54+
$destination = "$(build.sourcesdirectory)\jdk17_x64_windows.zip"
55+
Invoke-WebRequest -Uri $source -OutFile $destination
56+
- task: JavaToolInstaller@0
57+
displayName: 'Use Java 17'
58+
inputs:
59+
versionSpec: 17
60+
jdkArchitectureOption: x64
61+
jdkSourceOption: LocalDirectory
62+
jdkFile: '$(build.sourcesdirectory)\jdk17_x64_windows.zip'
63+
jdkDestinationDirectory: '$(agent.toolsDirectory)/jdk17'
64+
- task: PowerShell@2
65+
displayName: Build Plugin
7166
inputs:
7267
targetType: inline
73-
script: |-
68+
script: |
7469
mvn -v
7570
# ./gradlew buildUtils || exit -1
76-
mvn clean install -f ./Utils/pom.xml -T 1C -Dcheckstyle.skip=true -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
71+
mvn clean install -f ./Utils/pom.xml -T 1C "-Dcheckstyle.skip=true" "-Dmaven.test.skip=true" "-Dmaven.javadoc.skip=true"
7772
mvn clean -f ./Utils/pom.xml
78-
- task: Bash@3
79-
displayName: Build Plugin
73+
cd PluginsAndFeatures/azure-toolkit-for-intellij
74+
./gradlew clean buildPlugin -s "-Papplicationinsights.key=$(INTELLIJ_KEY)" "-PneedPatchVersion=false" "-Psources=false" "-Porg.gradle.configureondemand=false" "-Porg.gradle.daemon=false" "-Porg.gradle.unsafe.configuration-cache=false" "-Porg.gradle.caching=false"
75+
- task: PowerShell@2
76+
displayName: Unpackage
8077
inputs:
8178
targetType: inline
8279
script: |
83-
(cd PluginsAndFeatures/azure-toolkit-for-intellij && ./gradlew clean buildPlugin -s -Papplicationinsights.key=$(INTELLIJ_KEY) -PneedPatchVersion=false -Psources=false -Porg.gradle.configureondemand=false -Porg.gradle.daemon=false -Porg.gradle.unsafe.configuration-cache=false -Porg.gradle.caching=false)
84-
85-
mkdir -p ./artifacts/intellij/
86-
cp ./PluginsAndFeatures/azure-toolkit-for-intellij/build/distributions/*.zip ./artifacts/intellij/azure-toolkit-for-intellij.zip
87-
unzip ./artifacts/intellij/azure-toolkit-for-intellij.zip -d ./artifacts/intellij/folder
88-
rm ./artifacts/intellij/azure-toolkit-for-intellij.zip
89-
- task: UsePythonVersion@0
90-
displayName: 'Use Python 3.11.x'
91-
inputs:
92-
versionSpec: 3.11.x
93-
- task: UseDotNet@2
94-
displayName: 'Use .NET Core 3.1.x'
95-
inputs:
96-
packageType: 'sdk'
97-
version: '3.1.x'
98-
- task: MicroBuildSigningPlugin@4
99-
displayName: 'Install Signing Plugin'
100-
inputs:
101-
signType: real
102-
azureSubscription: 'MicroBuild Signing Task (MSEng)'
103-
feedSource: 'https://mseng.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json'
104-
env:
105-
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
106-
- task: CmdLine@2
80+
New-Item -ItemType Directory -Path ".\artifacts\intellij\" -Force
81+
$zipFile = Get-ChildItem ".\PluginsAndFeatures\azure-toolkit-for-intellij\build\distributions\*.zip" | Select-Object -First 1
82+
Copy-Item $zipFile.FullName ".\artifacts\intellij\azure-toolkit-for-intellij.zip"
83+
Expand-Archive -Path ".\artifacts\intellij\azure-toolkit-for-intellij.zip" -DestinationPath ".\artifacts\intellij\folder" -Force
84+
Remove-Item ".\artifacts\intellij\azure-toolkit-for-intellij.zip"
85+
- task: PowerShell@2
10786
displayName: Sign jars
10887
timeoutInMinutes: 240
10988
inputs:
89+
targetType: inline
11090
script: |
111-
ABSOLUTE_PATH="$(pwd)"
91+
$ABSOLUTE_PATH = Get-Location
11292
# Generate the signing-filelist.xml file
113-
echo '<?xml version="1.0" encoding="utf-8" ?>' > signing-filelist.xml
114-
echo '<filelist>' >> signing-filelist.xml
115-
echo ' <certificate certnumbers="100010171">' >> signing-filelist.xml
116-
117-
find . -type f -name "azure-intellij-*.jar" -o -name "azure-toolkit-ide-*.jar" -o -name "azuretools-core-*.jar" -o -name "azure-explorer-common-*.jar" -o -name "hdinsight-node-common-*.jar" -o -name "azure-sdk-reference-book.jar" | while read -r file; do
118-
clean_file="${file#./}"
119-
abs_path="$ABSOLUTE_PATH/$clean_file"
120-
echo " <file srcpath=\"$abs_path\" dstpath=\"$abs_path\"></file>" >> signing-filelist.xml
121-
done
122-
123-
echo ' </certificate>' >> signing-filelist.xml
124-
echo '</filelist>' >> signing-filelist.xml
125-
126-
dotnet "$MBSIGN_APPFOLDER/DDSignFiles.dll" -- /filelist:signing-filelist.xml
127-
rm signing-filelist.xml
128-
workingDirectory: 'artifacts/intellij/folder/azure-toolkit-for-intellij/lib'
129-
- task: Bash@3
93+
'<?xml version="1.0" encoding="utf-8" ?>' | Out-File -FilePath signing-filelist.xml -Encoding utf8
94+
'<filelist>' | Out-File -FilePath signing-filelist.xml -Append -Encoding utf8
95+
' <certificate certnumbers="100010171">' | Out-File -FilePath signing-filelist.xml -Append -Encoding utf8
96+
97+
Get-ChildItem -Path . -Recurse -File | Where-Object {
98+
$_.Name -like "azure-intellij-*.jar" -or
99+
$_.Name -like "azure-toolkit-for-intellij*.jar" -or
100+
$_.Name -like "azure-toolkit-ide-*.jar" -or
101+
$_.Name -like "azuretools-core-*.jar" -or
102+
$_.Name -like "azure-explorer-common-*.jar" -or
103+
$_.Name -like "hdinsight-node-common-*.jar" -or
104+
$_.Name -eq "azure-sdk-reference-book.jar"
105+
} | ForEach-Object {
106+
$abs_path = $_.FullName
107+
" <file srcpath=`"$abs_path`" dstpath=`"$abs_path`"></file>" | Out-File -FilePath signing-filelist.xml -Append -Encoding utf8
108+
}
109+
110+
' </certificate>' | Out-File -FilePath signing-filelist.xml -Append -Encoding utf8
111+
'</filelist>' | Out-File -FilePath signing-filelist.xml -Append -Encoding utf8
112+
113+
dotnet "$env:MBSIGN_APPFOLDER/DDSignFiles.dll" -- /filelist:signing-filelist.xml
114+
Remove-Item signing-filelist.xml
115+
workingDirectory: 'artifacts/intellij/folder'
116+
- task: PowerShell@2
130117
displayName: Repackage
131118
inputs:
132119
targetType: inline
133120
script: |
134-
# Write your commands here
135-
(cd ./artifacts/intellij/folder && zip -r ../../azure-toolkit-for-intellij-$(Build.BuildNumber).zip ./azure-toolkit-for-intellij/)
121+
Set-Location ".\artifacts\intellij\folder"
122+
Remove-Item -Path "*.log" -Force
123+
Compress-Archive -Path ".\*" -DestinationPath "..\..\azure-toolkit-for-intellij.zip" -CompressionLevel NoCompression -Force
136124
- task: CopyFiles@2
137125
displayName: "Copy Files to: $(build.artifactstagingdirectory)"
138126
inputs:

0 commit comments

Comments
 (0)