Git Product home page Git Product logo

Comments (17)

imjasonh avatar imjasonh commented on July 28, 2024 1

Thanks for reporting this.

By any chance, does git fetch --unshallow work?

from cloud-builders.

max-sixty avatar max-sixty commented on July 28, 2024

I believe I may have a corrupted repo in GH. I will confirm and close if so

from cloud-builders.

max-sixty avatar max-sixty commented on July 28, 2024

This does seem to be a problem specifically with a) the commands the Builder uses to initiate the repo combined with b) Google Source Repository.

After running the commands locally listed here, running git fetch --unshallow:

  • Works fine if $REMOTE is the GitHub repo
  • Breaks with the commands above if $REMOTE is the Google hosted repo

This seems to only occur if there are many tags - when I remove all but the latest tag, this works fine.

But at the moment Google Source Repository + Google Cloud Builder isn't usable for us

from cloud-builders.

max-sixty avatar max-sixty commented on July 28, 2024

FYI this is still a breaking issue - latest build-id if anyone is on these: 1be7d2d4-651c-44d6-8d06-d1dabb782514

from cloud-builders.

max-sixty avatar max-sixty commented on July 28, 2024

--unshallow does seem to work! Thank you

Closing this for now

from cloud-builders.

tsloughter avatar tsloughter commented on July 28, 2024

Is this thread saying that:

- name: gcr.io/cloud-builders/git
  args: [fetch, --unshallow]

Should work? Is it supposed to work with github triggered builds? I am still getting "did not send all necessary objects" with that.

Our release versions are based on the latest tag + commit info and the git info a build currently has is not enough for it to pick up the latest tag, so like git describe --tags --long fails.

from cloud-builders.

tsloughter avatar tsloughter commented on July 28, 2024

And while args: [fetch] does work to fetch all the branches. The HEAD must still detached because describe continues to fail.

from cloud-builders.

max-sixty avatar max-sixty commented on July 28, 2024

It worked in one instance

Do you want to open a new issue given you can repro? Or maintainers: feel free to open this for tracking

from cloud-builders.

tsloughter avatar tsloughter commented on July 28, 2024

I figured I'd check if i understood this issue before opening a new one, though it is the same issue I believe, so maybe reopening makes more sense?

from cloud-builders.

tsloughter avatar tsloughter commented on July 28, 2024

It is extra weird since it worked once. I created a new trigger on a branch cloudbuild-test and added a step after the fetch that does ['checkout', 'develop'] and that build was able to build the version based on the latest tag, like a git describe --tags --long. But when I do the same checkout from a trigger on the develop branch it is again detached.

from cloud-builders.

max-sixty avatar max-sixty commented on July 28, 2024

One thing to check is whether it works on GitHub based repos. You can repro the steps with the link above

from cloud-builders.

tsloughter avatar tsloughter commented on July 28, 2024

Do you know what it will set to $REV? Does it use the branch name or does github send the latest commit ref from the branch in the trigger?

from cloud-builders.

max-sixty avatar max-sixty commented on July 28, 2024

Do you know what it will set to $REV? Does it use the branch name or does github send the latest commit ref from the branch in the trigger?

Fair question; I'm not sure

from cloud-builders.

antoniomo avatar antoniomo commented on July 28, 2024

Just bumping this, as nothing seems to work for me. Our use case is similar, on our build pipeline we would like to get some git history/reflog to see what needs rebuilding from a monorepo with several services, but even after --unshallow, git reflog show $BRANCH_NAME --pretty='%h' or git reflog show origin/$BRANCH_NAME --pretty='%h' both show only the latest commit.

from cloud-builders.

bendory avatar bendory commented on July 28, 2024

This GitHub issue tracker is intended for bugs with the officially supported builder images specifically.
Please report issues and feature requests regarding the GCB service to our public issue tracker at
https://issuetracker.google.com/issues/new?component=190802&template=1162743

from cloud-builders.

jli avatar jli commented on July 28, 2024

When I tried adding the fetch step for my Github repo, I got this error from Cloud Build: fatal: could not read Username for 'https://github.com': No such device or address

I was able to get it to work following these docs: "Accessing GitHub from a build via SSH keys " (linked from "Including the repository history in a build").

Steps from the docs that I followed exactly:

  • enabled Secret Manager
  • generated a new ssh keypair: added private key as a Secret Manager secret, added public key to my Github profile
  • granted Secret Manager access to the Cloud Build service account
  • added step to cloudbuild.yaml config for setting up ssh private key and known_hosts file

I deviated from the docs for the other part of the "Configure the build" section, though. The steps in the docs are for making a new clone of the repo, but I just wanted to extend the history of the shallow clone I already had. So, instead of the git clone step, I added this step:

- id: 'fetch more history'
  name: gcr.io/cloud-builders/git
  entrypoint: bash
  args:
    - -c
    - |
      git remote set-url origin '[email protected]:<GITHUB_USERNAME>/<GITHUB_REPO>'
      git fetch --depth=300
  volumes:
  - name: 'ssh'
    path: /root/.ssh

Sorry for bumping this old issue, but hope this helps someone who stumbled upon this issue while searching like I did!

from cloud-builders.

bendory avatar bendory commented on July 28, 2024

To report an issue with the hosted Google Cloud Build service, please report it to your Google Cloud Support team or use the public issue tracker at
https://issuetracker.google.com/issues/new?component=190802&template=1162743.

from cloud-builders.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.