Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding publishing stage to publish java CUDA 12 pkg to ado #20834

Merged
merged 45 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
502392c
Adding ado maven url
jchen351 May 28, 2024
6d524af
Adding release from gradlew
jchen351 May 28, 2024
2644274
Adding ado maven url
jchen351 May 28, 2024
9010a20
${{ if eq(parameters.IsReleaseBuild, true) }}:
jchen351 May 28, 2024
0577a97
${{ if eq(parameters.IsReleaseBuild, true) }}:
jchen351 May 28, 2024
89b7fe4
OnnxRuntimeVersion
jchen351 May 29, 2024
a15e2f0
task:
jchen351 May 29, 2024
255429f
BuildId
jchen351 May 29, 2024
386740f
dependsOn: []
jchen351 May 29, 2024
7da48e4
dependsOn: []
jchen351 May 29, 2024
0f8f316
jar cvf bundle.jar `
jchen351 May 29, 2024
ce25eb5
jar cvf bundle.jar `
jchen351 May 29, 2024
d1f35c0
remove codesign
jchen351 May 29, 2024
78bb7f0
rollback tools/ci_build/github/azure-pipelines/stages/java-cuda-packa…
jchen351 May 29, 2024
40d6986
maven {
jchen351 May 29, 2024
04a4332
tools/ci_build/github/azure-pipelines/cuda-packaging-pipeline.yml
jchen351 May 29, 2024
85ce3ce
$(Build.SourcesDirectory)/java
jchen351 May 29, 2024
b41d184
$(Build.SourcesDirectory)/java
jchen351 May 29, 2024
0b0f055
System
jchen351 May 29, 2024
377769c
tasks
jchen351 May 29, 2024
81514b2
tasks
jchen351 May 29, 2024
5163df9
Remove version number
jchen351 May 29, 2024
86649a1
classifier 'cuda12'
jchen351 May 29, 2024
ce2e748
vstsMavenAccessToken
jchen351 May 29, 2024
7a72d84
classifier 'cuda12'
jchen351 May 29, 2024
931c22c
adoAccessToken
jchen351 May 29, 2024
dfd41f2
test with version 00.0.6
jchen351 May 29, 2024
6bc09f4
using defual publish
jchen351 May 29, 2024
74293ea
update version
jchen351 May 29, 2024
eba3caf
Stilling toing to use publishToADO
jchen351 May 29, 2024
dd22e95
Try default publish again
jchen351 May 29, 2024
7c24b3b
Try default publish again
jchen351 May 29, 2024
782f883
Try default publish again
jchen351 May 29, 2024
9b27bc9
Remove settings.xml
jchen351 May 29, 2024
38f2816
settings-security.xml
jchen351 May 29, 2024
eb75b2b
settings-security.xml
jchen351 May 29, 2024
e2126f3
settings-security.xml
jchen351 May 29, 2024
652cee2
Remove settings.xml
jchen351 May 29, 2024
7e219cf
"${projectDir}/settings.xml"
jchen351 May 29, 2024
b73f65b
settings-security.xml
jchen351 May 29, 2024
758e11e
"${projectDir}/settings.xml"
jchen351 May 29, 2024
2c98910
"${projectDir}/settings.xml"
jchen351 May 29, 2024
b8e3894
"${projectDir}/settings.xml"
jchen351 May 29, 2024
a36575c
/Users/jchen351/Workspaces/onnxruntime/VERSION_NUMBER
jchen351 May 29, 2024
de17d30
format violation
jchen351 May 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 46 additions & 13 deletions java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id 'signing'
id 'jacoco'
id "com.diffplug.spotless" version "6.25.0"
id "net.linguica.maven-settings" version "0.5"
}

