File tree Expand file tree Collapse file tree 6 files changed +47
-3
lines changed
packages/google-cloud-logging
envctl/env_scripts/python Expand file tree Collapse file tree 6 files changed +47
-3
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
4343export PROJECT_ID=$( cat " ${KOKORO_GFILE_DIR} /project-id.json" )
4444gcloud config set project $PROJECT_ID
4545
46+ # set a default zone.
47+ gcloud config set compute/zone us-central1-b
48+
4649# authenticate docker
4750gcloud auth configure-docker -q
4851
@@ -53,6 +56,15 @@ python3.6 -m pip uninstall --yes --quiet nox-automation
5356python3.6 -m pip install --upgrade --quiet nox
5457python3.6 -m nox --version
5558
59+ # Install kubectl
60+ if [[ " ${ENVIRONMENT} " == " kubernetes" ]]; then
61+ curl -LO https://dl.k8s.io/release/v1.20.0/bin/linux/amd64/kubectl
62+ chmod +x kubectl
63+ mkdir -p ~ /.local/bin
64+ mv ./kubectl ~ /.local/bin
65+ export PATH=$PATH :~ /.local/bin
66+ fi
67+
5668# create a unique id for this run
5769UUID=$( python -c ' import uuid; print(uuid.uuid1())' | head -c 7)
5870export ENVCTL_ID=ci-$UUID
Original file line number Diff line number Diff line change 7373 pushd $TMP_DIR
7474 gcloud app deploy -q
7575 popd
76+ # wait for the pub/sub subscriber to start
77+ NUM_SUBSCRIBERS=0
78+ TRIES=0
79+ while [[ " ${NUM_SUBSCRIBERS} " -lt 1 && " ${TRIES} " -lt 10 ]]; do
80+ sleep 30
81+ NUM_SUBSCRIBERS=$( gcloud pubsub topics list-subscriptions $SERVICE_NAME 2> /dev/null | wc -l)
82+ TRIES=$(( TRIES + 1 ))
83+ done
7684}
7785
7886filter-string () {
Original file line number Diff line number Diff line change @@ -47,10 +47,19 @@ verify() {
4747
4848deploy () {
4949 build_container
50- gcloud beta compute instances create-with-container \
50+ gcloud compute instances create-with-container \
5151 $SERVICE_NAME \
5252 --container-image $GCR_PATH \
5353 --container-env PUBSUB_TOPIC=" $SERVICE_NAME " ,ENABLE_SUBSCRIBER=" true"
54+ # wait for the pub/sub subscriber to start
55+ NUM_SUBSCRIBERS=0
56+ TRIES=0
57+ while [[ " ${NUM_SUBSCRIBERS} " -lt 1 && " ${TRIES} " -lt 10 ]]; do
58+ sleep 30
59+ NUM_SUBSCRIBERS=$( gcloud pubsub topics list-subscriptions $SERVICE_NAME 2> /dev/null | wc -l)
60+ TRIES=$(( TRIES + 1 ))
61+ done
62+
5463}
5564
5665filter-string () {
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ destroy() {
3535
3636verify () {
3737 set +e
38+ gcloud pubsub subscriptions describe $SERVICE_NAME -subscriber 2> /dev/null
39+ if [[ $? != 0 ]]; then
40+ echo " FALSE"
41+ exit 1
42+ fi
3843 gcloud container clusters describe --zone $ZONE $SERVICE_NAME > /dev/null 2> /dev/null
3944 if [[ $? == 0 ]]; then
4045 echo " TRUE"
9398 set -e
9499 # deploy test container
95100 kubectl apply -f $TMP_DIR
101+ # wait for pod to spin up
102+ kubectl wait --for=condition=ready pod -l app=$SERVICE_NAME
103+ # wait for the pub/sub subscriber to start
104+ NUM_SUBSCRIBERS=0
105+ TRIES=0
106+ while [[ " ${NUM_SUBSCRIBERS} " -lt 1 && " ${TRIES} " -lt 10 ]]; do
107+ sleep 30
108+ NUM_SUBSCRIBERS=$( gcloud pubsub topics list-subscriptions $SERVICE_NAME 2> /dev/null | wc -l)
109+ TRIES=$(( TRIES + 1 ))
110+ done
96111}
97112
98113filter-string () {
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ def blacken(session: nox.sessions.Session) -> None:
124124 "appengine_standard" ,
125125 "appengine_flex_python" ,
126126 "appengine_flex_container" ,
127- "kubernetesengine " ,
127+ "kubernetes " ,
128128 "cloudrun" ,
129129 "functions" ,
130130 ],
Original file line number Diff line number Diff line change 1- Subproject commit aec50a9122b0ff3a41c20925d171d51d948f4b80
1+ Subproject commit e4cab8acdbf0054a9e4b5b3b3a2bbc68f108d982
You can’t perform that action at this time.
0 commit comments