Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run: use shorter suffix in service names #1835

Merged
merged 12 commits into from
Jun 12, 2020
Merged

Conversation

grayside
Copy link
Collaborator

Fixes #1817

Every test run that deploys a Cloud Run service should create a distinct deployment to ensure test execution does not conflict. The Kokoro Build ID as a full UUID is too long, causing Cloud Run service name to exceed max length.

@grayside grayside self-assigned this May 28, 2020
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 28, 2020
@averikitsch averikitsch added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 28, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 28, 2020
@grayside grayside added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 29, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 29, 2020
@grayside
Copy link
Collaborator Author

Trying the force-run one more time. I don't see any output from the build-with-run.sh script, preventing me from doing any troubleshooting. If this still doesn't provide insight, I'll start adding some more debugging code to the script and iterate it here.

# Builds not triggered by a PR will fall back to the commit hash then "latest".
SUFFIX=${KOKORO_BUILD_ID}
# Cloud Run has a max service name length, $KOKORO_BUILD_ID is too long to guarantee no conflict deploys.
SUFFIX=$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-z0-9' | head -c 15)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use uuid=$(uuidgen)? But either way is fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cloud Run has a max name length of 63 characters. This is the fix we are implementing to prevent that since commit sha and build id are usually too long.

@averikitsch
Copy link
Contributor

Looks like the script stops after gcloud config set project $GOOGLE_CLOUD_PROJECT and right before the gcloud builds submit. Is it an issue with kokoro's env and executing the cmd for SUFFIX?

@grayside
Copy link
Collaborator Author

Yeah, that's my theory, given the change to suffix generation is the only significant change. I've added set -x around it to get more visibility, and will look into local reproduction using the test container next.

@grayside
Copy link
Collaborator Author

grayside commented Jun 3, 2020

I'm seeing green locally, so cannot reproduce why this is failing because of #1681.

@grayside grayside added api: run Issues related to the Cloud Run API. status: blocked Resolving the issue is dependent on other work. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jun 3, 2020
@fhinkel
Copy link
Contributor

fhinkel commented Jun 4, 2020

I've seen the correct log artifacts in Sponge. The run tests don't have extra artifacts because mocha never runs:

> hello-broken@1.0.0 test /tmpfs/src/github/nodejs-docs-samples/run/hello-broken
> echo "Error: no test specified" && exit 0

Error: no test specified

The errors from the run script are in the logs:

github/nodejs-docs-samples/.kokoro/build-with-run.sh: line 33: pushd: github/nodejs-docs-samples/run/markdown-preview/editor: No such file or directory
error: line 33 github/nodejs-docs-samples/.kokoro/build-with-run.sh

@fhinkel fhinkel added the kokoro:run Add this label to force Kokoro to re-run the tests. label Jun 8, 2020
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Jun 8, 2020
@fhinkel fhinkel removed the status: blocked Resolving the issue is dependent on other work. label Jun 11, 2020
@grayside grayside merged commit 27df832 into master Jun 12, 2020
@grayside grayside deleted the run/fix-service-name-length branch June 12, 2020 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: run Issues related to the Cloud Run API. cla: yes This human has signed the Contributor License Agreement. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

run/hello-broken Test Fails
5 participants