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

Google Cloud Build failure on some branch names #2418

Closed
teor2345 opened this issue Jun 30, 2021 · 1 comment · Fixed by #3431
Closed

Google Cloud Build failure on some branch names #2418

teor2345 opened this issue Jun 30, 2021 · 1 comment · Fixed by #3431
Assignees
Labels
A-devops Area: Pipelines, CI/CD and Dockerfiles C-bug Category: This is a bug

Comments

@teor2345
Copy link
Contributor

teor2345 commented Jun 30, 2021

Motivation

It looks like the Google Cloud Build on PR #2414 does not escape special characters in branch names, or the branch name is too long:

generic::invalid_argument: invalid build: invalid image name "gcr.io/zealous-zebra/zcashfoundation/zebra/v1.0.0-alpha.12_CHANGELOG:19e0053": could not parse reference: gcr.io/zealous-zebra/zcashfoundation/zebra/v1.0.0-alpha.12_CHANGELOG:19e0053

https://github.com/ZcashFoundation/zebra/pull/2414/checks?check_run_id=2947707553

  • Invalid value for field 'resource.name': 'zebrad-tests-revert-2301-zip221-non-finalized-state+cached-test-non-finalized-3dd49d0'. Must be a match of regex (?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)

https://github.com/ZcashFoundation/zebra/runs/3014817597?check_suite_focus=true#step:5:24

In particular, the following characters that we commonly use are banned:

  • +
  • _
  • .

Branch names must start with a lowercase letter, end with a lowercase letter or number, and only contain lowercase letters, numbers, and dashes. They must also be shorter than 63 characters.

We might be able to fix these issues by deleting banned characters and truncating the string, as long as we preserve the initial branch name for the git checkout.

Existing Code

Google Cloudbuild

https://www.github.com/ZcashFoundation/zebra/tree/main/cloudbuild.yaml

Cached State Action

https://github.com/ZcashFoundation/zebra/blob/main/.github/workflows/test.yml

Specifications

Zebra's cached state tests use multiple layers of commands:

GitHub Actions job

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

gcloud compute ssh

gcloud compute ssh is a thin wrapper around the ssh(1) command

https://cloud.google.com/sdk/gcloud/reference/compute/ssh

ssh

https://www.man7.org/linux/man-pages/man1/ssh.1.html

docker run

https://docs.docker.com/engine/reference/run/

Related Work

This seems like the same kind of underlying cause as PR #2403 - these tests have too many layers. See #2411 for some possible solutions.

@teor2345 teor2345 added C-bug Category: This is a bug A-devops Area: Pipelines, CI/CD and Dockerfiles S-needs-triage Status: A bug report needs triage P-Low labels Jun 30, 2021
@teor2345 teor2345 changed the title Google Cloud Build does not quote branch names Google Cloud Build failure on some branch names Jul 1, 2021
@dconnolly
Copy link
Contributor

The 'Google Cloud Build' job is controlled by https://www.github.com/ZcashFoundation/zebra/tree/main/cloudbuild.yaml, and is not triggered by GitHub Actions, but rather a hook is set up and auth'd by a GitHub App that is installed for the repo. This allows the build to be run quickly and securely even on PRs originating outside our org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-devops Area: Pipelines, CI/CD and Dockerfiles C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants