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

Publish uber jar to snapshot repo #12

Merged
merged 11 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 12 additions & 3 deletions .github/workflows/snapshot-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,33 @@ jobs:
java-version: 11

- name: Publish to Local Maven
run: sbt publishM2
run: sbt standaloneCosmetic/publishM2

- uses: actions/checkout@v3
with:
repository: 'opensearch-project/opensearch-build-libraries'
path: 'build'

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v1.7.0
with:
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
aws-region: us-east-1

- name: generate sha and md5
run: |
for i in `find ${HOME}/.m2/repository/org/opensearch/ -name "*.pom" -type f`; do sha512sum "$i" | awk '{print $1}' >> "$i.sha512"; done
for i in `find ${HOME}/.m2/repository/org/opensearch/ -name "*.jar" -type f`; do sha512sum "$i" | awk '{print $1}' >> "$i.sha512"; done
for i in `find ${HOME}/.m2/repository/org/opensearch/ -name "*.pom" -type f`; do sha256sum "$i" | awk '{print $1}' >> "$i.sha256"; done
for i in `find ${HOME}/.m2/repository/org/opensearch/ -name "*.jar" -type f`; do sha256sum "$i" | awk '{print $1}' >> "$i.sha256"; done

- name: Get credentials and publish snapshots to maven
run: |
export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text)
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
echo "::add-mask::$SONATYPE_USERNAME"
echo "::add-mask::$SONATYPE_PASSWORD"
export SNAPSHOT_REPO_URL="https://aws.oss.sonatype.org/content/repositories/snapshots/"
build/resources/publish/publish-snapshot.sh $HOME/.m2
cd build/resources/publish/
cp -a $HOME/.m2/repository/* ./
./publish-snapshot.sh ./
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ spark-sql --conf "spark.sql.extensions=org.opensearch.flint.FlintSparkExtensions
To build and run this application with Spark, you can run:

```
sbt clean publishLocal
sbt clean standaloneCosmetic/publishM2
```
then add org.opensearch:opensearch-spark_2.12 when run spark application, for example,
```
bin/spark-shell --packages "org.opensearch:opensearch-spark_2.12:0.1.0-SNAPSHOT"
```

## Code of Conduct
Expand All @@ -44,4 +48,4 @@ See the [LICENSE](../LICENSE.txt) file for our project's licensing. We will ask

## Copyright

Copyright OpenSearch Contributors. See [NOTICE](../NOTICE) for details.
Copyright OpenSearch Contributors. See [NOTICE](../NOTICE) for details.
34 changes: 29 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import Dependencies._

lazy val scala212 = "2.12.14"
lazy val sparkVersion = "3.3.1"
lazy val sparkVersion = "3.3.2"
lazy val opensearchVersion = "2.6.0"

ThisBuild / organization := "org.opensearch"
Expand Down Expand Up @@ -33,6 +33,8 @@ lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
lazy val testScalastyle = taskKey[Unit]("testScalastyle")

lazy val commonSettings = Seq(
javacOptions ++= Seq("-source", "11"),
Compile / compile / javacOptions ++= Seq("-target", "11"),
// Scalastyle
scalastyleConfig := (ThisBuild / scalastyleConfig).value,
compileScalastyle := (Compile / scalastyle).toTask("").value,
Expand All @@ -43,31 +45,33 @@ lazy val commonSettings = Seq(
lazy val root = (project in file("."))
.aggregate(flintCore, flintSparkIntegration)
.disablePlugins(AssemblyPlugin)
.settings(name := "flint")
.settings(name := "flint", publish / skip := true)

lazy val flintCore = (project in file("flint-core"))
.disablePlugins(AssemblyPlugin)
.settings(
commonSettings,
name := "flint-core",
scalaVersion := scala212,
libraryDependencies ++= Seq(
"org.opensearch.client" % "opensearch-rest-client" % opensearchVersion,
"org.opensearch.client" % "opensearch-rest-high-level-client" % opensearchVersion
exclude ("org.apache.logging.log4j", "log4j-api"),
"com.amazonaws" % "aws-java-sdk" % "1.12.397" % "provided"
exclude ("com.fasterxml.jackson.core", "jackson-databind")))
exclude ("com.fasterxml.jackson.core", "jackson-databind")),
publish / skip := true)

lazy val flintSparkIntegration = (project in file("flint-spark-integration"))
.dependsOn(flintCore)
.enablePlugins(AssemblyPlugin, Antlr4Plugin)
.settings(
commonSettings,
name := "flint-spark",
name := "flint-spark-integration",
scalaVersion := scala212,
libraryDependencies ++= Seq(
"com.amazonaws" % "aws-java-sdk" % "1.12.397" % "provided"
exclude ("com.fasterxml.jackson.core", "jackson-databind"),
"org.scalactic" %% "scalactic" % "3.2.15",
"org.scalactic" %% "scalactic" % "3.2.15" % "test",
"org.scalatest" %% "scalatest" % "3.2.15" % "test",
"org.scalatest" %% "scalatest-flatspec" % "3.2.15" % "test",
"org.scalatestplus" %% "mockito-4-6" % "3.2.15.0" % "test",
Expand Down Expand Up @@ -111,3 +115,23 @@ lazy val integtest = (project in file("integ-test"))
"org.testcontainers" % "testcontainers" % "1.18.0" % "test"),
libraryDependencies ++= deps(sparkVersion),
Test / fullClasspath += (flintSparkIntegration / assembly).value)

lazy val standaloneCosmetic = project
.settings(
name := "opensearch-spark-standalone",
commonSettings,
releaseSettings,
exportJars := true,
Compile / packageBin := (flintSparkIntegration / assembly).value)

lazy val releaseSettings = Seq(
publishMavenStyle := true,
publishArtifact := true,
Test / publishArtifact := false,
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0")),
pomExtra :=
<url>https://opensearch.org/</url>
<scm>
<url>[email protected]:opensearch-project/opensearch-spark.git</url>
<connection>scm:git:[email protected]:opensearch-project/opensearch-spark.git</connection>
</scm>)
Loading