Skip to content
Closed
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
64 changes: 64 additions & 0 deletions buildscripts/cloudbuild-testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
substitutions:
_GAE_SERVICE_ACCOUNT: [email protected]
options:
env:
- BUILD_ID=$BUILD_ID
- KOKORO_GAE_SERVICE=java-gae-interop-test
- DUMMY_DEFAULT_VERSION=dummy-default
- GRADLE_OPTS=-Dorg.gradle.jvmargs='-Xmx1g'
- GRADLE_FLAGS=-PskipCodegen=true -PskipAndroid=true
logging: CLOUD_LOGGING_ONLY
machineType: E2_HIGHCPU_8

steps:
- id: clean-stale-deploys
name: gcr.io/cloud-builders/gcloud
allowFailure: true
script: |
#!/usr/bin/env bash
set -e
echo "Cleaning out stale deploys from previous runs, it is ok if this part fails"
# If the test fails, the deployment is leaked.
# Delete all versions whose name is not 'dummy-default' and is older than 1 hour.
# This expression is an ISO8601 relative date:
# https://cloud.google.com/sdk/gcloud/reference/topic/datetimes
(gcloud app versions list --format="get(version.id)" \
--filter="service=$KOKORO_GAE_SERVICE AND NOT version : '$DUMMY_DEFAULT_VERSION' AND version.createTime<'-p1h'" \
| xargs -i gcloud app services delete "$KOKORO_GAE_SERVICE" --version {} --quiet) || true

- name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gae-build', 'buildscripts/gae-build/']

- id: build
name: gae-build
script: |
#!/usr/bin/env bash
exec ./gradlew $GRADLE_FLAGS :grpc-gae-interop-testing-jdk8:appengineStage

- id: deploy
name: gcr.io/cloud-builders/gcloud
args:
- app
- deploy
- gae-interop-testing/gae-jdk8/build/staged-app/app.yaml
- --service-account=$_GAE_SERVICE_ACCOUNT
- --no-promote
- --no-stop-previous-version
- --version=cb-$BUILD_ID

- id: runInteropTestRemote
name: eclipse-temurin:17-jdk
env:
- PROJECT_ID=$PROJECT_ID
script: |
#!/usr/bin/env bash
exec ./gradlew $GRADLE_FLAGS --stacktrace -PgaeDeployVersion="cb-$BUILD_ID" \
-PgaeProjectId="$PROJECT_ID" :grpc-gae-interop-testing-jdk8:runInteropTestRemote

- id: cleanup
name: gcr.io/cloud-builders/gcloud
script: |
#!/usr/bin/env bash
set -e
echo "Performing cleanup now."
gcloud app services delete "$KOKORO_GAE_SERVICE" --version "cb-$BUILD_ID" --quiet
10 changes: 10 additions & 0 deletions buildscripts/gae-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM eclipse-temurin:17-jdk

# The AppEngine Gradle plugin downloads and runs its own gcloud to get the .jar
# to link against, so we need Python even if we use gcloud deploy directly
# instead of using the plugin.
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends python3 && \
rm -rf /var/lib/apt/lists/*
55 changes: 0 additions & 55 deletions buildscripts/kokoro/gae-interop.sh

This file was deleted.

20 changes: 11 additions & 9 deletions gae-interop-testing/gae-jdk8/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def createDefaultVersion() {
return new java.text.SimpleDateFormat("yyyyMMdd't'HHmmss").format(new Date())
}

def nonShadowedProject = project
// [START model]
appengine {
// App Engine tasks configuration
Expand All @@ -67,13 +68,13 @@ appengine {

deploy {
// deploy configuration
projectId = 'GCLOUD_CONFIG'
projectId = nonShadowedProject.findProperty('gaeProjectId') ?: 'GCLOUD_CONFIG'
// default - stop the current version
stopPreviousVersion = System.getProperty('gaeStopPreviousVersion') ?: true
stopPreviousVersion = nonShadowedProject.findProperty('gaeStopPreviousVersion') ?: true
// default - do not make this the promoted version
promote = System.getProperty('gaePromote') ?: false
// Use -DgaeDeployVersion if set, otherwise the version is null and the plugin will generate it
version = System.getProperty('gaeDeployVersion', createDefaultVersion())
promote = nonShadowedProject.findProperty('gaePromote') ?: false
// Use -PgaeDeployVersion if set, otherwise the version is null and the plugin will generate it
version = nonShadowedProject.findProperty('gaeDeployVersion') ?: createDefaultVersion()
}
}
// [END model]
Expand All @@ -83,6 +84,10 @@ version = '1.0-SNAPSHOT' // Version in generated output

/** Returns the service name. */
String getGaeProject() {
def configuredProjectId = appengine.deploy.projectId
if (!"GCLOUD_CONFIG".equals(configuredProjectId)) {
return configuredProjectId
}
def stream = new ByteArrayOutputStream()
exec {
executable 'gcloud'
Expand Down Expand Up @@ -110,11 +115,8 @@ String getAppUrl(String project, String service, String version) {
}

tasks.register("runInteropTestRemote") {
dependsOn appengineDeploy
mustRunAfter appengineDeploy
doLast {
// give remote app some time to settle down
sleep(20000)

def appUrl = getAppUrl(
getGaeProject(),
getService(project.getProjectDir().toPath()),
Expand Down
Loading