0

The FETCHSOURCE step fails without pulling down the source.

Build Logs:

> starting build "205dc86e-b097-4b9f-a431-a0fb8b9796c5"
> 
> FETCHSOURCE
> hint: Using 'master' as the name for the initial branch. This default branch name
> hint: is subject to change. To configure the initial branch name to use in all
> hint: of your new repositories, which will suppress this warning, call:
> hint: 
> hint:     git config --global init.defaultBranch <name>
> hint: 
> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
> hint: 'development'. The just-created branch can be renamed via this command:
> hint: 
> hint:     git branch -m <name>
> Initialized empty Git repository in /workspace/.git/
> /bin/sh: 4: "; };f: not found
> Reinitialized existing Git repository in /workspace/.git/
> /bin/sh: 4: "; };f: not found
> Reinitialized existing Git repository in /workspace/.git/
> /bin/sh: 4: "; };f: not found
> ERROR
> ERROR: error fetching git source: generic::unknown: retry budget exhausted (3 attempts): fetching git source: fetching git source: source fetch container exited with non-zero status: 127

Using a private repo on bitbucket cloud (repository access token; not premium account) and a push trigger.
The trigger is fired properly when I push to my branch. The build fails within seconds, logs above.

My cloudbuild.yaml is clearly being read from the new push, because it shows my proper step (gcr.io/cloud-builders/docker) and params (build --network cloudbuild -t gcr.io/project/images/blah .). I can, of course, change these params and repush and the params on this step will change.

This build works if I build manually from the command line using gcloud (bypassing bitbucket fetch):

gcloud builds submit --region=us-central1 --config cloudbuild.yaml .

My expectation is that, at a minimum, my branch's code would be fetched and then the next (first) build step would run from the cloudbuild.yaml.

2 Answers 2

0

The issue turned out to be a bad secret in secrets manager. If you are getting this error and are using secrets manager, try to create the secret and/or repository integration manually using the console. I was adding the secrets using the gcloud cli and I was not stripping off any line feeds at the end of the secret that was stored in a file. If you are piping your secret into the gcloud cli to be added to secrets manager, be sure to look in the secrets manager console at the checksum and ensure that your secret was actually imported byte for byte as you intended.

For example:

cat gcp_cloud_build_bitbucket_all_access_token | tr -d '\n' | gcloud secrets create good_token --data-file=- 
Sign up to request clarification or add additional context in comments.

Comments

-1

Make sure that you configured Cloud Build with Bitbucket cloud. Take a look at these documentations:

  1. Connect to a Bitbucket Cloud host

  2. Connect to a Bitbucket Cloud Repository

  3. Build repositories from Bitbucket Cloud

Since the build succeeds when run manually from the command line, the problem likely lies in Bitbucket's configuration. You can also contact Google Cloud Support to further look into your case.

1 Comment

Thanks for the feedback, Marra. Unfortunately, the documentation and steps you mentioned have already been completed. The build trigger fires properly when I push to bitbucket, so at least a portion of the integration is functioning, which takes step 1, 2, and 3 as suggested to accomplish. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.