allprojects {
Expand All @@ -19,6 +20,12 @@ version = rootProject.file('../VERSION_NUMBER').text.trim()
def cmakeBuildDir = System.properties['cmakeBuildDir']
def useCUDA = System.properties['USE_CUDA']
def useROCM = System.properties['USE_ROCM']

def adoArtifact = project.findProperty('adoArtifact')
def adoAccessToken = project.findProperty('adoAccessToken')
// Only publish to ADO feed if all two properties are set
def publishToAdo = adoArtifact != null && adoAccessToken != null

boolean enableTrainingApis = (System.properties['ENABLE_TRAINING_APIS'] ?: "0") == "1"
def cmakeJavaDir = "${cmakeBuildDir}/java"
def cmakeNativeLibDir = "${cmakeJavaDir}/native-lib"
Expand All @@ -37,6 +44,11 @@ def trainingDescription = 'ONNX Runtime Training is a training and inference pac
'(Open Neural Network Exchange) models. This package is targeted for Learning on The Edge aka On-Device Training ' +
'See https://github.com/microsoft/onnxruntime-training-examples/tree/master/on_device_training for more details.'

// We need to have a custom settings.xml so codeql can bypass the need for settings.security.xml
mavenSettings {
userSettingsFileName = "${projectDir}/settings.xml"
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -206,9 +218,13 @@ publishing {
publications {
maven(MavenPublication) {
groupId = project.group
artifactId = mavenArtifactId

from components.java
if(publishToAdo) {
artifactId = 'onnxruntime_gpu'
artifact (adoArtifact)
} else {
artifactId = mavenArtifactId
from components.java
}
pom {
name = enableTrainingApis ? 'onnxruntime-training' : 'onnx-runtime'
description = enableTrainingApis ? trainingDescription : defaultDescription
Expand Down Expand Up @@ -239,24 +255,41 @@ publishing {
}
}
repositories {
maven {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username mavenUser
password mavenPwd
if (publishToAdo) {
maven {
url "https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/${System.getenv('ADOFeedName')}/maven/v1"
name System.getenv('ADOFeedName')
authentication {
basic(BasicAuthentication)
}
credentials {
username 'aiinfra'
password "${project.findProperty('adoAccessToken')}"
}
}
} else {
maven {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username mavenUser
password mavenPwd
}
}
}
}
}

// Generates a task signMavenPublication that will
// build all artifacts.
signing {
// Queries env vars:
// ORG_GRADLE_PROJECT_signingKey
// ORG_GRADLE_PROJECT_signingPassword but can be changed to properties
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
// Skip signing if no key is provided
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
sign publishing.publications.mavenAdo
}
}
9 changes: 9 additions & 0 deletions java/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!--The only purpose of this file is to let codeql bypass the need for settings.security.xml-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<!-- password is coming from cli -PadoAccessToken -->
</servers>
</settings>
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,22 @@ resources:
branch: main

parameters:
- name: nightly
- name: isReleaseBuild
type: boolean
default: true
default: false

variables:
- name: ArtifactFeed
${{ if eq(parameters.isReleaseBuild, false) }}:
value: ort-cuda-12-nightly
${{ else }}:
value: onnxruntime-cuda-12

stages:
- template: stages/nuget-cuda-publishing-stage.yml
parameters:
${{ if ne(parameters.nightly, true) }}:
artifact_feed: onnxruntime-cuda-12
${{ else }}:
artifact_feed: ort-cuda-12-nightly
artifact_feed: $(ArtifactFeed)

- template: stages/java-cuda-publishing-stage.yml
parameters:
artifact_feed: $(ArtifactFeed)
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
parameters:
- name: artifact_feed
type: string

stages:
- stage: JAR_Publishing_GPU
dependsOn: []
jobs:
- job: JAR_Publishing_GPU
#TD-DO: figure out a way to package nightly jar. Currently Java version are set from VERSION_NUMBER file
condition: ${{ eq(parameters.artifact_feed, 'onnxruntime-cuda-12') }}
workspace:
clean: all
pool: 'onnxruntime-Win-CPU-2022'
variables:
- name: SYSTEM_ACCESSTOKEN
value: $(System.AccessToken)
- name: ADOFeedName
value: ${{ parameters.artifact_feed }}
- name: GDN_CODESIGN_TARGETDIRECTORY
value: '$(Build.BinariesDirectory)/final-package'
- name: artifactName
value: onnxruntime-java-gpu

steps:
- script: mkdir "$(GDN_CODESIGN_TARGETDIRECTORY)"

- download: build
displayName: 'Download Pipeline Artifact - $(artifactName)'
artifact: '$(artifactName)'

- task: CopyFiles@2
inputs:
SourceFolder: '$(Pipeline.Workspace)/build/$(artifactName)'
Contents: |
onnxruntime_gpu*.jar
onnxruntime_gpu*.pom
TargetFolder: '$(GDN_CODESIGN_TARGETDIRECTORY)'
CleanTargetFolder: true

- task: PowerShell@2
displayName: 'Bundle Jar and POM files into a single jar file'
inputs:
targetType: 'inline'
script: |
jar cvf bundle.jar `
onnxruntime_gpu-*.pom `
onnxruntime_gpu-*.jar
workingDirectory: '$(GDN_CODESIGN_TARGETDIRECTORY)'

- task: Gradle@3
inputs:
gradleWrapperFile: '$(Build.SourcesDirectory)/java/gradlew.bat'
workingDirectory: '$(Build.SourcesDirectory)/java'
tasks: 'publish'
options: '-PadoAccessToken=$(SYSTEM_ACCESSTOKEN) -PadoArtifact=$(GDN_CODESIGN_TARGETDIRECTORY)/bundle.jar'
Loading