mirror of https://github.com/grpc/grpc-java.git
Automate release process for example-hostname
This commit is contained in:
parent
1c50bcafd5
commit
b1ca6e8d27
|
|
@ -6,6 +6,7 @@ timeout_mins: 60
|
|||
|
||||
action {
|
||||
define_artifacts {
|
||||
regex: ["**/mvn-artifacts/**"]
|
||||
regex: "github/grpc-java/mvn-artifacts/**"
|
||||
regex: "github/grpc-java/artifacts/**"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ env_vars {
|
|||
# We always build mvn artifacts.
|
||||
action {
|
||||
define_artifacts {
|
||||
regex: ["**/mvn-artifacts/**"]
|
||||
regex: "github/grpc-java/mvn-artifacts/**"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,8 +88,16 @@ if [[ -z "${ALL_ARTIFACTS:-}" ]]; then
|
|||
./gradlew grpc-compiler:build grpc-compiler:publish $GRADLE_FLAGS \
|
||||
-Dorg.gradle.parallel=false -PrepositoryDir=$LOCAL_MVN_TEMP
|
||||
else
|
||||
./gradlew publish $GRADLE_FLAGS \
|
||||
./gradlew publish :grpc-core:versionFile $GRADLE_FLAGS \
|
||||
-Dorg.gradle.parallel=false -PrepositoryDir=$LOCAL_MVN_TEMP
|
||||
pushd examples/example-hostname
|
||||
../gradlew jibBuildTar $GRADLE_FLAGS
|
||||
popd
|
||||
|
||||
readonly OTHER_ARTIFACT_DIR="${OTHER_ARTIFACT_DIR:-$GRPC_JAVA_DIR/artifacts}"
|
||||
mkdir -p "$OTHER_ARTIFACT_DIR"
|
||||
cp core/build/version "$OTHER_ARTIFACT_DIR"/
|
||||
cp examples/example-hostname/build/example-hostname.* "$OTHER_ARTIFACT_DIR"/
|
||||
fi
|
||||
|
||||
readonly MVN_ARTIFACT_DIR="${MVN_ARTIFACT_DIR:-$GRPC_JAVA_DIR/mvn-artifacts}"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ find "$KOKORO_GFILE_DIR"
|
|||
|
||||
# The output from all the jobs are coalesced into a single dir
|
||||
LOCAL_MVN_ARTIFACTS="$KOKORO_GFILE_DIR"/github/grpc-java/mvn-artifacts/
|
||||
LOCAL_OTHER_ARTIFACTS="$KOKORO_GFILE_DIR"/github/grpc-java/artifacts/
|
||||
|
||||
# verify that files from all 3 grouped jobs are present.
|
||||
# platform independent artifacts, from linux job:
|
||||
|
|
@ -45,6 +46,9 @@ mkdir -p ~/java_signing/
|
|||
gsutil cp -r gs://grpc-testing-secrets/java_signing/ ~/
|
||||
gpg --batch --import ~/java_signing/grpc-java-team-sonatype.asc
|
||||
|
||||
gsutil cat gs://grpc-testing-secrets/dockerhub_credentials/grpcpackages.password \
|
||||
| docker login --username grpcpackages --password-stdin
|
||||
|
||||
# gpg commands changed between v1 and v2 are different.
|
||||
gpg --version
|
||||
|
||||
|
|
@ -65,5 +69,19 @@ if gpg --version | grep 'gpg (GnuPG) 2.'; then
|
|||
--detach-sign -a {} \;
|
||||
fi
|
||||
|
||||
# Just the numbers; does not include leading 'v'
|
||||
VERSION="$(cat $LOCAL_OTHER_ARTIFACTS/version)"
|
||||
EXAMPLE_HOSTNAME_ID="$(cat "$LOCAL_OTHER_ARTIFACTS/example-hostname.id")"
|
||||
docker load --input "$LOCAL_OTHER_ARTIFACTS/example-hostname.tar"
|
||||
LATEST_VERSION="$((echo "v$VERSION"; git ls-remote -t https://github.com/grpc/grpc-java.git | cut -f 2 | sed s#refs/tags/##) | sort -V | tail -n 1)"
|
||||
|
||||
|
||||
STAGING_REPO=a93898609ef848
|
||||
"$GRPC_JAVA_DIR"/buildscripts/sonatype-upload.sh "$STAGING_REPO" "$LOCAL_MVN_ARTIFACTS"
|
||||
|
||||
docker tag "$EXAMPLE_HOSTNAME_ID" "grpc/java-example-hostname:${VERSION}"
|
||||
docker push "grpc/java-example-hostname:${VERSION}"
|
||||
if [[ "$VERSION" = "$LATEST_VERSION" ]]; then
|
||||
docker tag "$EXAMPLE_HOSTNAME_ID" grpc/java-example-hostname:latest
|
||||
docker push grpc/java-example-hostname:latest
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ timeout_mins: 45
|
|||
# We always build mvn artifacts.
|
||||
action {
|
||||
define_artifacts {
|
||||
regex: ["**/build/test-results/**/*.xml", "**/mvn-artifacts/**"]
|
||||
regex: "**/build/test-results/**/*.xml"
|
||||
regex: "github/grpc-java/mvn-artifacts/**"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,3 +56,9 @@ plugins.withId("java") {
|
|||
options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF)
|
||||
}
|
||||
}
|
||||
|
||||
task versionFile() {
|
||||
doLast {
|
||||
new File(buildDir, "version").write("${project.version}\n")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ plugins {
|
|||
id 'java'
|
||||
|
||||
id "com.google.protobuf" version "0.8.10"
|
||||
id 'com.google.cloud.tools.jib' version '2.1.0' // For releasing to Docker Hub
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
|
@ -52,3 +53,13 @@ protobuf {
|
|||
|
||||
applicationName = 'hostname-server'
|
||||
mainClassName = 'io.grpc.examples.hostname.HostnameServer'
|
||||
|
||||
// For releasing to Docker Hub
|
||||
jib {
|
||||
container.ports = ['50051']
|
||||
outputPaths {
|
||||
tar = 'build/example-hostname.tar'
|
||||
digest = 'build/example-hostname.digest'
|
||||
imageId = 'build/example-hostname.id'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue