Skip to content

Commit eb7e845

Browse files
authored
Kokoro release (#200)
* Add publish and stage release Kokoro configs * Fix credentials * Use trampoline for releases * Make release scripts executable * Fix release directory * Fix pin-entry for gpg signing * temporarily bump version, fix artifact path * Try to get the nice artifact path
1 parent e75322b commit eb7e845

File tree

9 files changed

+219
-1
lines changed

9 files changed

+219
-1
lines changed

.kokoro/release/common.cfg

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Download trampoline resources.
4+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
5+
6+
# Use the trampoline script to run in docker.
7+
build_file: "google-auth-library-java/.kokoro/trampoline.sh"
8+
9+
# Configure the docker image for kokoro-trampoline.
10+
env_vars: {
11+
key: "TRAMPOLINE_IMAGE"
12+
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
13+
}
14+
15+
before_action {
16+
fetch_keystore {
17+
keystore_resource {
18+
keystore_config_id: 70247
19+
keyname: "maven-gpg-keyring"
20+
}
21+
}
22+
}
23+
24+
before_action {
25+
fetch_keystore {
26+
keystore_resource {
27+
keystore_config_id: 70247
28+
keyname: "maven-gpg-passphrase"
29+
}
30+
}
31+
}
32+
33+
before_action {
34+
fetch_keystore {
35+
keystore_resource {
36+
keystore_config_id: 70247
37+
keyname: "maven-gpg-pubkeyring"
38+
}
39+
}
40+
}
41+
42+
before_action {
43+
fetch_keystore {
44+
keystore_resource {
45+
keystore_config_id: 70247
46+
keyname: "sonatype-credentials"
47+
}
48+
}
49+
}

.kokoro/release/common.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
# Copyright 2018 Google Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
# Get secrets from keystore and set and environment variables
19+
setup_environment_secrets() {
20+
export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase)
21+
export GPG_TTY=$(tty)
22+
export GPG_HOMEDIR=/gpg
23+
mkdir $GPG_HOMEDIR
24+
mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg
25+
mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg
26+
export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|')
27+
export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|')
28+
}
29+
30+
create_settings_xml_file() {
31+
echo "<settings>
32+
<servers>
33+
<server>
34+
<id>ossrh</id>
35+
<username>${SONATYPE_USERNAME}</username>
36+
<password>${SONATYPE_PASSWORD}</password>
37+
</server>
38+
<server>
39+
<id>sonatype-nexus-staging</id>
40+
<username>${SONATYPE_USERNAME}</username>
41+
<password>${SONATYPE_PASSWORD}</password>
42+
</server>
43+
<server>
44+
<id>sonatype-nexus-snapshots</id>
45+
<username>${SONATYPE_USERNAME}</username>
46+
<password>${SONATYPE_PASSWORD}</password>
47+
</server>
48+
</servers>
49+
</settings>" > $1
50+
}

.kokoro/release/drop.cfg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "TRAMPOLINE_BUILD_FILE"
5+
value: "github/google-auth-library-java/.kokoro/release/drop.sh"
6+
}
7+
8+
# Download staging properties file.
9+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java/releases/google-auth-library"

.kokoro/release/drop.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# Copyright 2018 Google Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
source $(dirname "$0")/common.sh
19+
MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../)/settings.xml
20+
pushd $(dirname "$0")/../
21+
22+
setup_environment_secrets
23+
create_settings_xml_file "settings.xml"
24+
25+
mvn nexus-staging:drop -DperformRelease=true

.kokoro/release/promote.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "TRAMPOLINE_BUILD_FILE"
5+
value: "github/google-auth-library-java/.kokoro/release/promote.sh"
6+
}
7+
8+
# Download staging properties file.
9+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java/releases/google-auth-library"
10+

.kokoro/release/promote.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# Copyright 2018 Google Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
source $(dirname "$0")/common.sh
19+
MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../)/settings.xml
20+
pushd $(dirname "$0")/../
21+
22+
setup_environment_secrets
23+
create_settings_xml_file "settings.xml"
24+
25+
mvn nexus-staging:release -DperformRelease=true

.kokoro/release/stage.cfg

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "TRAMPOLINE_BUILD_FILE"
5+
value: "github/google-auth-library-java/.kokoro/release/stage.sh"
6+
}
7+
8+
# Need to save the properties file
9+
action {
10+
define_artifacts {
11+
regex: "github/google-auth-library-java/target/nexus-staging/staging/*.properties"
12+
strip_prefix: "github/google-auth-library-java"
13+
}
14+
}

.kokoro/release/stage.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# Copyright 2018 Google Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
source $(dirname "$0")/common.sh
19+
MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml
20+
pushd $(dirname "$0")/../../
21+
22+
setup_environment_secrets
23+
create_settings_xml_file "settings.xml"
24+
25+
mvn clean install deploy \
26+
--settings ${MAVEN_SETTINGS_FILE} \
27+
-DperformRelease=true \
28+
-Dgpg.executable=gpg \
29+
-Dgpg.passphrase=${GPG_PASSPHRASE} \
30+
-Dgpg.homedir=${GPG_HOMEDIR}

pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,20 @@
248248
<plugin>
249249
<groupId>org.apache.maven.plugins</groupId>
250250
<artifactId>maven-gpg-plugin</artifactId>
251-
<version>1.5</version>
251+
<version>1.6</version>
252252
<executions>
253253
<execution>
254254
<id>sign-artifacts</id>
255255
<phase>verify</phase>
256256
<goals>
257257
<goal>sign</goal>
258258
</goals>
259+
<configuration>
260+
<gpgArguments>
261+
<arg>--pinentry-mode</arg>
262+
<arg>loopback</arg>
263+
</gpgArguments>
264+
</configuration>
259265
</execution>
260266
</executions>
261267
</plugin>

0 commit comments

Comments
 (0)