From fb5c34b069a4bdff2f9dd762855af8e00b9728a3 Mon Sep 17 00:00:00 2001 From: Ben Moskovitz Date: Wed, 5 Jul 2023 21:33:55 +1000 Subject: [PATCH 1/2] Rename package bootstrap -> job --- agent/job_runner.go | 2 +- clicommand/agent_start.go | 2 +- clicommand/bootstrap.go | 4 ++-- clicommand/pipeline_upload.go | 2 +- hook/hook.go | 2 +- hook/scriptwrapper.go | 2 +- hook/scriptwrapper_test.go | 2 +- internal/redactor/redactor.go | 2 +- {bootstrap => job}/api.go | 2 +- {bootstrap => job}/bootstrap.go | 6 +++--- {bootstrap => job}/bootstrap_test.go | 4 ++-- {bootstrap => job}/config.go | 2 +- {bootstrap => job}/config_test.go | 2 +- {bootstrap => job}/docker.go | 4 ++-- {bootstrap => job}/git.go | 4 ++-- {bootstrap => job}/git_test.go | 4 ++-- {bootstrap => job}/integration/artifact_integration_test.go | 0 {bootstrap => job}/integration/bootstrap_tester.go | 0 .../integration/checkout_git_mirrors_integration_test.go | 0 {bootstrap => job}/integration/checkout_integration_test.go | 0 {bootstrap => job}/integration/command_integration_test.go | 0 {bootstrap => job}/integration/doc.go | 0 {bootstrap => job}/integration/docker_integration_test.go | 0 {bootstrap => job}/integration/git.go | 0 {bootstrap => job}/integration/hooks_integration_test.go | 2 +- {bootstrap => job}/integration/job_api_integration_test.go | 0 {bootstrap => job}/integration/main_test.go | 0 {bootstrap => job}/integration/plugin_integration_test.go | 2 +- {bootstrap => job}/integration/test-binary-hook/main.go | 0 {bootstrap => job}/knownhosts.go | 4 ++-- {bootstrap => job}/knownhosts_test.go | 4 ++-- {bootstrap => job}/shell/batch.go | 0 {bootstrap => job}/shell/export_test.go | 0 {bootstrap => job}/shell/logger.go | 0 {bootstrap => job}/shell/logger_test.go | 2 +- {bootstrap => job}/shell/lookpath.go | 0 {bootstrap => job}/shell/lookpath_windows.go | 0 {bootstrap => job}/shell/shell.go | 0 {bootstrap => job}/shell/shell_test.go | 2 +- {bootstrap => job}/shell/signal.go | 0 {bootstrap => job}/shell/signal_windows.go | 0 {bootstrap => job}/shell/tempfile.go | 0 {bootstrap => job}/shell/test.go | 0 {bootstrap => job}/ssh.go | 4 ++-- {bootstrap => job}/ssh_test.go | 4 ++-- {bootstrap => job}/tracing.go | 2 +- jobapi/server.go | 2 +- jobapi/server_test.go | 2 +- 48 files changed, 38 insertions(+), 38 deletions(-) rename {bootstrap => job}/api.go (98%) rename {bootstrap => job}/bootstrap.go (99%) rename {bootstrap => job}/bootstrap_test.go (97%) rename {bootstrap => job}/config.go (99%) rename {bootstrap => job}/config_test.go (99%) rename {bootstrap => job}/docker.go (98%) rename {bootstrap => job}/git.go (99%) rename {bootstrap => job}/git_test.go (99%) rename {bootstrap => job}/integration/artifact_integration_test.go (100%) rename {bootstrap => job}/integration/bootstrap_tester.go (100%) rename {bootstrap => job}/integration/checkout_git_mirrors_integration_test.go (100%) rename {bootstrap => job}/integration/checkout_integration_test.go (100%) rename {bootstrap => job}/integration/command_integration_test.go (100%) rename {bootstrap => job}/integration/doc.go (100%) rename {bootstrap => job}/integration/docker_integration_test.go (100%) rename {bootstrap => job}/integration/git.go (100%) rename {bootstrap => job}/integration/hooks_integration_test.go (99%) rename {bootstrap => job}/integration/job_api_integration_test.go (100%) rename {bootstrap => job}/integration/main_test.go (100%) rename {bootstrap => job}/integration/plugin_integration_test.go (99%) rename {bootstrap => job}/integration/test-binary-hook/main.go (100%) rename {bootstrap => job}/knownhosts.go (98%) rename {bootstrap => job}/knownhosts_test.go (96%) rename {bootstrap => job}/shell/batch.go (100%) rename {bootstrap => job}/shell/export_test.go (100%) rename {bootstrap => job}/shell/logger.go (100%) rename {bootstrap => job}/shell/logger_test.go (97%) rename {bootstrap => job}/shell/lookpath.go (100%) rename {bootstrap => job}/shell/lookpath_windows.go (100%) rename {bootstrap => job}/shell/shell.go (100%) rename {bootstrap => job}/shell/shell_test.go (99%) rename {bootstrap => job}/shell/signal.go (100%) rename {bootstrap => job}/shell/signal_windows.go (100%) rename {bootstrap => job}/shell/tempfile.go (100%) rename {bootstrap => job}/shell/test.go (100%) rename {bootstrap => job}/ssh.go (97%) rename {bootstrap => job}/ssh_test.go (97%) rename {bootstrap => job}/tracing.go (99%) diff --git a/agent/job_runner.go b/agent/job_runner.go index c08c8054ea..a01af1b605 100644 --- a/agent/job_runner.go +++ b/agent/job_runner.go @@ -12,9 +12,9 @@ import ( "time" "github.com/buildkite/agent/v3/api" - "github.com/buildkite/agent/v3/bootstrap/shell" "github.com/buildkite/agent/v3/experiments" "github.com/buildkite/agent/v3/hook" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/agent/v3/kubernetes" "github.com/buildkite/agent/v3/logger" "github.com/buildkite/agent/v3/metrics" diff --git a/clicommand/agent_start.go b/clicommand/agent_start.go index 71752609f7..d7f9b2cd68 100644 --- a/clicommand/agent_start.go +++ b/clicommand/agent_start.go @@ -18,12 +18,12 @@ import ( "github.com/buildkite/agent/v3/agent" "github.com/buildkite/agent/v3/api" - "github.com/buildkite/agent/v3/bootstrap/shell" "github.com/buildkite/agent/v3/cliconfig" "github.com/buildkite/agent/v3/experiments" "github.com/buildkite/agent/v3/hook" "github.com/buildkite/agent/v3/internal/agentapi" "github.com/buildkite/agent/v3/internal/utils" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/agent/v3/logger" "github.com/buildkite/agent/v3/metrics" "github.com/buildkite/agent/v3/process" diff --git a/clicommand/bootstrap.go b/clicommand/bootstrap.go index dd60cb6b4a..b20f8f1952 100644 --- a/clicommand/bootstrap.go +++ b/clicommand/bootstrap.go @@ -9,9 +9,9 @@ import ( "sync" "syscall" - "github.com/buildkite/agent/v3/bootstrap" "github.com/buildkite/agent/v3/cliconfig" "github.com/buildkite/agent/v3/experiments" + "github.com/buildkite/agent/v3/job" "github.com/buildkite/agent/v3/process" "github.com/urfave/cli" ) @@ -411,7 +411,7 @@ var BootstrapCommand = cli.Command{ } // Configure the bootstraper - bootstrap := bootstrap.New(bootstrap.Config{ + bootstrap := job.New(job.Config{ AgentName: cfg.AgentName, ArtifactUploadDestination: cfg.ArtifactUploadDestination, AutomaticArtifactUploadPaths: cfg.AutomaticArtifactUploadPaths, diff --git a/clicommand/pipeline_upload.go b/clicommand/pipeline_upload.go index 5c9db6007b..fcc831668a 100644 --- a/clicommand/pipeline_upload.go +++ b/clicommand/pipeline_upload.go @@ -13,12 +13,12 @@ import ( "github.com/buildkite/agent/v3/agent" "github.com/buildkite/agent/v3/api" - "github.com/buildkite/agent/v3/bootstrap/shell" "github.com/buildkite/agent/v3/cliconfig" "github.com/buildkite/agent/v3/env" "github.com/buildkite/agent/v3/internal/pipeline" "github.com/buildkite/agent/v3/internal/redactor" "github.com/buildkite/agent/v3/internal/stdin" + "github.com/buildkite/agent/v3/job/shell" "github.com/urfave/cli" ) diff --git a/hook/hook.go b/hook/hook.go index 7f13fd2bd0..7349971403 100644 --- a/hook/hook.go +++ b/hook/hook.go @@ -9,8 +9,8 @@ import ( "path/filepath" "runtime" - "github.com/buildkite/agent/v3/bootstrap/shell" "github.com/buildkite/agent/v3/internal/utils" + "github.com/buildkite/agent/v3/job/shell" ) // Find returns the absolute path to the best matching hook file in a path, or diff --git a/hook/scriptwrapper.go b/hook/scriptwrapper.go index b5a28fe769..c4728a4849 100644 --- a/hook/scriptwrapper.go +++ b/hook/scriptwrapper.go @@ -10,10 +10,10 @@ import ( "strings" "text/template" - "github.com/buildkite/agent/v3/bootstrap/shell" "github.com/buildkite/agent/v3/env" "github.com/buildkite/agent/v3/internal/shellscript" "github.com/buildkite/agent/v3/internal/utils" + "github.com/buildkite/agent/v3/job/shell" ) const ( diff --git a/hook/scriptwrapper_test.go b/hook/scriptwrapper_test.go index 7550222480..acf059cc5d 100644 --- a/hook/scriptwrapper_test.go +++ b/hook/scriptwrapper_test.go @@ -11,8 +11,8 @@ import ( "strings" "testing" - "github.com/buildkite/agent/v3/bootstrap/shell" "github.com/buildkite/agent/v3/env" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/bintest/v3" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/redactor/redactor.go b/internal/redactor/redactor.go index 7ff879cdfa..fe9be49adf 100644 --- a/internal/redactor/redactor.go +++ b/internal/redactor/redactor.go @@ -7,7 +7,7 @@ import ( "path" "sync" - "github.com/buildkite/agent/v3/bootstrap/shell" + "github.com/buildkite/agent/v3/job/shell" ) // RedactLengthMin is the shortest string length that will be considered a diff --git a/bootstrap/api.go b/job/api.go similarity index 98% rename from bootstrap/api.go rename to job/api.go index ccc393d582..c93c86c8be 100644 --- a/bootstrap/api.go +++ b/job/api.go @@ -1,4 +1,4 @@ -package bootstrap +package job import ( "fmt" diff --git a/bootstrap/bootstrap.go b/job/bootstrap.go similarity index 99% rename from bootstrap/bootstrap.go rename to job/bootstrap.go index 41a89f0d13..b7580ebd2b 100644 --- a/bootstrap/bootstrap.go +++ b/job/bootstrap.go @@ -1,8 +1,8 @@ -// Package bootstrap provides management of the phases of execution of a +// package job provides management of the phases of execution of a // Buildkite job. // // It is intended for internal use by buildkite-agent only. -package bootstrap +package job import ( "context" @@ -19,13 +19,13 @@ import ( "time" "github.com/buildkite/agent/v3/agent/plugin" - "github.com/buildkite/agent/v3/bootstrap/shell" "github.com/buildkite/agent/v3/env" "github.com/buildkite/agent/v3/experiments" "github.com/buildkite/agent/v3/hook" "github.com/buildkite/agent/v3/internal/redactor" "github.com/buildkite/agent/v3/internal/shellscript" "github.com/buildkite/agent/v3/internal/utils" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/agent/v3/kubernetes" "github.com/buildkite/agent/v3/process" "github.com/buildkite/agent/v3/tracetools" diff --git a/bootstrap/bootstrap_test.go b/job/bootstrap_test.go similarity index 97% rename from bootstrap/bootstrap_test.go rename to job/bootstrap_test.go index b254913e4d..bea5b1759f 100644 --- a/bootstrap/bootstrap_test.go +++ b/job/bootstrap_test.go @@ -1,11 +1,11 @@ -package bootstrap +package job import ( "context" "testing" - "github.com/buildkite/agent/v3/bootstrap/shell" "github.com/buildkite/agent/v3/internal/redactor" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/agent/v3/tracetools" "github.com/google/go-cmp/cmp" "github.com/opentracing/opentracing-go" diff --git a/bootstrap/config.go b/job/config.go similarity index 99% rename from bootstrap/config.go rename to job/config.go index 95352028fc..7b0e1d8718 100644 --- a/bootstrap/config.go +++ b/job/config.go @@ -1,4 +1,4 @@ -package bootstrap +package job import ( "reflect" diff --git a/bootstrap/config_test.go b/job/config_test.go similarity index 99% rename from bootstrap/config_test.go rename to job/config_test.go index 9247a4aac1..31f13ad45d 100644 --- a/bootstrap/config_test.go +++ b/job/config_test.go @@ -1,4 +1,4 @@ -package bootstrap +package job import ( "testing" diff --git a/bootstrap/docker.go b/job/docker.go similarity index 98% rename from bootstrap/docker.go rename to job/docker.go index ff50e1e166..c817755dbe 100644 --- a/bootstrap/docker.go +++ b/job/docker.go @@ -1,4 +1,4 @@ -package bootstrap +package job import ( "context" @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/buildkite/agent/v3/bootstrap/shell" + "github.com/buildkite/agent/v3/job/shell" ) var dockerEnv = []string{ diff --git a/bootstrap/git.go b/job/git.go similarity index 99% rename from bootstrap/git.go rename to job/git.go index 7bab2059a2..b51bed1424 100644 --- a/bootstrap/git.go +++ b/job/git.go @@ -1,4 +1,4 @@ -package bootstrap +package job import ( "bufio" @@ -12,7 +12,7 @@ import ( "regexp" "strings" - "github.com/buildkite/agent/v3/bootstrap/shell" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/shellwords" ) diff --git a/bootstrap/git_test.go b/job/git_test.go similarity index 99% rename from bootstrap/git_test.go rename to job/git_test.go index f862df09b5..5e12635415 100644 --- a/bootstrap/git_test.go +++ b/job/git_test.go @@ -1,4 +1,4 @@ -package bootstrap +package job import ( "context" @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/buildkite/agent/v3/bootstrap/shell" + "github.com/buildkite/agent/v3/job/shell" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/bootstrap/integration/artifact_integration_test.go b/job/integration/artifact_integration_test.go similarity index 100% rename from bootstrap/integration/artifact_integration_test.go rename to job/integration/artifact_integration_test.go diff --git a/bootstrap/integration/bootstrap_tester.go b/job/integration/bootstrap_tester.go similarity index 100% rename from bootstrap/integration/bootstrap_tester.go rename to job/integration/bootstrap_tester.go diff --git a/bootstrap/integration/checkout_git_mirrors_integration_test.go b/job/integration/checkout_git_mirrors_integration_test.go similarity index 100% rename from bootstrap/integration/checkout_git_mirrors_integration_test.go rename to job/integration/checkout_git_mirrors_integration_test.go diff --git a/bootstrap/integration/checkout_integration_test.go b/job/integration/checkout_integration_test.go similarity index 100% rename from bootstrap/integration/checkout_integration_test.go rename to job/integration/checkout_integration_test.go diff --git a/bootstrap/integration/command_integration_test.go b/job/integration/command_integration_test.go similarity index 100% rename from bootstrap/integration/command_integration_test.go rename to job/integration/command_integration_test.go diff --git a/bootstrap/integration/doc.go b/job/integration/doc.go similarity index 100% rename from bootstrap/integration/doc.go rename to job/integration/doc.go diff --git a/bootstrap/integration/docker_integration_test.go b/job/integration/docker_integration_test.go similarity index 100% rename from bootstrap/integration/docker_integration_test.go rename to job/integration/docker_integration_test.go diff --git a/bootstrap/integration/git.go b/job/integration/git.go similarity index 100% rename from bootstrap/integration/git.go rename to job/integration/git.go diff --git a/bootstrap/integration/hooks_integration_test.go b/job/integration/hooks_integration_test.go similarity index 99% rename from bootstrap/integration/hooks_integration_test.go rename to job/integration/hooks_integration_test.go index eba98596fa..bcc857b107 100644 --- a/bootstrap/integration/hooks_integration_test.go +++ b/job/integration/hooks_integration_test.go @@ -11,8 +11,8 @@ import ( "testing" "time" - "github.com/buildkite/agent/v3/bootstrap/shell" "github.com/buildkite/agent/v3/experiments" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/bintest/v3" ) diff --git a/bootstrap/integration/job_api_integration_test.go b/job/integration/job_api_integration_test.go similarity index 100% rename from bootstrap/integration/job_api_integration_test.go rename to job/integration/job_api_integration_test.go diff --git a/bootstrap/integration/main_test.go b/job/integration/main_test.go similarity index 100% rename from bootstrap/integration/main_test.go rename to job/integration/main_test.go diff --git a/bootstrap/integration/plugin_integration_test.go b/job/integration/plugin_integration_test.go similarity index 99% rename from bootstrap/integration/plugin_integration_test.go rename to job/integration/plugin_integration_test.go index 6c1e97c1f5..2917329135 100644 --- a/bootstrap/integration/plugin_integration_test.go +++ b/job/integration/plugin_integration_test.go @@ -10,7 +10,7 @@ import ( "strings" "testing" - "github.com/buildkite/agent/v3/bootstrap/shell" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/bintest/v3" ) diff --git a/bootstrap/integration/test-binary-hook/main.go b/job/integration/test-binary-hook/main.go similarity index 100% rename from bootstrap/integration/test-binary-hook/main.go rename to job/integration/test-binary-hook/main.go diff --git a/bootstrap/knownhosts.go b/job/knownhosts.go similarity index 98% rename from bootstrap/knownhosts.go rename to job/knownhosts.go index 4455c0df75..5991c1087f 100644 --- a/bootstrap/knownhosts.go +++ b/job/knownhosts.go @@ -1,4 +1,4 @@ -package bootstrap +package job import ( "bufio" @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/buildkite/agent/v3/bootstrap/shell" + "github.com/buildkite/agent/v3/job/shell" homedir "github.com/mitchellh/go-homedir" "golang.org/x/crypto/ssh/knownhosts" ) diff --git a/bootstrap/knownhosts_test.go b/job/knownhosts_test.go similarity index 96% rename from bootstrap/knownhosts_test.go rename to job/knownhosts_test.go index e1417351b5..aa57ff97d2 100644 --- a/bootstrap/knownhosts_test.go +++ b/job/knownhosts_test.go @@ -1,4 +1,4 @@ -package bootstrap +package job import ( "context" @@ -7,7 +7,7 @@ import ( "os" "testing" - "github.com/buildkite/agent/v3/bootstrap/shell" + "github.com/buildkite/agent/v3/job/shell" "github.com/gliderlabs/ssh" ) diff --git a/bootstrap/shell/batch.go b/job/shell/batch.go similarity index 100% rename from bootstrap/shell/batch.go rename to job/shell/batch.go diff --git a/bootstrap/shell/export_test.go b/job/shell/export_test.go similarity index 100% rename from bootstrap/shell/export_test.go rename to job/shell/export_test.go diff --git a/bootstrap/shell/logger.go b/job/shell/logger.go similarity index 100% rename from bootstrap/shell/logger.go rename to job/shell/logger.go diff --git a/bootstrap/shell/logger_test.go b/job/shell/logger_test.go similarity index 97% rename from bootstrap/shell/logger_test.go rename to job/shell/logger_test.go index f87ed1c719..7e8e6757f2 100644 --- a/bootstrap/shell/logger_test.go +++ b/job/shell/logger_test.go @@ -6,7 +6,7 @@ import ( "runtime" "testing" - "github.com/buildkite/agent/v3/bootstrap/shell" + "github.com/buildkite/agent/v3/job/shell" "github.com/google/go-cmp/cmp" ) diff --git a/bootstrap/shell/lookpath.go b/job/shell/lookpath.go similarity index 100% rename from bootstrap/shell/lookpath.go rename to job/shell/lookpath.go diff --git a/bootstrap/shell/lookpath_windows.go b/job/shell/lookpath_windows.go similarity index 100% rename from bootstrap/shell/lookpath_windows.go rename to job/shell/lookpath_windows.go diff --git a/bootstrap/shell/shell.go b/job/shell/shell.go similarity index 100% rename from bootstrap/shell/shell.go rename to job/shell/shell.go diff --git a/bootstrap/shell/shell_test.go b/job/shell/shell_test.go similarity index 99% rename from bootstrap/shell/shell_test.go rename to job/shell/shell_test.go index a5e35a3a60..1ee63f7950 100644 --- a/bootstrap/shell/shell_test.go +++ b/job/shell/shell_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - "github.com/buildkite/agent/v3/bootstrap/shell" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/bintest/v3" "github.com/google/go-cmp/cmp" ) diff --git a/bootstrap/shell/signal.go b/job/shell/signal.go similarity index 100% rename from bootstrap/shell/signal.go rename to job/shell/signal.go diff --git a/bootstrap/shell/signal_windows.go b/job/shell/signal_windows.go similarity index 100% rename from bootstrap/shell/signal_windows.go rename to job/shell/signal_windows.go diff --git a/bootstrap/shell/tempfile.go b/job/shell/tempfile.go similarity index 100% rename from bootstrap/shell/tempfile.go rename to job/shell/tempfile.go diff --git a/bootstrap/shell/test.go b/job/shell/test.go similarity index 100% rename from bootstrap/shell/test.go rename to job/shell/test.go diff --git a/bootstrap/ssh.go b/job/ssh.go similarity index 97% rename from bootstrap/ssh.go rename to job/ssh.go index 847cb09bbf..d633e6cd63 100644 --- a/bootstrap/ssh.go +++ b/job/ssh.go @@ -1,4 +1,4 @@ -package bootstrap +package job import ( "context" @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/buildkite/agent/v3/bootstrap/shell" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/roko" ) diff --git a/bootstrap/ssh_test.go b/job/ssh_test.go similarity index 97% rename from bootstrap/ssh_test.go rename to job/ssh_test.go index 705db89b83..3abaf59d5e 100644 --- a/bootstrap/ssh_test.go +++ b/job/ssh_test.go @@ -1,4 +1,4 @@ -package bootstrap +package job import ( "context" @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/buildkite/agent/v3/bootstrap/shell" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/bintest/v3" "github.com/stretchr/testify/assert" ) diff --git a/bootstrap/tracing.go b/job/tracing.go similarity index 99% rename from bootstrap/tracing.go rename to job/tracing.go index 732abc0a72..3030b244d2 100644 --- a/bootstrap/tracing.go +++ b/job/tracing.go @@ -1,4 +1,4 @@ -package bootstrap +package job import ( "context" diff --git a/jobapi/server.go b/jobapi/server.go index d10a81caec..708d5ee058 100644 --- a/jobapi/server.go +++ b/jobapi/server.go @@ -7,9 +7,9 @@ import ( "sync" "time" - "github.com/buildkite/agent/v3/bootstrap/shell" "github.com/buildkite/agent/v3/env" "github.com/buildkite/agent/v3/internal/socket" + "github.com/buildkite/agent/v3/job/shell" ) // Server is a Job API server. It provides an HTTP API with which to interact with the job currently running in the buildkite agent diff --git a/jobapi/server_test.go b/jobapi/server_test.go index 49f1fc5ad1..e6df8449e8 100644 --- a/jobapi/server_test.go +++ b/jobapi/server_test.go @@ -14,8 +14,8 @@ import ( "testing" "time" - "github.com/buildkite/agent/v3/bootstrap/shell" "github.com/buildkite/agent/v3/env" + "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/agent/v3/jobapi" "github.com/google/go-cmp/cmp" ) From fb73d803135bfedf965bb781507be671589bf0a8 Mon Sep 17 00:00:00 2001 From: Ben Moskovitz Date: Thu, 6 Jul 2023 10:30:09 +1000 Subject: [PATCH 2/2] Move job package to internal/ --- agent/job_runner.go | 2 +- clicommand/agent_start.go | 2 +- clicommand/bootstrap.go | 2 +- clicommand/pipeline_upload.go | 2 +- hook/hook.go | 2 +- hook/scriptwrapper.go | 2 +- hook/scriptwrapper_test.go | 2 +- {job => internal/job}/api.go | 0 {job => internal/job}/bootstrap.go | 2 +- {job => internal/job}/bootstrap_test.go | 2 +- {job => internal/job}/config.go | 0 {job => internal/job}/config_test.go | 0 {job => internal/job}/docker.go | 2 +- {job => internal/job}/git.go | 2 +- {job => internal/job}/git_test.go | 2 +- {job => internal/job}/integration/artifact_integration_test.go | 0 {job => internal/job}/integration/bootstrap_tester.go | 0 .../job}/integration/checkout_git_mirrors_integration_test.go | 0 {job => internal/job}/integration/checkout_integration_test.go | 0 {job => internal/job}/integration/command_integration_test.go | 0 {job => internal/job}/integration/doc.go | 0 {job => internal/job}/integration/docker_integration_test.go | 0 {job => internal/job}/integration/git.go | 0 {job => internal/job}/integration/hooks_integration_test.go | 2 +- {job => internal/job}/integration/job_api_integration_test.go | 0 {job => internal/job}/integration/main_test.go | 0 {job => internal/job}/integration/plugin_integration_test.go | 2 +- {job => internal/job}/integration/test-binary-hook/main.go | 0 {job => internal/job}/knownhosts.go | 2 +- {job => internal/job}/knownhosts_test.go | 2 +- {job => internal/job}/shell/batch.go | 0 {job => internal/job}/shell/export_test.go | 0 {job => internal/job}/shell/logger.go | 0 {job => internal/job}/shell/logger_test.go | 2 +- {job => internal/job}/shell/lookpath.go | 0 {job => internal/job}/shell/lookpath_windows.go | 0 {job => internal/job}/shell/shell.go | 0 {job => internal/job}/shell/shell_test.go | 2 +- {job => internal/job}/shell/signal.go | 0 {job => internal/job}/shell/signal_windows.go | 0 {job => internal/job}/shell/tempfile.go | 0 {job => internal/job}/shell/test.go | 0 {job => internal/job}/ssh.go | 2 +- {job => internal/job}/ssh_test.go | 2 +- {job => internal/job}/tracing.go | 0 internal/redactor/redactor.go | 2 +- jobapi/server.go | 2 +- jobapi/server_test.go | 2 +- 48 files changed, 23 insertions(+), 23 deletions(-) rename {job => internal/job}/api.go (100%) rename {job => internal/job}/bootstrap.go (99%) rename {job => internal/job}/bootstrap_test.go (98%) rename {job => internal/job}/config.go (100%) rename {job => internal/job}/config_test.go (100%) rename {job => internal/job}/docker.go (99%) rename {job => internal/job}/git.go (99%) rename {job => internal/job}/git_test.go (99%) rename {job => internal/job}/integration/artifact_integration_test.go (100%) rename {job => internal/job}/integration/bootstrap_tester.go (100%) rename {job => internal/job}/integration/checkout_git_mirrors_integration_test.go (100%) rename {job => internal/job}/integration/checkout_integration_test.go (100%) rename {job => internal/job}/integration/command_integration_test.go (100%) rename {job => internal/job}/integration/doc.go (100%) rename {job => internal/job}/integration/docker_integration_test.go (100%) rename {job => internal/job}/integration/git.go (100%) rename {job => internal/job}/integration/hooks_integration_test.go (99%) rename {job => internal/job}/integration/job_api_integration_test.go (100%) rename {job => internal/job}/integration/main_test.go (100%) rename {job => internal/job}/integration/plugin_integration_test.go (99%) rename {job => internal/job}/integration/test-binary-hook/main.go (100%) rename {job => internal/job}/knownhosts.go (98%) rename {job => internal/job}/knownhosts_test.go (97%) rename {job => internal/job}/shell/batch.go (100%) rename {job => internal/job}/shell/export_test.go (100%) rename {job => internal/job}/shell/logger.go (100%) rename {job => internal/job}/shell/logger_test.go (97%) rename {job => internal/job}/shell/lookpath.go (100%) rename {job => internal/job}/shell/lookpath_windows.go (100%) rename {job => internal/job}/shell/shell.go (100%) rename {job => internal/job}/shell/shell_test.go (99%) rename {job => internal/job}/shell/signal.go (100%) rename {job => internal/job}/shell/signal_windows.go (100%) rename {job => internal/job}/shell/tempfile.go (100%) rename {job => internal/job}/shell/test.go (100%) rename {job => internal/job}/ssh.go (98%) rename {job => internal/job}/ssh_test.go (98%) rename {job => internal/job}/tracing.go (100%) diff --git a/agent/job_runner.go b/agent/job_runner.go index a01af1b605..710baeb45c 100644 --- a/agent/job_runner.go +++ b/agent/job_runner.go @@ -14,7 +14,7 @@ import ( "github.com/buildkite/agent/v3/api" "github.com/buildkite/agent/v3/experiments" "github.com/buildkite/agent/v3/hook" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/agent/v3/kubernetes" "github.com/buildkite/agent/v3/logger" "github.com/buildkite/agent/v3/metrics" diff --git a/clicommand/agent_start.go b/clicommand/agent_start.go index d7f9b2cd68..22ac2b882b 100644 --- a/clicommand/agent_start.go +++ b/clicommand/agent_start.go @@ -22,8 +22,8 @@ import ( "github.com/buildkite/agent/v3/experiments" "github.com/buildkite/agent/v3/hook" "github.com/buildkite/agent/v3/internal/agentapi" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/agent/v3/internal/utils" - "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/agent/v3/logger" "github.com/buildkite/agent/v3/metrics" "github.com/buildkite/agent/v3/process" diff --git a/clicommand/bootstrap.go b/clicommand/bootstrap.go index b20f8f1952..156bd1cf82 100644 --- a/clicommand/bootstrap.go +++ b/clicommand/bootstrap.go @@ -11,7 +11,7 @@ import ( "github.com/buildkite/agent/v3/cliconfig" "github.com/buildkite/agent/v3/experiments" - "github.com/buildkite/agent/v3/job" + "github.com/buildkite/agent/v3/internal/job" "github.com/buildkite/agent/v3/process" "github.com/urfave/cli" ) diff --git a/clicommand/pipeline_upload.go b/clicommand/pipeline_upload.go index fcc831668a..5d888cf2e5 100644 --- a/clicommand/pipeline_upload.go +++ b/clicommand/pipeline_upload.go @@ -15,10 +15,10 @@ import ( "github.com/buildkite/agent/v3/api" "github.com/buildkite/agent/v3/cliconfig" "github.com/buildkite/agent/v3/env" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/agent/v3/internal/pipeline" "github.com/buildkite/agent/v3/internal/redactor" "github.com/buildkite/agent/v3/internal/stdin" - "github.com/buildkite/agent/v3/job/shell" "github.com/urfave/cli" ) diff --git a/hook/hook.go b/hook/hook.go index 7349971403..15c4a051e7 100644 --- a/hook/hook.go +++ b/hook/hook.go @@ -9,8 +9,8 @@ import ( "path/filepath" "runtime" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/agent/v3/internal/utils" - "github.com/buildkite/agent/v3/job/shell" ) // Find returns the absolute path to the best matching hook file in a path, or diff --git a/hook/scriptwrapper.go b/hook/scriptwrapper.go index c4728a4849..804a7a122e 100644 --- a/hook/scriptwrapper.go +++ b/hook/scriptwrapper.go @@ -11,9 +11,9 @@ import ( "text/template" "github.com/buildkite/agent/v3/env" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/agent/v3/internal/shellscript" "github.com/buildkite/agent/v3/internal/utils" - "github.com/buildkite/agent/v3/job/shell" ) const ( diff --git a/hook/scriptwrapper_test.go b/hook/scriptwrapper_test.go index acf059cc5d..11b593254f 100644 --- a/hook/scriptwrapper_test.go +++ b/hook/scriptwrapper_test.go @@ -12,7 +12,7 @@ import ( "testing" "github.com/buildkite/agent/v3/env" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/bintest/v3" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/job/api.go b/internal/job/api.go similarity index 100% rename from job/api.go rename to internal/job/api.go diff --git a/job/bootstrap.go b/internal/job/bootstrap.go similarity index 99% rename from job/bootstrap.go rename to internal/job/bootstrap.go index b7580ebd2b..7366b2d96b 100644 --- a/job/bootstrap.go +++ b/internal/job/bootstrap.go @@ -22,10 +22,10 @@ import ( "github.com/buildkite/agent/v3/env" "github.com/buildkite/agent/v3/experiments" "github.com/buildkite/agent/v3/hook" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/agent/v3/internal/redactor" "github.com/buildkite/agent/v3/internal/shellscript" "github.com/buildkite/agent/v3/internal/utils" - "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/agent/v3/kubernetes" "github.com/buildkite/agent/v3/process" "github.com/buildkite/agent/v3/tracetools" diff --git a/job/bootstrap_test.go b/internal/job/bootstrap_test.go similarity index 98% rename from job/bootstrap_test.go rename to internal/job/bootstrap_test.go index bea5b1759f..a4ef7d7088 100644 --- a/job/bootstrap_test.go +++ b/internal/job/bootstrap_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/agent/v3/internal/redactor" - "github.com/buildkite/agent/v3/job/shell" "github.com/buildkite/agent/v3/tracetools" "github.com/google/go-cmp/cmp" "github.com/opentracing/opentracing-go" diff --git a/job/config.go b/internal/job/config.go similarity index 100% rename from job/config.go rename to internal/job/config.go diff --git a/job/config_test.go b/internal/job/config_test.go similarity index 100% rename from job/config_test.go rename to internal/job/config_test.go diff --git a/job/docker.go b/internal/job/docker.go similarity index 99% rename from job/docker.go rename to internal/job/docker.go index c817755dbe..2775a6227e 100644 --- a/job/docker.go +++ b/internal/job/docker.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" ) var dockerEnv = []string{ diff --git a/job/git.go b/internal/job/git.go similarity index 99% rename from job/git.go rename to internal/job/git.go index b51bed1424..83a9d24d18 100644 --- a/job/git.go +++ b/internal/job/git.go @@ -12,7 +12,7 @@ import ( "regexp" "strings" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/shellwords" ) diff --git a/job/git_test.go b/internal/job/git_test.go similarity index 99% rename from job/git_test.go rename to internal/job/git_test.go index 5e12635415..d14034ae9d 100644 --- a/job/git_test.go +++ b/internal/job/git_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/job/integration/artifact_integration_test.go b/internal/job/integration/artifact_integration_test.go similarity index 100% rename from job/integration/artifact_integration_test.go rename to internal/job/integration/artifact_integration_test.go diff --git a/job/integration/bootstrap_tester.go b/internal/job/integration/bootstrap_tester.go similarity index 100% rename from job/integration/bootstrap_tester.go rename to internal/job/integration/bootstrap_tester.go diff --git a/job/integration/checkout_git_mirrors_integration_test.go b/internal/job/integration/checkout_git_mirrors_integration_test.go similarity index 100% rename from job/integration/checkout_git_mirrors_integration_test.go rename to internal/job/integration/checkout_git_mirrors_integration_test.go diff --git a/job/integration/checkout_integration_test.go b/internal/job/integration/checkout_integration_test.go similarity index 100% rename from job/integration/checkout_integration_test.go rename to internal/job/integration/checkout_integration_test.go diff --git a/job/integration/command_integration_test.go b/internal/job/integration/command_integration_test.go similarity index 100% rename from job/integration/command_integration_test.go rename to internal/job/integration/command_integration_test.go diff --git a/job/integration/doc.go b/internal/job/integration/doc.go similarity index 100% rename from job/integration/doc.go rename to internal/job/integration/doc.go diff --git a/job/integration/docker_integration_test.go b/internal/job/integration/docker_integration_test.go similarity index 100% rename from job/integration/docker_integration_test.go rename to internal/job/integration/docker_integration_test.go diff --git a/job/integration/git.go b/internal/job/integration/git.go similarity index 100% rename from job/integration/git.go rename to internal/job/integration/git.go diff --git a/job/integration/hooks_integration_test.go b/internal/job/integration/hooks_integration_test.go similarity index 99% rename from job/integration/hooks_integration_test.go rename to internal/job/integration/hooks_integration_test.go index bcc857b107..45afcad5bf 100644 --- a/job/integration/hooks_integration_test.go +++ b/internal/job/integration/hooks_integration_test.go @@ -12,7 +12,7 @@ import ( "time" "github.com/buildkite/agent/v3/experiments" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/bintest/v3" ) diff --git a/job/integration/job_api_integration_test.go b/internal/job/integration/job_api_integration_test.go similarity index 100% rename from job/integration/job_api_integration_test.go rename to internal/job/integration/job_api_integration_test.go diff --git a/job/integration/main_test.go b/internal/job/integration/main_test.go similarity index 100% rename from job/integration/main_test.go rename to internal/job/integration/main_test.go diff --git a/job/integration/plugin_integration_test.go b/internal/job/integration/plugin_integration_test.go similarity index 99% rename from job/integration/plugin_integration_test.go rename to internal/job/integration/plugin_integration_test.go index 2917329135..5f62b31f4e 100644 --- a/job/integration/plugin_integration_test.go +++ b/internal/job/integration/plugin_integration_test.go @@ -10,7 +10,7 @@ import ( "strings" "testing" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/bintest/v3" ) diff --git a/job/integration/test-binary-hook/main.go b/internal/job/integration/test-binary-hook/main.go similarity index 100% rename from job/integration/test-binary-hook/main.go rename to internal/job/integration/test-binary-hook/main.go diff --git a/job/knownhosts.go b/internal/job/knownhosts.go similarity index 98% rename from job/knownhosts.go rename to internal/job/knownhosts.go index 5991c1087f..a8ab7c32ae 100644 --- a/job/knownhosts.go +++ b/internal/job/knownhosts.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" homedir "github.com/mitchellh/go-homedir" "golang.org/x/crypto/ssh/knownhosts" ) diff --git a/job/knownhosts_test.go b/internal/job/knownhosts_test.go similarity index 97% rename from job/knownhosts_test.go rename to internal/job/knownhosts_test.go index aa57ff97d2..051855e5dc 100644 --- a/job/knownhosts_test.go +++ b/internal/job/knownhosts_test.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/gliderlabs/ssh" ) diff --git a/job/shell/batch.go b/internal/job/shell/batch.go similarity index 100% rename from job/shell/batch.go rename to internal/job/shell/batch.go diff --git a/job/shell/export_test.go b/internal/job/shell/export_test.go similarity index 100% rename from job/shell/export_test.go rename to internal/job/shell/export_test.go diff --git a/job/shell/logger.go b/internal/job/shell/logger.go similarity index 100% rename from job/shell/logger.go rename to internal/job/shell/logger.go diff --git a/job/shell/logger_test.go b/internal/job/shell/logger_test.go similarity index 97% rename from job/shell/logger_test.go rename to internal/job/shell/logger_test.go index 7e8e6757f2..b6758c939b 100644 --- a/job/shell/logger_test.go +++ b/internal/job/shell/logger_test.go @@ -6,7 +6,7 @@ import ( "runtime" "testing" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/google/go-cmp/cmp" ) diff --git a/job/shell/lookpath.go b/internal/job/shell/lookpath.go similarity index 100% rename from job/shell/lookpath.go rename to internal/job/shell/lookpath.go diff --git a/job/shell/lookpath_windows.go b/internal/job/shell/lookpath_windows.go similarity index 100% rename from job/shell/lookpath_windows.go rename to internal/job/shell/lookpath_windows.go diff --git a/job/shell/shell.go b/internal/job/shell/shell.go similarity index 100% rename from job/shell/shell.go rename to internal/job/shell/shell.go diff --git a/job/shell/shell_test.go b/internal/job/shell/shell_test.go similarity index 99% rename from job/shell/shell_test.go rename to internal/job/shell/shell_test.go index 1ee63f7950..38f3ae3114 100644 --- a/job/shell/shell_test.go +++ b/internal/job/shell/shell_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/bintest/v3" "github.com/google/go-cmp/cmp" ) diff --git a/job/shell/signal.go b/internal/job/shell/signal.go similarity index 100% rename from job/shell/signal.go rename to internal/job/shell/signal.go diff --git a/job/shell/signal_windows.go b/internal/job/shell/signal_windows.go similarity index 100% rename from job/shell/signal_windows.go rename to internal/job/shell/signal_windows.go diff --git a/job/shell/tempfile.go b/internal/job/shell/tempfile.go similarity index 100% rename from job/shell/tempfile.go rename to internal/job/shell/tempfile.go diff --git a/job/shell/test.go b/internal/job/shell/test.go similarity index 100% rename from job/shell/test.go rename to internal/job/shell/test.go diff --git a/job/ssh.go b/internal/job/ssh.go similarity index 98% rename from job/ssh.go rename to internal/job/ssh.go index d633e6cd63..8e8ebcd795 100644 --- a/job/ssh.go +++ b/internal/job/ssh.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/roko" ) diff --git a/job/ssh_test.go b/internal/job/ssh_test.go similarity index 98% rename from job/ssh_test.go rename to internal/job/ssh_test.go index 3abaf59d5e..0c539a5c16 100644 --- a/job/ssh_test.go +++ b/internal/job/ssh_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/bintest/v3" "github.com/stretchr/testify/assert" ) diff --git a/job/tracing.go b/internal/job/tracing.go similarity index 100% rename from job/tracing.go rename to internal/job/tracing.go diff --git a/internal/redactor/redactor.go b/internal/redactor/redactor.go index fe9be49adf..d4a65902f0 100644 --- a/internal/redactor/redactor.go +++ b/internal/redactor/redactor.go @@ -7,7 +7,7 @@ import ( "path" "sync" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" ) // RedactLengthMin is the shortest string length that will be considered a diff --git a/jobapi/server.go b/jobapi/server.go index 708d5ee058..2e22d3a162 100644 --- a/jobapi/server.go +++ b/jobapi/server.go @@ -8,8 +8,8 @@ import ( "time" "github.com/buildkite/agent/v3/env" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/agent/v3/internal/socket" - "github.com/buildkite/agent/v3/job/shell" ) // Server is a Job API server. It provides an HTTP API with which to interact with the job currently running in the buildkite agent diff --git a/jobapi/server_test.go b/jobapi/server_test.go index e6df8449e8..e93753bff3 100644 --- a/jobapi/server_test.go +++ b/jobapi/server_test.go @@ -15,7 +15,7 @@ import ( "time" "github.com/buildkite/agent/v3/env" - "github.com/buildkite/agent/v3/job/shell" + "github.com/buildkite/agent/v3/internal/job/shell" "github.com/buildkite/agent/v3/jobapi" "github.com/google/go-cmp/cmp" )