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

No, it's german for "The Bootstrap, the" #1958

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .buildkite/build/ssh.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The following config is used by bootstrap/git_test.go
# The following config is used by job/git_test.go
Host github.com-alias1
Hostname github.com

Expand Down
2 changes: 1 addition & 1 deletion .buildkite/steps/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ echo '+++ Running tests'
gotestsum --junitfile "junit-${BUILDKITE_JOB_ID}.xml" -- -count=1 -failfast "$@" ./...

echo '+++ Running integration tests for git-mirrors experiment'
TEST_EXPERIMENT=git-mirrors gotestsum --junitfile "junit-${BUILDKITE_JOB_ID}-git-mirrors.xml" -- -count=1 -failfast "$@" ./bootstrap/integration
TEST_EXPERIMENT=git-mirrors gotestsum --junitfile "junit-${BUILDKITE_JOB_ID}-git-mirrors.xml" -- -count=1 -failfast "$@" ./job/integration
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Available commands are:
meta-data Get/set data from Buildkite jobs
pipeline Make changes to the pipeline of the currently running build
step Make changes to a step (this includes any jobs that were created from the step)
bootstrap Run a Buildkite job locally
bootstrap [DEPRECATED] Run a Buildkite job locally
job Interact with Buildkite jobs
help Shows a list of commands or help for one command

Use "buildkite-agent <command> --help" for more information about a command.
Expand Down
2 changes: 1 addition & 1 deletion agent/agent_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package agent
// has been loaded from the config file and command-line params
type AgentConfiguration struct {
ConfigPath string
BootstrapScript string
JobRunScript string
BuildPath string
HooksPath string
SocketsPath string
Expand Down
16 changes: 8 additions & 8 deletions agent/integration/job_runner_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestJobRunner_WhenJobHasToken_ItOverridesAccessToken(t *testing.T) {
})
}

func TestJobRunnerPassesAccessTokenToBootstrap(t *testing.T) {
func TestJobRunnerPassesAccessTokenToJobExecute(t *testing.T) {
ag := &api.AgentRegisterResponse{
AccessToken: "llamasrock",
}
Expand Down Expand Up @@ -91,29 +91,29 @@ func TestJobRunnerIgnoresPipelineChangesToProtectedVars(t *testing.T) {

}

func runJob(t *testing.T, ag *api.AgentRegisterResponse, j *api.Job, cfg agent.AgentConfiguration, bootstrap func(c *bintest.Call)) {
func runJob(t *testing.T, ag *api.AgentRegisterResponse, j *api.Job, cfg agent.AgentConfiguration, executor func(c *bintest.Call)) {
// create a mock agent API
server := createTestAgentEndpoint(t, "my-job-id")
defer server.Close()

// set up a mock bootstrap that the runner will call
bs, err := bintest.NewMock("buildkite-agent-bootstrap")
// set up a mock executor that the runner will call
bs, err := bintest.NewMock("buildkite-agent-job-execute")
if err != nil {
t.Fatalf("bintest.NewMock() error = %v", err)
}
defer bs.CheckAndClose(t)

// execute the callback we have inside the bootstrap mock
bs.Expect().Once().AndExitWith(0).AndCallFunc(bootstrap)
// execute the callback we have inside the executor mock
bs.Expect().Once().AndExitWith(0).AndCallFunc(executor)

l := logger.Discard

// minimal metrics, this could be cleaner
m := metrics.NewCollector(l, metrics.CollectorConfig{})
scope := m.Scope(metrics.Tags{})

// set the bootstrap into the config
cfg.BootstrapScript = bs.Path
// set the executor into the config
cfg.JobRunScript = bs.Path

client := api.NewClient(l, api.Config{
Endpoint: server.URL,
Expand Down
Loading