diff --git a/Jenkinsfile b/Jenkinsfile index 816afcef0..f2464e3f0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -290,27 +290,32 @@ def e2eTest(nodeLabel) { }], ['gke-tight-http', { node(nodeLabel) { - e2eGKE('tight', 'http') + e2eGKE('tight', 'http', 'fixed') + } + }], + ['gke-tight-http-managed', { + node(nodeLabel) { + e2eGKE('tight', 'http', 'managed') } }], ['gke-loose-http', { node(nodeLabel) { - e2eGKE('loose', 'http') + e2eGKE('loose', 'http', 'fixed') } }], ['gke-custom-http', { node(nodeLabel) { - e2eGKE('custom', 'http') + e2eGKE('custom', 'http', 'fixed') } }], ['gke-tight-https', { node(nodeLabel) { - e2eGKE('tight', 'https') + e2eGKE('tight', 'https', 'fixed') } }], ['gke-loose-https', { node(nodeLabel) { - e2eGKE('loose', 'https') + e2eGKE('loose', 'https', 'fixed') } }], ['flex', { @@ -320,12 +325,12 @@ def e2eTest(nodeLabel) { }], ['gke-tight-http2-echo', { node(nodeLabel) { - e2eGKE('tight', 'http2', 'echo') + e2eGKE('tight', 'http2', 'fixed', 'echo') } }], ['gke-tight-http2-interop', { node(nodeLabel) { - e2eGKE('tight', 'http2', 'interop') + e2eGKE('tight', 'http2', 'fixed', 'interop') } }], ] @@ -561,7 +566,7 @@ def e2eCommonOptions(testId, prefix = '') { // 'bookstore': HTTP bookstore // 'echo': run grpc echo pass_through and transcoding tests // 'interop': run grpc interop pass_through test. -def e2eGKE(coupling, proto, backend = 'bookstore') { +def e2eGKE(coupling, proto, rollout_strategy, backend = 'bookstore') { setupNode() fastUnstash('tools') def uniqueID = getUniqueID("gke-${coupling}-${proto}-${backend}", true) @@ -575,6 +580,7 @@ def e2eGKE(coupling, proto, backend = 'bookstore') { " -a ${uniqueID}.${PROJECT_ID}.appspot.com" + " -B ${BUCKET} " + " -l " + getParam('DURATION_HOUR', 0) + + " -R ${rollout_strategy} " + (getParam('SKIP_CLEANUP', false) ? " -s" : "")) } diff --git a/WORKSPACE b/WORKSPACE index 35379a8dc..50625eb92 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -26,7 +26,7 @@ # # A Bazel (http://bazel.io) workspace for the Google Cloud Endpoints runtime. -ESP_TOOL = "4d1f6506021e241daac5c2bc28aca2f881aa445f" +ESP_TOOL = "5725cbed9076bda107c29f555dc0040cdad967be" git_repository( name = "nginx", diff --git a/script/e2e-kube.sh b/script/e2e-kube.sh index b5c2846dc..72286967c 100755 --- a/script/e2e-kube.sh +++ b/script/e2e-kube.sh @@ -37,7 +37,7 @@ ESP_APP="esp" # Fetch CLI tool if it is not available if [[ ! -f $CLI ]]; then OSNAME=`uname | tr "[:upper:]" "[:lower:]"` - URL="https://storage.googleapis.com/endpoints-release/v1.0.3/bin/${OSNAME}/amd64/espcli" + URL="https://storage.googleapis.com/endpoints-release/v1.0.4/bin/${OSNAME}/amd64/espcli" curl -o ${CLI} ${URL} chmod +x ${CLI} fi @@ -99,6 +99,9 @@ case "${TEST_TYPE}" in * ) e2e_usage "Invalid test type";; esac +# set rollout strategy +ARGS="$ARGS --rollout_strategy ${ESP_ROLLOUT_STRATEGY}" + trap cleanup EXIT # Testing protocol @@ -120,6 +123,15 @@ run_nonfatal long_running_test \ "${TEST_ID}" \ "${UNIQUE_ID}" +# Deploy new config and check new rollout on /endpoints_status +if [[ ("${ESP_ROLLOUT_STRATEGY}" == "managed") && ("${BACKEND}" == "bookstore") ]] ; then + # Deploy new service config + create_service "${ESP_SERVICE}" "${SERVICE_IDL}" + + run retry -n 10 wait_for_service_config_rollouts_update "gke" "${HOST}:8090/endpoints_status" "$ESP_SERVICE_VERSION 100" \ + || error_exit 'Rollouts update was failed' +fi + STATUS=${?} run ${CLI} logs bookstore --namespace ${NAMESPACE} --project ${PROJECT_ID} --active=false \ | tee ${LOG_DIR}/error.log diff --git a/script/jenkins-utilities b/script/jenkins-utilities index 582b2fab8..be0b2ae21 100644 --- a/script/jenkins-utilities +++ b/script/jenkins-utilities @@ -160,8 +160,18 @@ function create_service() { # Set current rolloutId to ESP_CURRENT_ROLLOUTS variable function set_esp_remote_rollout_info_env() { - ESP_CURRENT_ROLLOUTS=`gcloud compute ssh "${INSTANCE_NAME}" \ - --command='curl http://localhost:8090/endpoints_status' | python -c ' + local target_env=${1} + local endpoint_status_url=${2} + local endpoint_status="" + + case "${target_env}" in + 'gce' ) + endpoint_status=`gcloud compute ssh "${INSTANCE_NAME}" --command="curl \"$endpoint_status_url\""`;; + 'gke' ) + endpoint_status=`curl "$endpoint_status_url"`;; + esac + + ESP_CURRENT_ROLLOUTS=`echo ${endpoint_status} | python -c ' import json import sys try: @@ -190,15 +200,17 @@ except: } function wait_for_service_config_rollouts_update() { - local target_version=${1} + local target_env=${1} + local endpoint_status_url=${2} + local target_rollouts=${3} ESP_CURRENT_ROLLOUTS="" # set_esp_remote_rollout_info_env will set ESP_CURRENT_ROLLOUTS - retry -n 10 -t 90 set_esp_remote_rollout_info_env \ + retry -n 10 -t 90 set_esp_remote_rollout_info_env "$target_env" "$endpoint_status_url" \ || error_exit 'Could not fetch the remote rollouts' echo "Instance rollout information=$ESP_CURRENT_ROLLOUTS" - if [ "$target_version" == "$ESP_CURRENT_ROLLOUTS" ]; then + if [ "$target_rollouts" == "$ESP_CURRENT_ROLLOUTS" ]; then return 0 else return 1 diff --git a/test/bookstore/gce/e2e.sh b/test/bookstore/gce/e2e.sh index ae69b2b1d..46f432f1d 100755 --- a/test/bookstore/gce/e2e.sh +++ b/test/bookstore/gce/e2e.sh @@ -103,7 +103,7 @@ run retry -n 3 gcloud compute instances create "${INSTANCE_NAME}" \ run retry -n 3 get_host_ip "${INSTANCE_NAME}" HOST="http://${HOST_INTERNAL_IP}:8080" -run retry -n 10 wait_for_service_config_rollouts_update "$ESP_SERVICE_VERSION 100" \ +run retry -n 10 wait_for_service_config_rollouts_update "gce" "http://localhost:8090/endpoints_status" "$ESP_SERVICE_VERSION 100" \ || error_exit 'Rollouts update was failed' if [ "${ESP_ROLLOUT_STRATEGY}" == "managed" ]; then @@ -111,7 +111,7 @@ if [ "${ESP_ROLLOUT_STRATEGY}" == "managed" ]; then # create_service will set ESP_SERVICE_VERSION to the deployed new config id create_service "${ESP_SERVICE}" swagger.json - run retry -n 10 wait_for_service_config_rollouts_update "$ESP_SERVICE_VERSION 100" \ + run retry -n 10 wait_for_service_config_rollouts_update gce "http://localhost:8090/endpoints_status" "$ESP_SERVICE_VERSION 100" \ || error_exit 'Rollouts update was failed' fi