buildkite / agent-stack-k8s

Spin up an autoscaling stack of Buildkite Agents on Kubernetes
MIT License
79 stars 30 forks source link

Make checkout configurable #227

Closed c2h5oh closed 6 months ago

c2h5oh commented 10 months ago
DrJosh9000 commented 10 months ago

Hi @c2h5oh, for disabling checkout, would setting BUILDKITE_REPO="" be possible for you?

c2h5oh commented 10 months ago

Sure. Where would I be doing that? in step env?

DrJosh9000 commented 10 months ago

Currently, changing BUILDKITE_REPO must be done using either an environment or pre-checkout agent hook. The pipeline's configured repo would override attempts to set it with e.g. step env.

c2h5oh commented 10 months ago

Wouldn't that disable checkout for all steps?

DrJosh9000 commented 10 months ago

I agree that this is probably not ideal, but since hooks are executed in each step, you could conceivably vary BUILDKITE_REPO based on some other variable set in the step env:

#!/usr/bin/env bash
if [[ "${SKIP_CHECKOUT:false}" == "true" ]]; then
    export BUILDKITE_REPO=""
fi
c2h5oh commented 10 months ago

Well, since we agree this is not ideal would you accept a PR that would add checkout control to this plugin, or do you consider it out of scope?

DrJosh9000 commented 10 months ago

I was trying to figure out the best place to add these controls, since it might be a more general agent issue. We've discussed it and I think we agree there ought to be better control over checkout specifically for the k8s stack. We're happy for, say, a checkout section in the kubernetes plugin definition, but we don't have a firm idea of what that looks like yet. If you're willing to make a PR exploring this, please do!

c2h5oh commented 10 months ago

I was thinking about combining features present in plugins normally used to implement this.

checkout:
    disableCheckout: false
    cloneFlags: ""
    fetchFlags: ""
bpoland commented 8 months ago

👋 hey there, was having trouble getting hooks to work at all but I figured it out -- not sure if any of you had the same issue?

https://github.com/buildkite/agent-stack-k8s/pull/258