Skip to content

Commit

Permalink
chore: split systests into separate kokoro build (#833)
Browse files Browse the repository at this point in the history
* chore: split systests into their own Kokoro build

Closes #832.

* chore: docs builds no longer need systest resource

* chore: remove hacks to get 'gcloud'/'gfile_resource' installed for docs
  • Loading branch information
tseaver committed Aug 16, 2021
1 parent b76f151 commit 5286d6f
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 52 deletions.
48 changes: 48 additions & 0 deletions .kokoro/build-systests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

if [[ -z "${PROJECT_ROOT:-}" ]]; then
PROJECT_ROOT="github/google-auth-library-python"
fi

cd "${PROJECT_ROOT}"

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

# Remove old nox
python3 -m pip uninstall --yes --quiet nox-automation

# Install nox
python3 -m pip install --upgrade --quiet nox
python3 -m nox --version

# Setup service account credentials.
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json

# Setup project id.
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.txt")

# Activate gcloud with service account credentials
gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
gcloud config set project ${PROJECT_ID}

# Decrypt system test secrets
./scripts/decrypt-secrets.sh

# Run system tests which use a different noxfile
python3 -m nox -f system_tests/noxfile.py
23 changes: 0 additions & 23 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,6 @@ cd "${PROJECT_ROOT}"
# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

# Debug: show build environment
env | grep KOKORO

# Setup service account credentials.
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json

# Setup project id.
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.txt")

# Activate gcloud with service account credentials
gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
gcloud config set project ${PROJECT_ID}

# Decrypt system test secrets
./scripts/decrypt-secrets.sh

# Remove old nox
python3 -m pip uninstall --yes --quiet nox-automation

Expand All @@ -54,10 +38,3 @@ if [[ -n "${NOX_SESSION:-}" ]]; then
else
python3 -m nox
fi


# Decrypt system test secrets
./scripts/decrypt-secrets.sh

# Run system tests which use a different noxfile
python3 -m nox -f system_tests/noxfile.py
8 changes: 0 additions & 8 deletions .kokoro/docker/docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,4 @@ RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& python3.8 /tmp/get-pip.py \
&& rm /tmp/get-pip.py

# Install gcloud SDK
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | \
tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - \
&& apt-get update -y \
&& apt-get install python2 google-cloud-sdk -y

CMD ["python3.8"]
5 changes: 1 addition & 4 deletions .kokoro/docs/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ action {
# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Download resources for system tests (service account key, etc.)
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-auth-library-python"

# Use the trampoline script to run in docker.
build_file: "google-auth-library-python/.kokoro/trampoline_v2.sh"

Expand Down Expand Up @@ -65,4 +62,4 @@ before_action {
keyname: "docuploader_service_account"
}
}
}
}
5 changes: 5 additions & 0 deletions .kokoro/presubmit/system-3.7.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Format: //devtools/kokoro/config/proto/build.proto
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/google-auth-library-python/.kokoro/build-systests.sh"
}
17 changes: 0 additions & 17 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
templated_files / ".kokoro",
excludes=[
"continuous/common.cfg",
"docs/common.cfg",
"presubmit/common.cfg",
"build.sh",
],
Expand All @@ -26,20 +25,4 @@
'value: "docs"',
)

assert 1 == s.replace(
".kokoro/docker/docs/Dockerfile",
"""\
CMD \["python3\.8"\]""",
"""\
# Install gcloud SDK
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | \\
tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \\
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \\
apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - \\
&& apt-get update -y \\
&& apt-get install python2 google-cloud-sdk -y
CMD ["python3.8"]""",
)

s.shell.run(["nox", "-s", "blacken"], hide_output=False)

0 comments on commit 5286d6f

Please sign in to comment.