Skip to content

Commit

Permalink
Kokoro release jobs (googleapis#472)
Browse files Browse the repository at this point in the history
* Add Kokoro release scripts

* Update pom.xml files with sonatyle release process

* Set common configs

* Specify the trampoline image to use for release jobs

* Fix the execution directory

* Fix the execution directory

* Fix the execution directory

* remove gpg for testing

* skip gpg-agent

* keyring args are paths

* use gpg.homedir

* Fix gpg tty

* set pinentry-mode
  • Loading branch information
chingor13 authored Oct 4, 2018
1 parent e601d7d commit c1bc063
Show file tree
Hide file tree
Showing 17 changed files with 312 additions and 108 deletions.
56 changes: 56 additions & 0 deletions .kokoro/release/common.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}

# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Use the trampoline script to run in docker.
build_file: "google-http-java-client/.kokoro/trampoline.sh"

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 70247
keyname: "maven-gpg-keyring"
}
}
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 70247
keyname: "maven-gpg-passphrase"
}
}
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 70247
keyname: "maven-gpg-pubkeyring"
}
}
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 70247
keyname: "sonatype-credentials"
}
}
}
50 changes: 50 additions & 0 deletions .kokoro/release/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

# Get secrets from keystore and set and environment variables
setup_environment_secrets() {
export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase)
export GPG_TTY=$(tty)
export GPG_HOMEDIR=/gpg
mkdir $GPG_HOMEDIR
mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg
mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg
export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|')
export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|')
}

create_settings_xml_file() {
echo "<settings>
<servers>
<server>
<id>ossrh</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>" > $1
}
7 changes: 7 additions & 0 deletions .kokoro/release/drop.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Tell the trampoline which build file to use.
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/google-http-java-client/.kokoro/release/drop.sh"
}
25 changes: 25 additions & 0 deletions .kokoro/release/drop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

source $(dirname "$0")/common.sh

pushd $(dirname "$0")/../../

setup_environment_secrets
create_settings_xml_file "settings.xml"

mvn nexus-staging:drop --settings=settings.xml
7 changes: 7 additions & 0 deletions .kokoro/release/promote.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Tell the trampoline which build file to use.
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/google-http-java-client/.kokoro/release/promote.sh"
}
25 changes: 25 additions & 0 deletions .kokoro/release/promote.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

source $(dirname "$0")/common.sh

pushd $(dirname "$0")/../../

setup_environment_secrets
create_settings_xml_file "settings.xml"

mvn nexus-staging:release -DperformRelease=true --settings=settings.xml
7 changes: 7 additions & 0 deletions .kokoro/release/stage.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Tell the trampoline which build file to use.
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/google-http-java-client/.kokoro/release/stage.sh"
}
32 changes: 32 additions & 0 deletions .kokoro/release/stage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

source $(dirname "$0")/common.sh

pushd $(dirname "$0")/../../

setup_environment_secrets
create_settings_xml_file "settings.xml"

mvn clean install deploy \
--settings settings.xml \
-DperformRelease=true \
-Dgpg.executable=gpg \
-Dgpg.passphrase=${GPG_PASSPHRASE} \
-Dgpg.homedir=${GPG_HOMEDIR}


2 changes: 1 addition & 1 deletion google-http-client-android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>http://download.oracle.com/javase/1.5.0/docs/api/</link>
<link>http://download.oracle.com/javase/6/docs/api/</link>
</links>
<doctitle>${project.name} ${project.version}</doctitle>
<windowtitle>${project.artifactId} ${project.version}</windowtitle>
Expand Down
4 changes: 2 additions & 2 deletions google-http-client-gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>http://download.oracle.com/javase/1.5.0/docs/api/</link>
<link>http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs</link>
<link>http://download.oracle.com/javase/6/docs/api/</link>
<link>https://www.javadoc.io/doc/com.google.code.gson/gson/${project.gson.version}</link>
</links>
<doctitle>${project.name} ${project.version}</doctitle>
<windowtitle>${project.artifactId} ${project.version}</windowtitle>
Expand Down
4 changes: 2 additions & 2 deletions google-http-client-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>https://download.oracle.com/javase/1.6.0/docs/api/</link>
<link>https://jar-download.com/artifacts/org.codehaus.jackson/jackson-core-asl/1.9.13/documentation</link>
<link>http://download.oracle.com/javase/6/docs/api/</link>
<link>https://jar-download.com/artifacts/org.codehaus.jackson/jackson-core-asl/${project.jackson-core-asl.version}/documentation</link>
</links>
<doctitle>${project.name} ${project.version}</doctitle>
<windowtitle>${project.artifactId} ${project.version}</windowtitle>
Expand Down
4 changes: 2 additions & 2 deletions google-http-client-jackson2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>http://download.oracle.com/javase/1.5.0/docs/api/</link>
<link>http://fasterxml.github.com/jackson-core/javadoc/2.0.5/</link>
<link>http://download.oracle.com/javase/6/docs/api/</link>
<link>http://fasterxml.github.com/jackson-core/javadoc/${project.jackson-core2.version}/</link>
</links>
<doctitle>${project.name} ${project.version}</doctitle>
<windowtitle>${project.artifactId} ${project.version}</windowtitle>
Expand Down
11 changes: 1 addition & 10 deletions google-http-client-jdo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>http://download.oracle.com/javase/1.5.0/docs/api/</link>
<link>http://download.oracle.com/javase/6/docs/api/</link>
</links>
<doctitle>${project.name} ${project.version}</doctitle>
<windowtitle>${project.artifactId} ${project.version}</windowtitle>
Expand All @@ -30,15 +30,6 @@
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>jar</id>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion google-http-client-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>http://download.oracle.com/javase/1.5.0/docs/api/</link>
<link>http://download.oracle.com/javase/6/docs/api/</link>
</links>
<doctitle>${project.name} ${project.version}</doctitle>
<windowtitle>${project.artifactId} ${project.version}</windowtitle>
Expand Down
2 changes: 1 addition & 1 deletion google-http-client-xml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>http://download.oracle.com/javase/1.5.0/docs/api/</link>
<link>http://download.oracle.com/javase/6/docs/api/</link>
</links>
<doctitle>${project.name} ${project.version}</doctitle>
<windowtitle>${project.artifactId} ${project.version}</windowtitle>
Expand Down
6 changes: 3 additions & 3 deletions google-http-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>http://download.oracle.com/javase/1.5.0/docs/api/</link>
<link>http://docs.guava-libraries.googlecode.com/git-history/v13.0.1/javadoc</link>
<link>http://commons.apache.org/proper/commons-codec/javadocs/api-release</link>
<link>http://download.oracle.com/javase/6/docs/api/</link>
<link>https://google.github.io/guava/releases/${project.guava.version}/api/docs/</link>
<link>https://commons.apache.org/proper/commons-codec/archives/${project.commons-codec.version}/apidocs/</link>
</links>
<doctitle>${project.name} ${project.version}</doctitle>
<windowtitle>${project.artifactId} ${project.version}</windowtitle>
Expand Down
Loading

0 comments on commit c1bc063

Please sign in to comment.