Git Product home page Git Product logo

Comments (10)

lox avatar lox commented on June 12, 2024 1

We've just merged a PR that adds the following properties to the build api:

  • pull_request_id
  • pull_request_base_branch
  • pull_request_repository

If added to

ci-gate/index.js

Lines 121 to 128 in 4b545cf

const newBuild = await pipeline.createBuildAsync({
branch,
commit,
message,
meta_data: {
affected_files,
},
});
with the correct bits from github webhooks, your build will get the correct refspec.

from ci-gate.

mvines avatar mvines commented on June 12, 2024

I spent a bunch of time digging into the buildkite source, the best work around I could come up with is documented at https://github.com/mvines/ci-gate#buildkite-configuration

I don't think using the commit sha will work, as when buildkite pulls the git project it won't pull the PR branches so the commit sha won't exist in the local clone (without that BUILDKITE_REFSPEC override)

from ci-gate.

mvines avatar mvines commented on June 12, 2024

Here's a pointer to the part of buildkite agent that actually fetches from github:
https://github.com/buildkite/agent/blob/9912079678b2295b50dfae45332193abfbf68de4/bootstrap/bootstrap.go#L753

We really want b.PullRequest = true somehow, so that this block executes but I could find no way to do this

from ci-gate.

KevinGrandon avatar KevinGrandon commented on June 12, 2024

Thanks for the context, that's super helpful :)

I spent a bunch of time digging into the buildkite source, the best work around I could come up with is documented at https://github.com/mvines/ci-gate#buildkite-configuration

I thought we uploaded a custom environment hook, but maybe we missed something. Will look at this again. (Will close if for some reason we didn't upload our environment hook correctly)

Edit - turns out we have our environment hook setup properly but are still seeing this often. Hunch is that this happens when we force push while a build is going..

from ci-gate.

KevinGrandon avatar KevinGrandon commented on June 12, 2024

So it seems like this is not an issue with the environment hook, we have that running ok. Currently debating if we want to run a fork of the agent temporarily /w a fix in place. Maybe @lox knows a workaround, or could say if they would accept a PR which could allow us to fall into the b.PullRequest = true path.

from ci-gate.

lox avatar lox commented on June 12, 2024

Sounds like it might be related to buildkite/agent#782?

We have a PR internally that allows BUILDKITE_PULL_REQUEST and BUILDKITE_PULL_REQUEST_BASE_BRANCH to be set via the API to get that behaviour, would that fix the problem?

Otherwise, we are totally open to suggestions on agent changes to solve the problem.

from ci-gate.

KevinGrandon avatar KevinGrandon commented on June 12, 2024

We have a PR internally that allows BUILDKITE_PULL_REQUEST and BUILDKITE_PULL_REQUEST_BASE_BRANCH to be set via the API to get that behaviour, would that fix the problem?

I think that sounds like a pretty nice add to me that might solve this as well. Any thoughts @mvines ?

from ci-gate.

lox avatar lox commented on June 12, 2024

Did this end up working @KevinGrandon?

from ci-gate.

lox avatar lox commented on June 12, 2024

We now also support the environment variables BUILDKITE_PULL_REQUEST and friends to do the same thing.

from ci-gate.

KevinGrandon avatar KevinGrandon commented on June 12, 2024

I think we had issues when passing along the PR details in build API, but I'm also not sure if we've had the race condition recently. I've been away from our open source stuff, but I'll try to do some more investigation soon.

Will reopen this or file a new issue if we're able to reproduce it.

from ci-gate.

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.