From 3c82c69ad7a4398fbfd0bc6933a154367242aef4 Mon Sep 17 00:00:00 2001 From: joshsiv-mulga Date: Wed, 7 Oct 2026 12:16:10 +1000 Subject: [PATCH] refactor: move ECS agent runtime and credentials packages to the ECS agent tree --- cmd/ecs-agent/agent.go | 4 ++-- cmd/ecs-agent/agent_test.go | 2 +- cmd/ecs-agent/controlplane.go | 2 +- cmd/ecs-agent/controlplane_test.go | 2 +- cmd/ecs-agent/credendpoint.go | 2 +- cmd/ecs-agent/ecrresolver.go | 4 ++-- cmd/ecs-agent/ecrresolver_test.go | 2 +- cmd/ecs-agent/reconcile.go | 2 +- cmd/ecs-agent/reconcile_test.go | 2 +- cmd/ecs-agent/runtimegate.go | 2 +- cmd/ecs-agent/runtimegate_test.go | 2 +- cmd/ecs-agent/taskrun.go | 4 ++-- cmd/ecs-agent/taskrun_test.go | 2 +- {cmd/ecs-agent => spinifex/agents/ecs}/credentials/imds.go | 0 .../agents/ecs}/credentials/imds_test.go | 0 .../ecs-agent => spinifex/agents/ecs}/credentials/provider.go | 0 {cmd/ecs-agent => spinifex/agents/ecs}/runtime/containerd.go | 0 .../agents/ecs}/runtime/containerd_run.go | 0 .../agents/ecs}/runtime/containerd_run_test.go | 0 {cmd/ecs-agent => spinifex/agents/ecs}/runtime/runtime.go | 0 .../ecs-agent => spinifex/agents/ecs}/runtime/runtime_fake.go | 0 .../ecs-agent => spinifex/agents/ecs}/runtime/runtime_test.go | 0 22 files changed, 16 insertions(+), 16 deletions(-) rename {cmd/ecs-agent => spinifex/agents/ecs}/credentials/imds.go (100%) rename {cmd/ecs-agent => spinifex/agents/ecs}/credentials/imds_test.go (100%) rename {cmd/ecs-agent => spinifex/agents/ecs}/credentials/provider.go (100%) rename {cmd/ecs-agent => spinifex/agents/ecs}/runtime/containerd.go (100%) rename {cmd/ecs-agent => spinifex/agents/ecs}/runtime/containerd_run.go (100%) rename {cmd/ecs-agent => spinifex/agents/ecs}/runtime/containerd_run_test.go (100%) rename {cmd/ecs-agent => spinifex/agents/ecs}/runtime/runtime.go (100%) rename {cmd/ecs-agent => spinifex/agents/ecs}/runtime/runtime_fake.go (100%) rename {cmd/ecs-agent => spinifex/agents/ecs}/runtime/runtime_test.go (100%) diff --git a/cmd/ecs-agent/agent.go b/cmd/ecs-agent/agent.go index dcc69c66b..76019e66f 100644 --- a/cmd/ecs-agent/agent.go +++ b/cmd/ecs-agent/agent.go @@ -12,8 +12,8 @@ import ( "strings" "time" - "github.com/mulgadc/spinifex/cmd/ecs-agent/credentials" - ctrruntime "github.com/mulgadc/spinifex/cmd/ecs-agent/runtime" + "github.com/mulgadc/spinifex/spinifex/agents/ecs/credentials" + ctrruntime "github.com/mulgadc/spinifex/spinifex/agents/ecs/runtime" "github.com/mulgadc/spinifex/spinifex/handlers/ecs/bus" ) diff --git a/cmd/ecs-agent/agent_test.go b/cmd/ecs-agent/agent_test.go index ab8c6048a..0a49f84b0 100644 --- a/cmd/ecs-agent/agent_test.go +++ b/cmd/ecs-agent/agent_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - ctrruntime "github.com/mulgadc/spinifex/cmd/ecs-agent/runtime" + ctrruntime "github.com/mulgadc/spinifex/spinifex/agents/ecs/runtime" ) func TestAgent_RunRegistersThenStopsOnContext(t *testing.T) { diff --git a/cmd/ecs-agent/controlplane.go b/cmd/ecs-agent/controlplane.go index ab943e23f..721e2c7b0 100644 --- a/cmd/ecs-agent/controlplane.go +++ b/cmd/ecs-agent/controlplane.go @@ -9,8 +9,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ecs" - "github.com/mulgadc/spinifex/cmd/ecs-agent/credentials" "github.com/mulgadc/spinifex/internal/ecsgw" + "github.com/mulgadc/spinifex/spinifex/agents/ecs/credentials" handlers_ecs "github.com/mulgadc/spinifex/spinifex/handlers/ecs" "github.com/mulgadc/spinifex/spinifex/handlers/ecs/bus" ) diff --git a/cmd/ecs-agent/controlplane_test.go b/cmd/ecs-agent/controlplane_test.go index 8620d5bc4..2254701c5 100644 --- a/cmd/ecs-agent/controlplane_test.go +++ b/cmd/ecs-agent/controlplane_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/service/ecs" - "github.com/mulgadc/spinifex/cmd/ecs-agent/credentials" + "github.com/mulgadc/spinifex/spinifex/agents/ecs/credentials" handlers_ecs "github.com/mulgadc/spinifex/spinifex/handlers/ecs" ) diff --git a/cmd/ecs-agent/credendpoint.go b/cmd/ecs-agent/credendpoint.go index 1e7340205..57bebd4a4 100644 --- a/cmd/ecs-agent/credendpoint.go +++ b/cmd/ecs-agent/credendpoint.go @@ -13,9 +13,9 @@ import ( "sync" "time" - "github.com/mulgadc/spinifex/cmd/ecs-agent/credentials" "github.com/mulgadc/spinifex/internal/ecrauth" "github.com/mulgadc/spinifex/internal/stsauth" + "github.com/mulgadc/spinifex/spinifex/agents/ecs/credentials" ) const ( diff --git a/cmd/ecs-agent/ecrresolver.go b/cmd/ecs-agent/ecrresolver.go index 6ebf3b187..6b29d8f83 100644 --- a/cmd/ecs-agent/ecrresolver.go +++ b/cmd/ecs-agent/ecrresolver.go @@ -7,9 +7,9 @@ import ( "strings" "sync" - "github.com/mulgadc/spinifex/cmd/ecs-agent/credentials" - "github.com/mulgadc/spinifex/cmd/ecs-agent/runtime" "github.com/mulgadc/spinifex/internal/ecrauth" + "github.com/mulgadc/spinifex/spinifex/agents/ecs/credentials" + "github.com/mulgadc/spinifex/spinifex/agents/ecs/runtime" ) // ecrResolver implements runtime.Resolver by minting an ECR authorization token diff --git a/cmd/ecs-agent/ecrresolver_test.go b/cmd/ecs-agent/ecrresolver_test.go index b52d1e58d..4ad2ab4ca 100644 --- a/cmd/ecs-agent/ecrresolver_test.go +++ b/cmd/ecs-agent/ecrresolver_test.go @@ -14,7 +14,7 @@ import ( "testing" "time" - "github.com/mulgadc/spinifex/cmd/ecs-agent/credentials" + "github.com/mulgadc/spinifex/spinifex/agents/ecs/credentials" ) // stubCreds is a credentials.CredentialsProvider returning fixed creds or error. diff --git a/cmd/ecs-agent/reconcile.go b/cmd/ecs-agent/reconcile.go index fb9166ce8..45bf5f488 100644 --- a/cmd/ecs-agent/reconcile.go +++ b/cmd/ecs-agent/reconcile.go @@ -4,7 +4,7 @@ import ( "context" "log/slog" - ctrruntime "github.com/mulgadc/spinifex/cmd/ecs-agent/runtime" + ctrruntime "github.com/mulgadc/spinifex/spinifex/agents/ecs/runtime" "github.com/mulgadc/spinifex/spinifex/handlers/ecs/bus" ) diff --git a/cmd/ecs-agent/reconcile_test.go b/cmd/ecs-agent/reconcile_test.go index 104409456..ab3e20349 100644 --- a/cmd/ecs-agent/reconcile_test.go +++ b/cmd/ecs-agent/reconcile_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - ctrruntime "github.com/mulgadc/spinifex/cmd/ecs-agent/runtime" + ctrruntime "github.com/mulgadc/spinifex/spinifex/agents/ecs/runtime" "github.com/mulgadc/spinifex/spinifex/handlers/ecs/bus" ) diff --git a/cmd/ecs-agent/runtimegate.go b/cmd/ecs-agent/runtimegate.go index dc0454062..33fcc1570 100644 --- a/cmd/ecs-agent/runtimegate.go +++ b/cmd/ecs-agent/runtimegate.go @@ -6,7 +6,7 @@ import ( "sync" "time" - ctrruntime "github.com/mulgadc/spinifex/cmd/ecs-agent/runtime" + ctrruntime "github.com/mulgadc/spinifex/spinifex/agents/ecs/runtime" ) // runtimeProbeTimeout bounds the liveness probe against a runtime the gate is diff --git a/cmd/ecs-agent/runtimegate_test.go b/cmd/ecs-agent/runtimegate_test.go index 80c5278a9..d6c9b4764 100644 --- a/cmd/ecs-agent/runtimegate_test.go +++ b/cmd/ecs-agent/runtimegate_test.go @@ -7,7 +7,7 @@ import ( "errors" "testing" - ctrruntime "github.com/mulgadc/spinifex/cmd/ecs-agent/runtime" + ctrruntime "github.com/mulgadc/spinifex/spinifex/agents/ecs/runtime" ) // TestRuntimeGate_DialsUntilTheSocketAnswers is the boot case the agent used to diff --git a/cmd/ecs-agent/taskrun.go b/cmd/ecs-agent/taskrun.go index cc52e91a0..bf435ca5c 100644 --- a/cmd/ecs-agent/taskrun.go +++ b/cmd/ecs-agent/taskrun.go @@ -9,7 +9,7 @@ import ( "sync" "time" - ctrruntime "github.com/mulgadc/spinifex/cmd/ecs-agent/runtime" + ctrruntime "github.com/mulgadc/spinifex/spinifex/agents/ecs/runtime" handlers_ecs "github.com/mulgadc/spinifex/spinifex/handlers/ecs" "github.com/mulgadc/spinifex/spinifex/handlers/ecs/bus" ) @@ -353,7 +353,7 @@ func containerStopTimeout(labels map[string]string) time.Duration { } // toRuntimeSystemControls maps the assign's sysctl pairs to the runtime -// package's own type, keeping cmd/ecs-agent/runtime decoupled from the ecs +// package's own type, keeping agents/ecs/runtime decoupled from the ecs // handlers' bus package. func toRuntimeSystemControls(in []bus.SystemControl) []ctrruntime.SystemControl { if len(in) == 0 { diff --git a/cmd/ecs-agent/taskrun_test.go b/cmd/ecs-agent/taskrun_test.go index 52045c613..aac92fc05 100644 --- a/cmd/ecs-agent/taskrun_test.go +++ b/cmd/ecs-agent/taskrun_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - ctrruntime "github.com/mulgadc/spinifex/cmd/ecs-agent/runtime" + ctrruntime "github.com/mulgadc/spinifex/spinifex/agents/ecs/runtime" "github.com/mulgadc/spinifex/spinifex/handlers/ecs/bus" ) diff --git a/cmd/ecs-agent/credentials/imds.go b/spinifex/agents/ecs/credentials/imds.go similarity index 100% rename from cmd/ecs-agent/credentials/imds.go rename to spinifex/agents/ecs/credentials/imds.go diff --git a/cmd/ecs-agent/credentials/imds_test.go b/spinifex/agents/ecs/credentials/imds_test.go similarity index 100% rename from cmd/ecs-agent/credentials/imds_test.go rename to spinifex/agents/ecs/credentials/imds_test.go diff --git a/cmd/ecs-agent/credentials/provider.go b/spinifex/agents/ecs/credentials/provider.go similarity index 100% rename from cmd/ecs-agent/credentials/provider.go rename to spinifex/agents/ecs/credentials/provider.go diff --git a/cmd/ecs-agent/runtime/containerd.go b/spinifex/agents/ecs/runtime/containerd.go similarity index 100% rename from cmd/ecs-agent/runtime/containerd.go rename to spinifex/agents/ecs/runtime/containerd.go diff --git a/cmd/ecs-agent/runtime/containerd_run.go b/spinifex/agents/ecs/runtime/containerd_run.go similarity index 100% rename from cmd/ecs-agent/runtime/containerd_run.go rename to spinifex/agents/ecs/runtime/containerd_run.go diff --git a/cmd/ecs-agent/runtime/containerd_run_test.go b/spinifex/agents/ecs/runtime/containerd_run_test.go similarity index 100% rename from cmd/ecs-agent/runtime/containerd_run_test.go rename to spinifex/agents/ecs/runtime/containerd_run_test.go diff --git a/cmd/ecs-agent/runtime/runtime.go b/spinifex/agents/ecs/runtime/runtime.go similarity index 100% rename from cmd/ecs-agent/runtime/runtime.go rename to spinifex/agents/ecs/runtime/runtime.go diff --git a/cmd/ecs-agent/runtime/runtime_fake.go b/spinifex/agents/ecs/runtime/runtime_fake.go similarity index 100% rename from cmd/ecs-agent/runtime/runtime_fake.go rename to spinifex/agents/ecs/runtime/runtime_fake.go diff --git a/cmd/ecs-agent/runtime/runtime_test.go b/spinifex/agents/ecs/runtime/runtime_test.go similarity index 100% rename from cmd/ecs-agent/runtime/runtime_test.go rename to spinifex/agents/ecs/runtime/runtime_test.go