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

fix: fix publish to maven path and pypi env typo #1242

Merged
merged 5 commits into from
Nov 4, 2021
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
17 changes: 12 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ val settings = Seq(
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false),
autoAPIMappings := true,
pomPostProcess := pomPostFunc,
sbtPlugin := false
)
ThisBuild / publishMavenStyle := true

Expand Down Expand Up @@ -361,10 +362,16 @@ testWebsiteDocs := {
)
}

sonatypeProjectHosting := Some(
ThisBuild / sonatypeProjectHosting := Some(
GitHubHosting("Azure", "SynapseML", "mmlspark-support@microsot.com"))
homepage := Some(url("https://github.com/Microsoft/SynapseML"))
developers := List(
ThisBuild / homepage := Some(url("https://github.com/Microsoft/SynapseML"))
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/Azure/SynapseML"),
"scm:git@github.com:Azure/SynapseML.git"
)
)
ThisBuild / developers := List(
Developer("mhamilton723", "Mark Hamilton",
"mmlspark-support@microsoft.com", url("https://github.com/mhamilton723")),
Developer("imatiach-msft", "Ilya Matiach",
Expand All @@ -373,9 +380,9 @@ developers := List(
"mmlspark-support@microsoft.com", url("https://github.com/drdarshan"))
)

licenses += ("MIT", url("https://github.com/Microsoft/SynapseML/blob/master/LICENSE"))
ThisBuild / licenses += ("MIT", url("https://github.com/Microsoft/SynapseML/blob/master/LICENSE"))

credentials += Credentials("Sonatype Nexus Repository Manager",
ThisBuild / credentials += Credentials("Sonatype Nexus Repository Manager",
"oss.sonatype.org",
Secrets.nexusUsername,
Secrets.nexusPassword)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package com.microsoft.azure.synapse.ml.codegen

import java.io.File
import CodegenConfigProtocol._
import com.microsoft.azure.synapse.ml.build.BuildInfo
import com.microsoft.azure.synapse.ml.core.env.FileUtilities._
import org.apache.commons.io.FileUtils
import org.apache.commons.io.FilenameUtils._
Expand Down Expand Up @@ -87,13 +88,14 @@ object CodeGen {
|Config/testthat/edition: 3
|""".stripMargin)

val scalaVersion = BuildInfo.scalaVersion.split(".".toCharArray).dropRight(1).mkString(".")
writeFile(new File(conf.rSrcDir, "package_register.R"),
s"""|#' @import sparklyr
|spark_dependencies <- function(spark_version, scala_version, ...) {
| spark_dependency(
| jars = c(),
| packages = c(
| "com.microsoft.azure:${conf.name}:${conf.version}"
| "com.microsoft.azure:${conf.name}_${scalaVersion}:${conf.version}"
| ),
| repositories = c("https://mmlspark.azureedge.net/maven")
| )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.microsoft.azure.synapse.ml.core.test.fuzzing.PyTestFuzzing

import java.io.File
import CodegenConfigProtocol._
import com.microsoft.azure.synapse.ml.build.BuildInfo
import com.microsoft.azure.synapse.ml.core.env.FileUtilities._
import com.microsoft.azure.synapse.ml.core.utils.JarLoadingUtils.instantiateServices
import org.apache.commons.io.FileUtils
Expand All @@ -30,8 +31,8 @@ object TestGen {
}

private def makeInitFiles(conf: CodegenConfig, packageFolder: String = ""): Unit = {
val dir = new File(new File(conf.pyTestDir, "synapsemltest"), packageFolder)
if (!dir.exists()){
val dir = new File(new File(conf.pyTestDir, "synapsemltest"), packageFolder)
if (!dir.exists()) {
dir.mkdirs()
}
writeFile(new File(dir, "__init__.py"), "")
Expand All @@ -46,7 +47,8 @@ object TestGen {
if (!conf.pySrcDir.exists()) {
conf.pySrcDir.mkdir()
}
writeFile(join(conf.pyTestDir,"synapsemltest", "spark.py"),
val scalaVersion = BuildInfo.scalaVersion.split(".".toCharArray).dropRight(1).mkString(".")
writeFile(join(conf.pyTestDir, "synapsemltest", "spark.py"),
s"""
|# Copyright (C) Microsoft Corporation. All rights reserved.
|# Licensed under the MIT License. See LICENSE in project root for information.
Expand All @@ -59,7 +61,7 @@ object TestGen {
|spark = (SparkSession.builder
| .master("local[*]")
| .appName("PysparkTests")
| .config("spark.jars.packages", "com.microsoft.azure:synapseml:" + __spark_package_version__)
| .config("spark.jars.packages", "com.microsoft.azure:synapseml_$scalaVersion:" + __spark_package_version__)
| .config("spark.jars.repositories", "https://mmlspark.azureedge.net/maven")
| .config("spark.executor.heartbeatInterval", "60s")
| .config("spark.sql.shuffle.partitions", 10)
Expand All @@ -79,7 +81,7 @@ object TestGen {
generatePythonTests(conf)
TestBase.stopSparkSession()
generatePyPackageData(conf)
if (toDir(conf.pyTestOverrideDir).exists()){
if (toDir(conf.pyTestOverrideDir).exists()) {
FileUtils.copyDirectoryToDirectory(toDir(conf.pyTestOverrideDir), toDir(conf.pyTestDir))
}
makeInitFiles(conf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ object DatabricksUtilities extends HasHttpClient {
lazy val ClusterName = s"mmlspark-build-${LocalDateTime.now()}"

val Folder = s"/SynapseMLBuild/build_${BuildInfo.version}"
val ScalaVersion: String = BuildInfo.scalaVersion.split(".".toCharArray).dropRight(1).mkString(".")

// SynapseML info
val Version = s"com.microsoft.azure:synapseml:${BuildInfo.version}"
val Version = s"com.microsoft.azure:synapseml_$ScalaVersion:${BuildInfo.version}"
val Repository = "https://mmlspark.azureedge.net/maven"

val Libraries: String = List(
Expand Down
10 changes: 5 additions & 5 deletions pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
sbt release
displayName: Publish Artifacts
env:
STORAGE_KEY: $(storage-key)
STORAGE-KEY: $(storage-key)
NEXUS-UN: $(nexus-un)
NEXUS-PW: $(nexus-pw)
PGP-PRIVATE: $(pgp-private)
Expand All @@ -75,7 +75,7 @@ jobs:
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Publish Badges
env:
STORAGE_KEY: $(storage-key)
STORAGE-KEY: $(storage-key)
NEXUS-UN: $(nexus-un)
NEXUS-PW: $(nexus-pw)
PGP-PRIVATE: $(pgp-private)
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
sbt publishBlob
displayName: Publish Blob Artifacts
env:
STORAGE_KEY: $(storage-key)
STORAGE-KEY: $(storage-key)
NEXUS-UN: $(nexus-un)
NEXUS-PW: $(nexus-pw)
PGP-PRIVATE: $(pgp-private)
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
sbt publishBlob
displayName: Publish Blob Artifacts
env:
STORAGE_KEY: $(storage-key)
STORAGE-KEY: $(storage-key)
NEXUS-UN: $(nexus-un)
NEXUS-PW: $(nexus-pw)
PGP-PRIVATE: $(pgp-private)
Expand Down Expand Up @@ -278,7 +278,7 @@ jobs:
sbt publishPypi
condition: startsWith(variables['tag'], 'v')
env:
STORAGE_KEY: $(storage-key)
STORAGE-KEY: $(storage-key)
NEXUS-UN: $(nexus-un)
NEXUS-PW: $(nexus-pw)
PGP-PRIVATE: $(pgp-private)
Expand Down
26 changes: 12 additions & 14 deletions project/BlobMavenPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,25 @@ object BlobMavenPlugin extends AutoPlugin {
override lazy val projectSettings: Seq[Setting[_]] = Seq(
publishBlob := {
publishM2.value
//TODO make this more general - 1.0 is a hack and not sure of a way to get this with sbt keys
val sourceArtifactName = s"${moduleName.value}_${scalaBinaryVersion.value}_1.0"
val destArtifactName = s"${moduleName.value}"
val artifactName = s"${moduleName.value}_${scalaBinaryVersion.value}"
val repositoryDir = new File(new URI(Resolver.mavenLocal.root))
val orgDirs = organization.value.split(".".toCharArray.head)
val localPackageFolder = join(repositoryDir, orgDirs ++ Seq(sourceArtifactName, version.value):_*).toString
val blobMavenFolder = (orgDirs ++ Seq(destArtifactName, version.value)).mkString("/")
val localPackageFolder = join(repositoryDir, orgDirs ++ Seq(artifactName, version.value): _*).toString
val blobMavenFolder = (orgDirs ++ Seq(artifactName, version.value)).mkString("/")
uploadToBlob(localPackageFolder, blobMavenFolder, "maven")
println(blobArtifactInfo.value)
},
blobArtifactInfo := {
s"""
|SynapseML Build and Release Information
|---------------
|
|### Maven Coordinates
| `${organization.value}:${moduleName.value}:${version.value}`
|
|### Maven Resolver
| `https://mmlspark.azureedge.net/maven`
|""".stripMargin
|SynapseML Build and Release Information
|---------------
|
|### Maven Coordinates
| `${organization.value}:${moduleName.value}_${scalaBinaryVersion.value}:${version.value}`
|
|### Maven Resolver
| `https://mmlspark.azureedge.net/maven`
|""".stripMargin
}
)
}
4 changes: 2 additions & 2 deletions project/Secrets.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ object Secrets {
lazy val pgpPrivate: String = new String(Base64.getDecoder.decode(
sys.env.getOrElse("PGP-PRIVATE", getSecret("pgp-private")).getBytes("UTF-8")))
lazy val pgpPassword: String = sys.env.getOrElse("PGP-PW", getSecret("pgp-pw"))
lazy val storageKey: String = sys.env.getOrElse("STORAGE_KEY", getSecret("storage-key"))
lazy val pypiApiToken: String = sys.env.getOrElse("PYPI_API_TOKEN", getSecret("pypi-api-token"))
lazy val storageKey: String = sys.env.getOrElse("STORAGE-KEY", getSecret("storage-key"))
lazy val pypiApiToken: String = sys.env.getOrElse("PYPI-API-TOKEN", getSecret("pypi-api-token"))

}
4 changes: 2 additions & 2 deletions tools/tests/run_r_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ tryCatch({
spark_install_find(version = "3.1.2")
},
error=function(err) {
spark_install_tar("../../../../../../../../spark-3.1.2-bin-hadoop3.2.tgz")
spark_install_tar("../../../../../../../spark-3.1.2-bin-hadoop3.2.tgz")
}
)

options("testthat.output_file" = "../../../../../r-test-results.xml")
options("testthat.output_file" = "../../../../r-test-results.xml")
devtools::test(reporter = JunitReporter$new())