Skip to content

Commit

Permalink
Update sonatype publish scripts [skip ci] (#3130)
Browse files Browse the repository at this point in the history
  • Loading branch information
pomadchin authored Oct 18, 2019
1 parent 7871e01 commit 27f2830
Show file tree
Hide file tree
Showing 12 changed files with 207 additions and 127 deletions.
50 changes: 25 additions & 25 deletions .locationtech/deploy-211.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
set -e
set -x

./sbt "project macros" publish -no-colors \
&& ./sbt "project vector" publish -no-colors \
&& ./sbt "project proj4" publish -no-colors \
&& ./sbt "project raster" publish -no-colors \
&& ./sbt "project spark" publish -no-colors \
&& ./sbt "project spark-pipeline" publish -no-colors \
&& ./sbt "project s3" publish -no-colors \
&& ./sbt "project s3-spark" publish -no-colors \
&& ./sbt "project accumulo" publish -no-colors \
&& ./sbt "project accumulo-spark" publish -no-colors \
&& ./sbt "project hbase" publish -no-colors \
&& ./sbt "project hbase-spark" publish -no-colors \
&& ./sbt "project cassandra" publish -no-colors \
&& ./sbt "project cassandra-spark" publish -no-colors \
&& ./sbt "project geomesa" publish -no-colors \
&& ./sbt "project geotools" publish -no-colors \
&& ./sbt "project shapefile" publish -no-colors \
&& ./sbt "project layer" publish -no-colors \
&& ./sbt "project store" publish -no-colors \
&& ./sbt "project util" publish -no-colors \
&& ./sbt "project vectortile" publish -no-colors \
&& ./sbt "project raster-testkit" publish -no-colors \
&& ./sbt "project vector-testkit" publish -no-colors \
&& ./sbt "project spark-testkit" publish -no-colors \
&& ./sbt "project gdal" publish -no-colors
./sbt "project macros" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project vector" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project proj4" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project raster" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project spark" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project spark-pipeline" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project s3" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project s3-spark" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project accumulo" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project accumulo-spark" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project hbase" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project hbase-spark" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project cassandra" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project cassandra-spark" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project geomesa" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project geotools" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project shapefile" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project layer" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project store" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project util" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project vectortile" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project raster-testkit" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project vector-testkit" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project spark-testkit" publish -no-colors -J-Drelease=locationtech \
&& ./sbt "project gdal" publish -no-colors -J-Drelease=locationtech
48 changes: 24 additions & 24 deletions .locationtech/deploy-212.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
set -x

# there is no geomesa project
./sbt -212 "project macros" publish -no-colors \
&& ./sbt -212 "project vector" publish -no-colors \
&& ./sbt -212 "project proj4" publish -no-colors \
&& ./sbt -212 "project raster" publish -no-colors \
&& ./sbt -212 "project spark" publish -no-colors \
&& ./sbt -212 "project spark-pipeline" publish -no-colors \
&& ./sbt -212 "project s3" publish -no-colors \
&& ./sbt -212 "project s3-spark" publish -no-colors \
&& ./sbt -212 "project accumulo" publish -no-colors \
&& ./sbt -212 "project accumulo-spark" publish -no-colors \
&& ./sbt -212 "project hbase" publish -no-colors \
&& ./sbt -212 "project hbase-spark" publish -no-colors \
&& ./sbt -212 "project cassandra" publish -no-colors \
&& ./sbt -212 "project cassandra-spark" publish -no-colors \
&& ./sbt -212 "project geotools" publish -no-colors \
&& ./sbt -212 "project shapefile" publish -no-colors \
&& ./sbt -212 "project layer" publish -no-colors \
&& ./sbt -212 "project store" publish -no-colors \
&& ./sbt -212 "project util" publish -no-colors \
&& ./sbt -212 "project vectortile" publish -no-colors \
&& ./sbt -212 "project raster-testkit" publish -no-colors \
&& ./sbt -212 "project vector-testkit" publish -no-colors \
&& ./sbt -212 "project spark-testkit" publish -no-colors \
&& ./sbt -212 "project gdal" publish -no-colors
./sbt -212 "project macros" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project vector" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project proj4" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project raster" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project spark" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project spark-pipeline" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project s3" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project s3-spark" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project accumulo" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project accumulo-spark" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project hbase" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project hbase-spark" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project cassandra" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project cassandra-spark" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project geotools" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project shapefile" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project layer" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project store" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project util" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project vectortile" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project raster-testkit" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project vector-testkit" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project spark-testkit" publish -no-colors -J-Drelease=locationtech \
&& ./sbt -212 "project gdal" publish -no-colors -J-Drelease=locationtech
21 changes: 8 additions & 13 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,14 @@ lazy val commonSettings = Seq(
publishTo := {
val sonatype = "https://oss.sonatype.org/"
val locationtech = "https://repo.locationtech.org/content/repositories"
if (isSnapshot.value) {
// Publish snapshots to LocationTech
Some("LocationTech Snapshot Repository" at s"${locationtech}/geotrellis-snapshots")
} else {
val milestoneRx = """-(M|RC)\d+$""".r
milestoneRx.findFirstIn(Version.geotrellis) match {
case Some(v) =>
// Public milestones to LocationTech
Some("LocationTech Release Repository" at s"${locationtech}/geotrellis-releases")
case None =>
// Publish releases to Sonatype
Some("Sonatype Release Repository" at s"${sonatype}service/local/staging/deploy/maven2")
}
// a default repository would be Sonatype
System.getProperty("release") match {
case "locationtech" if isSnapshot.value =>
Some("LocationTech Snapshot Repository" at s"${locationtech}/geotrellis-snapshots")
case "locationtech" =>
Some("LocationTech Release Repository" at s"${locationtech}/geotrellis-releases")
case _ =>
Some("Sonatype Release Repository" at s"${sonatype}service/local/staging/deploy/maven2")
}
},

Expand Down
12 changes: 8 additions & 4 deletions publish/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
ARG RELEASE_TAG=2.0
FROM java:8

USER root

# a hack that allows to set ENV var through ARGs
ARG RELEASE_TAG=v3.0.0
ENV RELEASE_TAG $RELEASE_TAG

RUN apt-get install git

RUN useradd -ms /bin/bash geotrellis

RUN mkdir /home/geotrellis/.ivy2
COPY gpg.sbt /home/geotrellis/.sbt/1.0/plugins/gpg.sbt
RUN chown -R geotrellis:geotrellis /home/geotrellis

USER geotrellis

RUN mkdir -p /home/geotrellis/.sbt/1.0/plugins && mkdir -p /home/geotrellis/.sbt/boot

RUN set -x \
&& cd /home/geotrellis \
&& git clone https://github.com/locationtech/geotrellis /home/geotrellis/geotrellis \
&& cd /home/geotrellis/geotrellis \
&& git checkout $RELEASE_TAG
&& git checkout -f $RELEASE_TAG

WORKDIR /home/geotrellis/geotrellis
WORKDIR /home/geotrellis/geotrellis
30 changes: 19 additions & 11 deletions publish/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
IMG := geotrellis/publish-geotrellis-container
TAG := latest
RELEASE_TAG := 2.0
IMG := geotrellis/publish-geotrellis-container
TAG := latest
RELEASE_TAG := v3.0.0
GEOTRELLIS_VERSION_SUFFIX := ""
PGPKEYS_PATH := ~/.gnupg
CREDENTIALS_PATH := ~/.ivy2

build: Dockerfile
docker build \
--build-arg RELEASE_TAG=$(RELEASE_TAG) \
--no-cache -t ${IMG}:${TAG} .
docker build --build-arg RELEASE_TAG=${RELEASE_TAG} --no-cache -t ${IMG}:${TAG} .

run:
docker run -it --rm \
-v ~/.ivy2/.credentials:/home/geotrellis/.ivy2/.credentials \
-v ~/.gnupg:/home/geotrellis/.gnupg \
$(IMG):$(TAG) /bin/bash
docker run -e GEOTRELLIS_VERSION_SUFFIX=${GEOTRELLIS_VERSION_SUFFIX} -it --rm \
-v ${PWD}/gpg.sbt:/home/geotrellis/.sbt/1.0/plugins/gpg.sbt \
-v ${PWD}/global.sbt:/home/geotrellis/.sbt/1.0/global.sbt \
-v ${CREDENTIALS_PATH}/.credentials:/home/geotrellis/.ivy2/.credentials \
-v ${PGPKEYS_PATH}:/home/geotrellis/.gnupg \
${IMG}:${TAG} /bin/bash

publish:
docker run -it $(IMG):$(TAG) publish/publish-to-sonatype.sh
docker run -e GEOTRELLIS_VERSION_SUFFIX=${GEOTRELLIS_VERSION_SUFFIX} -it --rm \
-v ${PWD}/gpg.sbt:/home/geotrellis/.sbt/1.0/plugins/gpg.sbt \
-v ${PWD}/global.sbt:/home/geotrellis/.sbt/1.0/global.sbt \
-v ${CREDENTIALS_PATH}/.credentials:/home/geotrellis/.ivy2/.credentials \
-v ${PGPKEYS_PATH}:/home/geotrellis/.gnupg \
${IMG}:${TAG} publish/publish-to-sonatype.sh
43 changes: 38 additions & 5 deletions publish/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
## Publishing GeoTrellis Releases

This directory contains the elements needed to publish GeoTrellis to Sonatype.
It allows to create an _isolated_ environment to publish GeoTrellis,
since we had lot's of issues with conflicting sbt versions / gpg version / etc.

## Setup

You'll need to have the proper Sonatype credentials in `~/.ivy2/.credentials`,
the proper PGP public and private key in `~/.gnupg`,
the password for the private key (for jar signing) in `~/.sbt/0.13/local.sbt`,
and a `~/.sbt/0.13/plugins/plugins.sbt` that looks like:
You'll need to have the proper Sonatype credentials in `./sonatype.sbt`:
```scala
realm=Sonatype Nexus Repository Manager
host=oss.sonatype.org
user=username
password=password
```

The proper PGP public and private key in `~/.gnupg` (or in any other directory, see `Makefile`).
The passphrase for the private key (for jar signing) in `./global.sbt`:

```scala
pgpPassphrase := Some(Array('p', 'a', 's', 's', 'w', 'o', 'r', 'd'))
```
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")

And a `./gpg.sbt` that looks like:

```scala
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
```

As we change SBT versions, we'll need to modify the `Makefile` to point the correct
Expand All @@ -24,6 +38,25 @@ Note: Sonatype requires JARs be signd via PGP, so if you do not have keys
with a distributed public key, you'll have to work through the instructions here:
http://central.sonatype.org/pages/working-with-pgp-signatures.html

## Makefile variables

In the Makefile you can specify the following variables:

```makefile
# docker image default name
IMG := geotrellis/publish-geotrellis-container
# docker image default tag
TAG := latest
# GeoTrellis release tag
RELEASE_TAG := v3.0.0
# GeoTrellis version suffix that determines the release type
GEOTRELLIS_VERSION_SUFFIX := ""
# path to PGP keys
PGPKEYS_PATH := ~/.gnupg
# path to Sonatype credentials
CREDENTIALS_PATH := ~/.ivy2
```

## Building the container

First build the container using `make build`. The image will always be rebuilt from
Expand Down
1 change: 1 addition & 0 deletions publish/global.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pgpPassphrase := Some(Array('p', 'a', 's', 's', 'w', 'o', 'r', 'd'))
28 changes: 28 additions & 0 deletions publish/publish-to-sonatype-211.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Publish to sonatype for all supported scala version 2.11

./sbt "project macros" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project vector" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project proj4" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project raster" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project spark" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project spark-pipeline" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project s3" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project s3-spark" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project accumulo" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project accumulo-spark" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project hbase" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project hbase-spark" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project cassandra" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project cassandra-spark" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project geomesa" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project geotools" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project shapefile" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project layer" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project store" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project util" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project vectortile" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project raster-testkit" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project vector-testkit" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project spark-testkit" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt "project gdal" publishSigned -no-colors -J-Drelease=sonatype
28 changes: 28 additions & 0 deletions publish/publish-to-sonatype-212.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Publish to sonatype for all supported scala version 2.12

# there is no geomesa project
./sbt -212 "project macros" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project vector" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project proj4" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project raster" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project spark" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project spark-pipeline" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project s3" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project s3-spark" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project accumulo" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project accumulo-spark" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project hbase" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project hbase-spark" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project cassandra" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project cassandra-spark" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project geotools" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project shapefile" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project layer" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project store" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project util" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project vectortile" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project raster-testkit" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project vector-testkit" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project spark-testkit" publishSigned -no-colors -J-Drelease=sonatype \
&& ./sbt -212 "project gdal" publishSigned -no-colors -J-Drelease=sonatype
21 changes: 2 additions & 19 deletions publish/publish-to-sonatype.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
#!/bin/bash
# Publish to sonatype for all supported scala version 2.11

./sbt "project macros" publish-signed \
&& ./sbt "project vector" publish-signed \
&& ./sbt "project proj4" publish-signed \
&& ./sbt "project raster" publish-signed \
&& ./sbt "project spark" publish-signed \
&& ./sbt "project s3" publish-signed \
&& ./sbt "project accumulo" publish-signed \
&& ./sbt "project cassandra" publish-signed \
&& ./sbt "project hbase" publish-signed \
&& ./sbt "project geomesa" publish-signed \
&& ./sbt "project geowave" publish-signed \
&& ./sbt "project geotools" publish-signed \
&& ./sbt "project shapefile" publish-signed \
&& ./sbt "project util" publish-signed \
&& ./sbt "project vectortile" publish-signed \
&& ./sbt "project raster-testkit" publish-signed \
&& ./sbt "project vector-testkit" publish-signed \
&& ./sbt "project spark-testkit" publish-signed
./publish/publish-to-sonatype-211.sh
./publish/publish-to-sonatype-212.sh
2 changes: 1 addition & 1 deletion scripts/nginxTestHttp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ docker pull nginx:stable

docker run \
-p 8081:80 \
-v $(pwd)/../spark/src/test/resources:/usr/share/nginx/html:ro \
-v ${PWD}/../spark/src/test/resources:/usr/share/nginx/html:ro \
-d nginx:stable

Loading

0 comments on commit 27f2830

Please sign in to comment.