-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from Bit-Quill/dev-jdbc-jenkins-ci
Add JDBC driver jenkins CI workflow
- Loading branch information
Showing
2 changed files
with
132 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
lib = library(identifier: 'jenkins@main', retriever: modernSCM([ | ||
$class: 'GitSCMSource', | ||
remote: 'https://github.com/opensearch-project/opensearch-build.git', | ||
])) | ||
|
||
pipeline { | ||
agent { | ||
docker { | ||
label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host' | ||
image 'opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v2' | ||
args '-e JAVA_HOME=/opt/java/openjdk-11' | ||
alwaysPull true | ||
} | ||
} | ||
triggers { | ||
GenericTrigger( | ||
genericVariables: [ | ||
[key: 'ref', value: '$.ref'], | ||
[key: 'VERSION', value: '$.ref', regexpFilter: 'refs/tags/v' ], | ||
], | ||
tokenCredentialId: 'jenkins-sql-generic-webhook-token', | ||
causeString: 'A tag was cut on opensearch-project/sql repository causing this workflow to run', | ||
printContributedVariables: false, | ||
printPostContent: false, | ||
regexpFilterText: '$ref', | ||
regexpFilterExpression: '^refs/tags/.*' | ||
) | ||
} | ||
environment { | ||
ARTIFACT_PATH = "$WORKSPACE/build/repository/org/opensearch/client/sql/$VERSION" | ||
} | ||
stages { | ||
stage('Publish to Maven Local') { | ||
steps { | ||
// checkout the commit | ||
checkout([ | ||
$class: 'GitSCM', userRemoteConfigs: [[url: 'https://github.com/opensearch-project/sql.git']], | ||
branches: [[name: "$ref"]] | ||
]) | ||
|
||
dir('sql-jdbc') { | ||
// publish maven artifacts | ||
sh('./gradlew --no-daemon publishPublishMavenPublicationToLocalRepoRepository') | ||
} | ||
} | ||
} | ||
stage('Sign') { | ||
steps { | ||
script { | ||
signArtifacts( | ||
artifactPath: "${ARTIFACT_PATH}", | ||
type: 'maven', | ||
platform: 'linux' | ||
) | ||
} | ||
} | ||
} | ||
stage('Stage Maven Artifacts') { | ||
environment { | ||
REPO_URL = 'https://aws.oss.sonatype.org/' | ||
STAGING_PROFILE_ID = "${SONATYPE_STAGING_PROFILE_ID}" | ||
BUILD_ID = "${BUILD_NUMBER}" | ||
} | ||
steps { | ||
// checkout the build repo | ||
git url: 'https://github.com/opensearch-project/opensearch-build.git', branch: 'main' | ||
|
||
// stage artifacts for release with Sonatype | ||
withCredentials([usernamePassword(credentialsId: 'jenkins-sonatype-creds', usernameVariable: 'SONATYPE_USERNAME', passwordVariable: 'SONATYPE_PASSWORD')]) { | ||
sh('$WORKSPACE/publish/stage-maven-release.sh $WORKSPACE/build/repository/') | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
cleanWs disableDeferredWipeout: true, deleteDirs: true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ tasks.withType(JavaCompile) { | |
} | ||
|
||
static def getShadowPath(String path) { | ||
return 'com.amazonaws.opensearch.sql.jdbc.shadow.' + path | ||
return 'org.opensearch.sql.jdbc.shadow.' + path | ||
} | ||
|
||
shadowJar { | ||
|
@@ -87,10 +87,7 @@ shadowJar { | |
exclude 'META-INF/NOTICE*' | ||
exclude 'META-INF/DEPENDENCIES' | ||
|
||
relocate('com.amazonaws', getShadowPath('com.amazonaws')) { | ||
exclude 'com.amazonaws.opensearch.*/**' | ||
} | ||
|
||
relocate 'com.amazonaws', getShadowPath('com.amazonaws') | ||
relocate 'org.apache', getShadowPath('org.apache') | ||
relocate 'org.joda', getShadowPath('org.joda') | ||
relocate 'com.fasterxml', getShadowPath('com.fasterxml') | ||
|
@@ -120,47 +117,59 @@ publishing { | |
artifact javadocJar | ||
|
||
pom { | ||
name = "OpenSearch SQL JDBC Driver" | ||
packaging = "jar" | ||
url = "https://github.com/opensearch-project/sql" | ||
description = "OpenSearch SQL JDBC driver" | ||
scm { | ||
connection = "scm:[email protected]:opensearch-project/sql.git" | ||
developerConnection = "scm:[email protected]:opensearch-project/sql.git" | ||
url = "[email protected]:opensearch-project/sql.git" | ||
} | ||
licenses { | ||
license { | ||
name = "The Apache License, Version 2.0" | ||
url = "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
name = "OpenSearch SQL JDBC Driver" | ||
packaging = "jar" | ||
url = "https://github.com/opensearch-project/sql/sql-jdbc" | ||
description = "OpenSearch SQL JDBC driver" | ||
scm { | ||
connection = "scm:[email protected]:opensearch-project/sql.git" | ||
developerConnection = "scm:[email protected]:opensearch-project/sql.git" | ||
url = "[email protected]:opensearch-project/sql.git" | ||
} | ||
licenses { | ||
license { | ||
name = "The Apache License, Version 2.0" | ||
url = "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
} | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = "amazonwebservices" | ||
organization = "Amazon Web Services" | ||
organizationUrl = "https://aws.amazon.com" | ||
developers { | ||
developer { | ||
name = 'OpenSearch' | ||
url = 'https://github.com/opensearch-project/sql' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
publishMaven(MavenPublication) { publication -> | ||
from components.java | ||
|
||
repositories { | ||
maven { | ||
name = "internal-snapshots" | ||
url = "s3://snapshots.opendistroforelasticsearch.amazon.com/maven" | ||
authentication { | ||
awsIm(AwsImAuthentication) // load from EC2 role or env var | ||
} | ||
} | ||
maven { | ||
name = "internal-releases" | ||
url = "s3://artifacts.opendistroforelasticsearch.amazon.com/maven" | ||
authentication { | ||
awsIm(AwsImAuthentication) // load from EC2 role or env var | ||
pom { | ||
name = "OpenSearch SQL JDBC Driver" | ||
packaging = "jar" | ||
url = "https://github.com/opensearch-project/sql/sql-jdbc" | ||
description = "OpenSearch SQL JDBC driver" | ||
scm { | ||
connection = "scm:[email protected]:opensearch-project/sql.git" | ||
developerConnection = "scm:[email protected]:opensearch-project/sql.git" | ||
url = "[email protected]:opensearch-project/sql.git" | ||
} | ||
licenses { | ||
license { | ||
name = "The Apache License, Version 2.0" | ||
url = "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
} | ||
} | ||
developers { | ||
developer { | ||
name = 'OpenSearch' | ||
url = 'https://github.com/opensearch-project/sql' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "sonatype-staging" | ||
url "https://aws.oss.sonatype.org/service/local/staging/deploy/maven2" | ||
|
@@ -169,6 +178,10 @@ publishing { | |
password project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : '' | ||
} | ||
} | ||
maven { | ||
name = "localRepo" | ||
url "${project.buildDir}/repository" | ||
} | ||
} | ||
|
||
// TODO - enabled debug logging for the time being, remove this eventually | ||
|