diff --git a/internal/certs/certs.go b/app/certs/certs.go similarity index 100% rename from internal/certs/certs.go rename to app/certs/certs.go diff --git a/internal/cloudinit/cloudinit.go b/app/cloudinit/cloudinit.go similarity index 99% rename from internal/cloudinit/cloudinit.go rename to app/cloudinit/cloudinit.go index 3647daf8..efee4369 100644 --- a/internal/cloudinit/cloudinit.go +++ b/app/cloudinit/cloudinit.go @@ -14,7 +14,7 @@ import ( "strings" "text/template" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" ) diff --git a/internal/cloudinit/cloudinit_test.go b/app/cloudinit/cloudinit_test.go similarity index 95% rename from internal/cloudinit/cloudinit_test.go rename to app/cloudinit/cloudinit_test.go index d9fe2ce5..843bc1fb 100644 --- a/internal/cloudinit/cloudinit_test.go +++ b/app/cloudinit/cloudinit_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/drone-runners/drone-runner-aws/internal/cloudinit" + "github.com/drone-runners/drone-runner-aws/app/cloudinit" "github.com/drone-runners/drone-runner-aws/types" ) diff --git a/internal/drivers/amazon/driver.go b/app/drivers/amazon/driver.go similarity index 98% rename from internal/drivers/amazon/driver.go rename to app/drivers/amazon/driver.go index 5733e6bd..ba64c785 100644 --- a/internal/drivers/amazon/driver.go +++ b/app/drivers/amazon/driver.go @@ -8,9 +8,9 @@ import ( "time" "github.com/drone-runners/drone-runner-aws/command/harness/storage" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" - itypes "github.com/drone-runners/drone-runner-aws/internal/types" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" + itypes "github.com/drone-runners/drone-runner-aws/app/types" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/runner-go/logger" diff --git a/internal/drivers/amazon/option.go b/app/drivers/amazon/option.go similarity index 99% rename from internal/drivers/amazon/option.go rename to app/drivers/amazon/option.go index 4c58435d..e9110590 100644 --- a/internal/drivers/amazon/option.go +++ b/app/drivers/amazon/option.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/sirupsen/logrus" diff --git a/internal/drivers/amazon/option_test.go b/app/drivers/amazon/option_test.go similarity index 96% rename from internal/drivers/amazon/option_test.go rename to app/drivers/amazon/option_test.go index e4474580..f0e3788c 100644 --- a/internal/drivers/amazon/option_test.go +++ b/app/drivers/amazon/option_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" ) diff --git a/internal/drivers/amazon/util.go b/app/drivers/amazon/util.go similarity index 93% rename from internal/drivers/amazon/util.go rename to app/drivers/amazon/util.go index fc789f4e..459a0c3a 100644 --- a/internal/drivers/amazon/util.go +++ b/app/drivers/amazon/util.go @@ -5,7 +5,7 @@ package amazon import ( - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" diff --git a/internal/drivers/amazon/util_test.go b/app/drivers/amazon/util_test.go similarity index 89% rename from internal/drivers/amazon/util_test.go rename to app/drivers/amazon/util_test.go index 141aeac9..9e02768e 100644 --- a/internal/drivers/amazon/util_test.go +++ b/app/drivers/amazon/util_test.go @@ -7,7 +7,7 @@ package amazon import ( "testing" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" ) func Test_tempdir(t *testing.T) { diff --git a/internal/drivers/anka/driver.go b/app/drivers/anka/driver.go similarity index 98% rename from internal/drivers/anka/driver.go rename to app/drivers/anka/driver.go index add86f4c..42baa06b 100644 --- a/internal/drivers/anka/driver.go +++ b/app/drivers/anka/driver.go @@ -11,8 +11,8 @@ import ( "time" "github.com/drone-runners/drone-runner-aws/command/harness/storage" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/runner-go/logger" diff --git a/internal/drivers/anka/option.go b/app/drivers/anka/option.go similarity index 96% rename from internal/drivers/anka/option.go rename to app/drivers/anka/option.go index 8a847161..adde5829 100644 --- a/internal/drivers/anka/option.go +++ b/app/drivers/anka/option.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/sirupsen/logrus" ) diff --git a/internal/drivers/anka/util.go b/app/drivers/anka/util.go similarity index 82% rename from internal/drivers/anka/util.go rename to app/drivers/anka/util.go index 3b6b1b6d..b8e8f337 100644 --- a/internal/drivers/anka/util.go +++ b/app/drivers/anka/util.go @@ -1,6 +1,6 @@ package anka -import "github.com/drone-runners/drone-runner-aws/internal/oshelp" +import "github.com/drone-runners/drone-runner-aws/app/oshelp" func tempdir(inputOS string) string { const dir = "anka" diff --git a/internal/drivers/ankabuild/client.go b/app/drivers/ankabuild/client.go similarity index 99% rename from internal/drivers/ankabuild/client.go rename to app/drivers/ankabuild/client.go index c590bec2..295dd37f 100644 --- a/internal/drivers/ankabuild/client.go +++ b/app/drivers/ankabuild/client.go @@ -12,7 +12,7 @@ import ( "strings" "time" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" ) const ( diff --git a/internal/drivers/ankabuild/driver.go b/app/drivers/ankabuild/driver.go similarity index 98% rename from internal/drivers/ankabuild/driver.go rename to app/drivers/ankabuild/driver.go index 8dca2ffd..e747c76d 100644 --- a/internal/drivers/ankabuild/driver.go +++ b/app/drivers/ankabuild/driver.go @@ -9,8 +9,8 @@ import ( "github.com/dchest/uniuri" "github.com/drone-runners/drone-runner-aws/command/harness/storage" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/runner-go/logger" diff --git a/internal/drivers/ankabuild/option.go b/app/drivers/ankabuild/option.go similarity index 97% rename from internal/drivers/ankabuild/option.go rename to app/drivers/ankabuild/option.go index 38cdfadd..21fbf025 100644 --- a/internal/drivers/ankabuild/option.go +++ b/app/drivers/ankabuild/option.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/sirupsen/logrus" diff --git a/internal/drivers/azure/driver.go b/app/drivers/azure/driver.go similarity index 98% rename from internal/drivers/azure/driver.go rename to app/drivers/azure/driver.go index fc91d7b4..4138fe0a 100644 --- a/internal/drivers/azure/driver.go +++ b/app/drivers/azure/driver.go @@ -9,9 +9,9 @@ import ( "time" "github.com/drone-runners/drone-runner-aws/command/harness/storage" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/runner-go/logger" diff --git a/internal/drivers/azure/option.go b/app/drivers/azure/option.go similarity index 98% rename from internal/drivers/azure/option.go rename to app/drivers/azure/option.go index 684c8d4d..a7d415ff 100644 --- a/internal/drivers/azure/option.go +++ b/app/drivers/azure/option.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/sirupsen/logrus" diff --git a/internal/drivers/azure/util.go b/app/drivers/azure/util.go similarity index 99% rename from internal/drivers/azure/util.go rename to app/drivers/azure/util.go index 852a388c..8a1b8702 100644 --- a/internal/drivers/azure/util.go +++ b/app/drivers/azure/util.go @@ -7,7 +7,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone/runner-go/logger" ) diff --git a/internal/drivers/digitalocean/driver.go b/app/drivers/digitalocean/driver.go similarity index 98% rename from internal/drivers/digitalocean/driver.go rename to app/drivers/digitalocean/driver.go index 99c7c17d..2cb78428 100644 --- a/internal/drivers/digitalocean/driver.go +++ b/app/drivers/digitalocean/driver.go @@ -7,8 +7,8 @@ import ( "time" "github.com/drone-runners/drone-runner-aws/command/harness/storage" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/runner-go/logger" diff --git a/internal/drivers/digitalocean/option.go b/app/drivers/digitalocean/option.go similarity index 97% rename from internal/drivers/digitalocean/option.go rename to app/drivers/digitalocean/option.go index 16656bdc..c0f817f0 100644 --- a/internal/drivers/digitalocean/option.go +++ b/app/drivers/digitalocean/option.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/sirupsen/logrus" ) diff --git a/internal/drivers/digitalocean/option_test.go b/app/drivers/digitalocean/option_test.go similarity index 96% rename from internal/drivers/digitalocean/option_test.go rename to app/drivers/digitalocean/option_test.go index 56415172..a9adbcba 100644 --- a/internal/drivers/digitalocean/option_test.go +++ b/app/drivers/digitalocean/option_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" ) diff --git a/internal/drivers/distributed_manager.go b/app/drivers/distributed_manager.go similarity index 100% rename from internal/drivers/distributed_manager.go rename to app/drivers/distributed_manager.go diff --git a/internal/drivers/google/driver.go b/app/drivers/google/driver.go similarity index 99% rename from internal/drivers/google/driver.go rename to app/drivers/google/driver.go index 5ba95626..68f36234 100644 --- a/internal/drivers/google/driver.go +++ b/app/drivers/google/driver.go @@ -13,9 +13,9 @@ import ( "time" "github.com/drone-runners/drone-runner-aws/command/harness/storage" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/runner-go/logger" diff --git a/internal/drivers/google/option.go b/app/drivers/google/option.go similarity index 98% rename from internal/drivers/google/option.go rename to app/drivers/google/option.go index 4563a3c0..5864b56b 100644 --- a/internal/drivers/google/option.go +++ b/app/drivers/google/option.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/sirupsen/logrus" diff --git a/internal/drivers/google/util.go b/app/drivers/google/util.go similarity index 100% rename from internal/drivers/google/util.go rename to app/drivers/google/util.go diff --git a/internal/drivers/google/util_test.go b/app/drivers/google/util_test.go similarity index 100% rename from internal/drivers/google/util_test.go rename to app/drivers/google/util_test.go diff --git a/internal/drivers/imanager.go b/app/drivers/imanager.go similarity index 79% rename from internal/drivers/imanager.go rename to app/drivers/imanager.go index e5084ba5..356bf163 100644 --- a/internal/drivers/imanager.go +++ b/app/drivers/imanager.go @@ -4,7 +4,6 @@ import ( "context" "time" - "github.com/drone-runners/drone-runner-aws/command/config" "github.com/drone-runners/drone-runner-aws/command/harness/storage" "github.com/drone-runners/drone-runner-aws/store" "github.com/drone-runners/drone-runner-aws/types" @@ -16,10 +15,9 @@ type IManager interface { Find(ctx context.Context, instanceID string) (*types.Instance, error) GetInstanceByStageID(ctx context.Context, poolName, stage string) (*types.Instance, error) Update(ctx context.Context, instance *types.Instance) error - AddTmate(env *config.EnvConfig) error Add(pools ...Pool) error StartInstancePurger(ctx context.Context, maxAgeBusy, maxAgeFree time.Duration, purgerTime time.Duration) error - Provision(ctx context.Context, poolName, runnerName, serverName, ownerID, resourceClass string, env *config.EnvConfig, query *types.QueryParams, agentConfig *types.GitspaceAgentConfig, storageConfig *types.StorageConfig) (*types.Instance, error) //nolint + Provision(ctx context.Context, poolName, serverName, ownerID, resourceClass string, query *types.QueryParams, gitspaceAgentConfig *types.GitspaceAgentConfig, storageConfig *types.StorageConfig) (*types.Instance, error) //nolint Destroy(ctx context.Context, poolName, instanceID string, storageCleanupType *storage.CleanupType) error BuildPools(ctx context.Context) error CleanPools(ctx context.Context, destroyBusy, destroyFree bool) error diff --git a/internal/drivers/manager.go b/app/drivers/manager.go similarity index 96% rename from internal/drivers/manager.go rename to app/drivers/manager.go index 6ce71a5a..85369feb 100644 --- a/internal/drivers/manager.go +++ b/app/drivers/manager.go @@ -10,10 +10,10 @@ import ( "time" "github.com/cenkalti/backoff/v4" + "github.com/drone-runners/drone-runner-aws/app/certs" + itypes "github.com/drone-runners/drone-runner-aws/app/types" "github.com/drone-runners/drone-runner-aws/command/config" "github.com/drone-runners/drone-runner-aws/command/harness/storage" - "github.com/drone-runners/drone-runner-aws/internal/certs" - itypes "github.com/drone-runners/drone-runner-aws/internal/types" "github.com/drone-runners/drone-runner-aws/store" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/runner-go/logger" @@ -53,6 +53,7 @@ func New( return &Manager{ globalCtx: globalContext, instanceStore: instanceStore, + tmate: types.Tmate(env.Tmate), runnerName: env.Runner.Name, liteEnginePath: env.LiteEngine.Path, harnessTestBinaryURI: env.Settings.HarnessTestBinaryURI, @@ -65,17 +66,23 @@ func NewManager( globalContext context.Context, instanceStore store.InstanceStore, stageOwnerStore store.StageOwnerStore, - env *config.EnvConfig, + tmate types.Tmate, + runnerName, + liteEnginePath, + harnessTestBinaryURI, + pluginBinaryURI, + autoInjectionBinaryURI string, ) *Manager { return &Manager{ globalCtx: globalContext, instanceStore: instanceStore, + tmate: tmate, stageOwnerStore: stageOwnerStore, - runnerName: env.Runner.Name, - liteEnginePath: env.LiteEngine.Path, - harnessTestBinaryURI: env.Settings.HarnessTestBinaryURI, - pluginBinaryURI: env.Settings.PluginBinaryURI, - autoInjectionBinaryURI: env.Settings.AutoInjectionBinaryURI, + runnerName: runnerName, + liteEnginePath: liteEnginePath, + harnessTestBinaryURI: harnessTestBinaryURI, + pluginBinaryURI: pluginBinaryURI, + autoInjectionBinaryURI: autoInjectionBinaryURI, } } @@ -174,11 +181,6 @@ func (m *Manager) Update(ctx context.Context, instance *types.Instance) error { return m.instanceStore.Update(ctx, instance) } -func (m *Manager) AddTmate(env *config.EnvConfig) error { - m.tmate = types.Tmate(env.Tmate) - return nil -} - func (m *Manager) Add(pools ...Pool) error { if len(pools) == 0 { return nil @@ -312,10 +314,16 @@ func (m *Manager) StartInstancePurger(ctx context.Context, maxAgeBusy, maxAgeFre // Provision returns an instance for a job execution and tags it as in use. // This method and BuildPool method contain logic for maintaining pool size. -func (m *Manager) Provision(ctx context.Context, poolName, runnerName, serverName, ownerID, resourceClass string, env *config.EnvConfig, query *types.QueryParams, gitspaceAgentConfig *types.GitspaceAgentConfig, storageConfig *types.StorageConfig) (*types.Instance, error) { //nolint - m.runnerName = runnerName - m.liteEnginePath = env.LiteEngine.Path - m.tmate = types.Tmate(env.Tmate) +func (m *Manager) Provision( + ctx context.Context, + poolName, + serverName, + ownerID, + resourceClass string, + query *types.QueryParams, + gitspaceAgentConfig *types.GitspaceAgentConfig, + storageConfig *types.StorageConfig, +) (*types.Instance, error) { //nolint pool := m.poolMap[poolName] if pool == nil { diff --git a/internal/drivers/nomad/README.md b/app/drivers/nomad/README.md similarity index 100% rename from internal/drivers/nomad/README.md rename to app/drivers/nomad/README.md diff --git a/internal/drivers/nomad/client.go b/app/drivers/nomad/client.go similarity index 100% rename from internal/drivers/nomad/client.go rename to app/drivers/nomad/client.go diff --git a/internal/drivers/nomad/driver.go b/app/drivers/nomad/driver.go similarity index 99% rename from internal/drivers/nomad/driver.go rename to app/drivers/nomad/driver.go index b5696408..3500e9a9 100644 --- a/internal/drivers/nomad/driver.go +++ b/app/drivers/nomad/driver.go @@ -15,8 +15,8 @@ import ( cf "github.com/drone-runners/drone-runner-aws/command/config" "github.com/drone-runners/drone-runner-aws/command/harness/storage" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/runner-go/logger" "github.com/hashicorp/nomad/api" diff --git a/internal/drivers/nomad/gitspace/scripts/delete_ceph_storage.sh b/app/drivers/nomad/gitspace/scripts/delete_ceph_storage.sh similarity index 100% rename from internal/drivers/nomad/gitspace/scripts/delete_ceph_storage.sh rename to app/drivers/nomad/gitspace/scripts/delete_ceph_storage.sh diff --git a/internal/drivers/nomad/gitspace/scripts/detach_ceph_storage.sh b/app/drivers/nomad/gitspace/scripts/detach_ceph_storage.sh similarity index 100% rename from internal/drivers/nomad/gitspace/scripts/detach_ceph_storage.sh rename to app/drivers/nomad/gitspace/scripts/detach_ceph_storage.sh diff --git a/internal/drivers/nomad/gitspace/scripts/provision_ceph_storage.sh b/app/drivers/nomad/gitspace/scripts/provision_ceph_storage.sh similarity index 100% rename from internal/drivers/nomad/gitspace/scripts/provision_ceph_storage.sh rename to app/drivers/nomad/gitspace/scripts/provision_ceph_storage.sh diff --git a/internal/drivers/nomad/linux_virtualizer.go b/app/drivers/nomad/linux_virtualizer.go similarity index 97% rename from internal/drivers/nomad/linux_virtualizer.go rename to app/drivers/nomad/linux_virtualizer.go index dac86cce..a6264ea8 100644 --- a/internal/drivers/nomad/linux_virtualizer.go +++ b/app/drivers/nomad/linux_virtualizer.go @@ -10,9 +10,9 @@ import ( "time" cf "github.com/drone-runners/drone-runner-aws/command/config" - "github.com/drone-runners/drone-runner-aws/internal/cloudinit" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/cloudinit" + "github.com/drone-runners/drone-runner-aws/app/lehelper" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/hashicorp/nomad/api" ) diff --git a/internal/drivers/nomad/mac_virtualizer.go b/app/drivers/nomad/mac_virtualizer.go similarity index 99% rename from internal/drivers/nomad/mac_virtualizer.go rename to app/drivers/nomad/mac_virtualizer.go index e4ca6bf7..30737c9a 100644 --- a/internal/drivers/nomad/mac_virtualizer.go +++ b/app/drivers/nomad/mac_virtualizer.go @@ -7,7 +7,7 @@ import ( "time" cf "github.com/drone-runners/drone-runner-aws/command/config" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" + "github.com/drone-runners/drone-runner-aws/app/lehelper" "github.com/drone-runners/drone-runner-aws/types" "github.com/hashicorp/nomad/api" ) diff --git a/internal/drivers/nomad/noop_jobs.go b/app/drivers/nomad/noop_jobs.go similarity index 100% rename from internal/drivers/nomad/noop_jobs.go rename to app/drivers/nomad/noop_jobs.go diff --git a/internal/drivers/nomad/option.go b/app/drivers/nomad/option.go similarity index 100% rename from internal/drivers/nomad/option.go rename to app/drivers/nomad/option.go diff --git a/internal/drivers/nomad/status.go b/app/drivers/nomad/status.go similarity index 100% rename from internal/drivers/nomad/status.go rename to app/drivers/nomad/status.go diff --git a/internal/drivers/nomad/util.go b/app/drivers/nomad/util.go similarity index 100% rename from internal/drivers/nomad/util.go rename to app/drivers/nomad/util.go diff --git a/internal/drivers/nomad/virtualizer.go b/app/drivers/nomad/virtualizer.go similarity index 100% rename from internal/drivers/nomad/virtualizer.go rename to app/drivers/nomad/virtualizer.go diff --git a/internal/drivers/noop/driver.go b/app/drivers/noop/driver.go similarity index 95% rename from internal/drivers/noop/driver.go rename to app/drivers/noop/driver.go index 0a687ee0..42d063f4 100644 --- a/internal/drivers/noop/driver.go +++ b/app/drivers/noop/driver.go @@ -5,8 +5,8 @@ import ( "time" "github.com/drone-runners/drone-runner-aws/command/harness/storage" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" "github.com/drone-runners/drone-runner-aws/types" "github.com/google/uuid" ) diff --git a/internal/drivers/noop/option.go b/app/drivers/noop/option.go similarity index 100% rename from internal/drivers/noop/option.go rename to app/drivers/noop/option.go diff --git a/internal/drivers/pool.go b/app/drivers/pool.go similarity index 100% rename from internal/drivers/pool.go rename to app/drivers/pool.go diff --git a/internal/drivers/strategy.go b/app/drivers/strategy.go similarity index 100% rename from internal/drivers/strategy.go rename to app/drivers/strategy.go diff --git a/internal/drivers/util.go b/app/drivers/util.go similarity index 100% rename from internal/drivers/util.go rename to app/drivers/util.go diff --git a/internal/drivers/vmfusion/driver.go b/app/drivers/vmfusion/driver.go similarity index 98% rename from internal/drivers/vmfusion/driver.go rename to app/drivers/vmfusion/driver.go index bb1279b0..fb47c67c 100644 --- a/internal/drivers/vmfusion/driver.go +++ b/app/drivers/vmfusion/driver.go @@ -11,8 +11,8 @@ import ( "time" "github.com/drone-runners/drone-runner-aws/command/harness/storage" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/runner-go/logger" diff --git a/internal/drivers/vmfusion/options.go b/app/drivers/vmfusion/options.go similarity index 96% rename from internal/drivers/vmfusion/options.go rename to app/drivers/vmfusion/options.go index ad6a2ebf..04326c8e 100644 --- a/internal/drivers/vmfusion/options.go +++ b/app/drivers/vmfusion/options.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/sirupsen/logrus" ) diff --git a/internal/drivers/vmfusion/state.go b/app/drivers/vmfusion/state.go similarity index 100% rename from internal/drivers/vmfusion/state.go rename to app/drivers/vmfusion/state.go diff --git a/internal/drivers/vmfusion/utils.go b/app/drivers/vmfusion/utils.go similarity index 98% rename from internal/drivers/vmfusion/utils.go rename to app/drivers/vmfusion/utils.go index e652650c..f87db7cc 100644 --- a/internal/drivers/vmfusion/utils.go +++ b/app/drivers/vmfusion/utils.go @@ -12,8 +12,8 @@ import ( "syscall" "time" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/sirupsen/logrus" ) diff --git a/internal/drivers/vmfusion/vmx.go b/app/drivers/vmfusion/vmx.go similarity index 100% rename from internal/drivers/vmfusion/vmx.go rename to app/drivers/vmfusion/vmx.go diff --git a/internal/encoder/encoder.go b/app/encoder/encoder.go similarity index 100% rename from internal/encoder/encoder.go rename to app/encoder/encoder.go diff --git a/internal/encoder/encoder_test.go b/app/encoder/encoder_test.go similarity index 100% rename from internal/encoder/encoder_test.go rename to app/encoder/encoder_test.go diff --git a/internal/httprender/httprender.go b/app/httprender/httprender.go similarity index 100% rename from internal/httprender/httprender.go rename to app/httprender/httprender.go diff --git a/internal/internal.go b/app/internal.go similarity index 100% rename from internal/internal.go rename to app/internal.go diff --git a/internal/lehelper/lehelper.go b/app/lehelper/lehelper.go similarity index 93% rename from internal/lehelper/lehelper.go rename to app/lehelper/lehelper.go index 61eaca88..a2049d62 100644 --- a/internal/lehelper/lehelper.go +++ b/app/lehelper/lehelper.go @@ -4,8 +4,8 @@ import ( "fmt" "time" - "github.com/drone-runners/drone-runner-aws/internal/cloudinit" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/cloudinit" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/harness/lite-engine/api" lehttp "github.com/harness/lite-engine/cli/client" diff --git a/internal/match/match.go b/app/match/match.go similarity index 100% rename from internal/match/match.go rename to app/match/match.go diff --git a/internal/match/match_test.go b/app/match/match_test.go similarity index 100% rename from internal/match/match_test.go rename to app/match/match_test.go diff --git a/internal/oshelp/oshelp.go b/app/oshelp/oshelp.go similarity index 100% rename from internal/oshelp/oshelp.go rename to app/oshelp/oshelp.go diff --git a/internal/oshelp/oshelp_test.go b/app/oshelp/oshelp_test.go similarity index 100% rename from internal/oshelp/oshelp_test.go rename to app/oshelp/oshelp_test.go diff --git a/internal/poolfile/config.go b/app/poolfile/config.go similarity index 93% rename from internal/poolfile/config.go rename to app/poolfile/config.go index 3054f1d3..dfbd08df 100644 --- a/internal/poolfile/config.go +++ b/app/poolfile/config.go @@ -7,18 +7,18 @@ import ( "path/filepath" "strings" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/drivers/amazon" + "github.com/drone-runners/drone-runner-aws/app/drivers/anka" + "github.com/drone-runners/drone-runner-aws/app/drivers/ankabuild" + "github.com/drone-runners/drone-runner-aws/app/drivers/azure" + "github.com/drone-runners/drone-runner-aws/app/drivers/digitalocean" + "github.com/drone-runners/drone-runner-aws/app/drivers/google" + "github.com/drone-runners/drone-runner-aws/app/drivers/nomad" + "github.com/drone-runners/drone-runner-aws/app/drivers/noop" + "github.com/drone-runners/drone-runner-aws/app/drivers/vmfusion" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/command/config" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/drivers/amazon" - "github.com/drone-runners/drone-runner-aws/internal/drivers/anka" - "github.com/drone-runners/drone-runner-aws/internal/drivers/ankabuild" - "github.com/drone-runners/drone-runner-aws/internal/drivers/azure" - "github.com/drone-runners/drone-runner-aws/internal/drivers/digitalocean" - "github.com/drone-runners/drone-runner-aws/internal/drivers/google" - "github.com/drone-runners/drone-runner-aws/internal/drivers/nomad" - "github.com/drone-runners/drone-runner-aws/internal/drivers/noop" - "github.com/drone-runners/drone-runner-aws/internal/drivers/vmfusion" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" @@ -28,7 +28,9 @@ const ( DefaultPoolName = "testpool" ) -func ProcessPool(poolFile *config.PoolFile, runnerName string, env *config.EnvConfig) ([]drivers.Pool, error) { //nolint +// ProcessPool processes the pool file and returns a list of pools. +// Passwords are not present in the pool file and passed separately for security reasons. +func ProcessPool(poolFile *config.PoolFile, runnerName string, passwords types.Passwords) ([]drivers.Pool, error) { //nolint var pools = []drivers.Pool{} for i := range poolFile.Instances { @@ -241,8 +243,8 @@ func ProcessPool(poolFile *config.PoolFile, runnerName string, env *config.EnvCo pools = append(pools, pool) case string(types.AnkaBuild): var ankaBuild, ok = instance.Spec.(*config.AnkaBuild) - if ankaBuild.AuthToken == "" && env.AnkaBuild.Token != "" { - ankaBuild.AuthToken = env.AnkaBuild.Token + if ankaBuild.AuthToken == "" && passwords.AnkaToken != "" { + ankaBuild.AuthToken = passwords.AnkaToken } if !ok { return nil, fmt.Errorf("%s pool parsing failed", instance.Name) @@ -293,8 +295,8 @@ func ProcessPool(poolFile *config.PoolFile, runnerName string, env *config.EnvCo return nil, fmt.Errorf("%s pool parsing failed", instance.Name) } - if nomadConfig.VM.Account.Password == "" && env.TartBuild.Password != "" { - nomadConfig.VM.Account.Password = env.TartBuild.Password + if nomadConfig.VM.Account.Password == "" && passwords.Tart != "" { + nomadConfig.VM.Account.Password = passwords.Tart } platform := instance.Platform diff --git a/internal/types/errors.go b/app/types/errors.go similarity index 100% rename from internal/types/errors.go rename to app/types/errors.go diff --git a/command/compile.go b/command/compile.go index 761c6f15..2410857e 100644 --- a/command/compile.go +++ b/command/compile.go @@ -11,13 +11,13 @@ import ( "os" "strings" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/poolfile" "github.com/drone-runners/drone-runner-aws/command/config" "github.com/drone-runners/drone-runner-aws/command/internal" "github.com/drone-runners/drone-runner-aws/engine/compiler" "github.com/drone-runners/drone-runner-aws/engine/linter" "github.com/drone-runners/drone-runner-aws/engine/resource" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/poolfile" "github.com/drone/envsubst" "github.com/drone/runner-go/environ" "github.com/drone/runner-go/environ/provider" @@ -88,8 +88,9 @@ func (c *compileCommand) run(*kingpin.ParseContext) error { Errorln("compile: unable to parse pool file") return err } + configEnv, _ := config.FromEnviron() - pools, err := poolfile.ProcessPool(poolFile, runnerName, &configEnv) + pools, err := poolfile.ProcessPool(poolFile, runnerName, configEnv.Passwords()) if err != nil { logrus.WithError(err). Errorln("compile: unable to process pool file") diff --git a/command/config/account_pool_mapper.go b/command/config/account_pool_mapper.go index 94c63d3e..cac25f51 100644 --- a/command/config/account_pool_mapper.go +++ b/command/config/account_pool_mapper.go @@ -27,3 +27,12 @@ func (pma *PoolMapperByAccount) Decode(value string) error { *pma = PoolMapperByAccount(m) return nil } + +// Iterates over all the entries and converts it to a simple type +func (pma *PoolMapperByAccount) Convert() map[string]map[string]string { + m := map[string]map[string]string{} + for k, v := range *pma { + m[k] = map[string]string(v) + } + return m +} diff --git a/command/config/account_pool_mapper_test.go b/command/config/account_pool_mapper_test.go new file mode 100644 index 00000000..7a51f70d --- /dev/null +++ b/command/config/account_pool_mapper_test.go @@ -0,0 +1,168 @@ +package config + +import ( + "reflect" + "testing" +) + +func TestPoolMapperByAccount_Convert(t *testing.T) { + tests := []struct { + name string + pma PoolMapperByAccount + want map[string]map[string]string + }{ + { + name: "empty mapper", + pma: PoolMapperByAccount{}, + want: map[string]map[string]string{}, + }, + { + name: "single account with empty pool map", + pma: PoolMapperByAccount{ + "account1": PoolMap{}, + }, + want: map[string]map[string]string{ + "account1": {}, + }, + }, + { + name: "single account with multiple pools", + pma: PoolMapperByAccount{ + "account1": PoolMap{ + "pool1": "value1", + "pool2": "value2", + }, + }, + want: map[string]map[string]string{ + "account1": { + "pool1": "value1", + "pool2": "value2", + }, + }, + }, + { + name: "multiple accounts with multiple pools", + pma: PoolMapperByAccount{ + "account1": PoolMap{ + "pool1": "value1", + "pool2": "value2", + }, + "account2": PoolMap{ + "pool3": "value3", + "pool4": "value4", + }, + }, + want: map[string]map[string]string{ + "account1": { + "pool1": "value1", + "pool2": "value2", + }, + "account2": { + "pool3": "value3", + "pool4": "value4", + }, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := tt.pma.Convert() + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("PoolMapperByAccount.Convert() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestPoolMapperByAccount_Decode(t *testing.T) { + tests := []struct { + name string + input string + want PoolMapperByAccount + wantErr bool + }{ + { + name: "empty input", + input: "", + want: PoolMapperByAccount{}, + wantErr: true, + }, + { + name: "single account with empty pool", + input: `account1={}`, + want: PoolMapperByAccount{ + "account1": PoolMap{}, + }, + }, + { + name: "single account with pools", + input: `account1={"pool1":"value1","pool2":"value2"}`, + want: PoolMapperByAccount{ + "account1": PoolMap{ + "pool1": "value1", + "pool2": "value2", + }, + }, + }, + { + name: "multiple accounts with pools", + input: `account1={"pool1":"value1","pool2":"value2"};account2={"pool3":"value3","pool4":"value4"}`, + want: PoolMapperByAccount{ + "account1": PoolMap{ + "pool1": "value1", + "pool2": "value2", + }, + "account2": PoolMap{ + "pool3": "value3", + "pool4": "value4", + }, + }, + }, + { + name: "invalid format - missing value", + input: "account1", + wantErr: true, + }, + { + name: "invalid format - wrong separator", + input: "account1:{}", + wantErr: true, + }, + { + name: "invalid json", + input: "account1={invalid_json}", + wantErr: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var pma PoolMapperByAccount + err := pma.Decode(tt.input) + + // Check error cases + if (err != nil) != tt.wantErr { + t.Errorf("PoolMapperByAccount.Decode() error = %v, wantErr %v", err, tt.wantErr) + return + } + + // Skip further checks if we expected an error + if tt.wantErr { + return + } + + // Check the decoded result + if !reflect.DeepEqual(pma, tt.want) { + t.Errorf("PoolMapperByAccount.Decode() = %v, want %v", pma, tt.want) + } + + // Verify that Convert works on decoded data + converted := pma.Convert() + expectedConverted := tt.want.Convert() + if !reflect.DeepEqual(converted, expectedConverted) { + t.Errorf("PoolMapperByAccount.Convert() after Decode = %v, want %v", converted, expectedConverted) + } + }) + } +} diff --git a/command/config/config.go b/command/config/config.go index ea8c6cf0..312d08a5 100644 --- a/command/config/config.go +++ b/command/config/config.go @@ -337,7 +337,6 @@ type EnvConfig struct { } Settings struct { - DefaultDriver string `envconfig:"DRONE_DEFAULT_DRIVER" default:"amazon"` ReusePool bool `envconfig:"DRONE_REUSE_POOL" default:"false"` BusyMaxAge int64 `envconfig:"DRONE_SETTINGS_BUSY_MAX_AGE" default:"24"` FreeMaxAge int64 `envconfig:"DRONE_SETTINGS_FREE_MAX_AGE" default:"720"` @@ -405,6 +404,13 @@ type EnvConfig struct { } } +func (c EnvConfig) Passwords() types.Passwords { + return types.Passwords{ + AnkaToken: c.AnkaBuild.Token, + Tart: c.TartBuild.Password, + } +} + // legacy environment variables. the key is the legacy // variable name, and the value is the new variable name. var legacy = map[string]string{ diff --git a/command/daemon/daemon.go b/command/daemon/daemon.go index 08c8e346..5717eaaf 100644 --- a/command/daemon/daemon.go +++ b/command/daemon/daemon.go @@ -10,14 +10,14 @@ import ( "os" "time" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/match" + "github.com/drone-runners/drone-runner-aws/app/poolfile" "github.com/drone-runners/drone-runner-aws/command/config" "github.com/drone-runners/drone-runner-aws/engine" "github.com/drone-runners/drone-runner-aws/engine/compiler" "github.com/drone-runners/drone-runner-aws/engine/linter" "github.com/drone-runners/drone-runner-aws/engine/resource" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/match" - "github.com/drone-runners/drone-runner-aws/internal/poolfile" "github.com/drone-runners/drone-runner-aws/store/database" "github.com/drone/runner-go/client" "github.com/drone/runner-go/environ/provider" @@ -111,7 +111,7 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error { } logrus.Infoln(fmt.Sprintf("daemon: processing config for %s", env.Runner.Name)) - pools, err := poolfile.ProcessPool(configPool, env.Runner.Name, &env) + pools, err := poolfile.ProcessPool(configPool, env.Runner.Name, env.Passwords()) if err != nil { logrus.WithError(err). Fatalln("daemon: unable to process pool file") diff --git a/command/exec.go b/command/exec.go index 88d0e153..5a92d019 100644 --- a/command/exec.go +++ b/command/exec.go @@ -13,14 +13,14 @@ import ( "strings" "time" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/poolfile" "github.com/drone-runners/drone-runner-aws/command/config" "github.com/drone-runners/drone-runner-aws/command/internal" "github.com/drone-runners/drone-runner-aws/engine" "github.com/drone-runners/drone-runner-aws/engine/compiler" "github.com/drone-runners/drone-runner-aws/engine/linter" "github.com/drone-runners/drone-runner-aws/engine/resource" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/poolfile" "github.com/drone-runners/drone-runner-aws/store/database" "github.com/drone/drone-go/drone" "github.com/drone/envsubst" @@ -125,7 +125,7 @@ func (c *execCommand) run(*kingpin.ParseContext) error { //nolint:gocyclo // its Fatalln("exec: unable to load pool file, or use an in memory pool file") } - pools, err := poolfile.ProcessPool(configPool, runnerName, &envConfig) + pools, err := poolfile.ProcessPool(configPool, runnerName, envConfig.Passwords()) if err != nil { logrus.WithError(err). Errorln("exec: unable to process pool file") diff --git a/command/harness/context.go b/command/harness/context.go index b182153f..cef96996 100644 --- a/command/harness/context.go +++ b/command/harness/context.go @@ -7,12 +7,13 @@ import ( ) type Context struct { - AccountID string `json:"account_id,omitempty"` - OrgID string `json:"org_id,omitempty"` - ProjectID string `json:"project_id,omitempty"` - PipelineID string `json:"pipeline_id,omitempty"` - RunSequence int `json:"run_sequence,omitempty"` - TaskID string `json:"task_id,omitempty"` + AccountID string `json:"account_id,omitempty"` + OrgID string `json:"org_id,omitempty"` + ProjectID string `json:"project_id,omitempty"` + PipelineID string `json:"pipeline_id,omitempty"` + RunSequence int `json:"run_sequence,omitempty"` + IsFreeAccount bool `json:"is_free_account,omitempty"` + TaskID string `json:"task_id,omitempty"` } func AddContext(logr *logrus.Entry, context *Context, tags map[string]string) *logrus.Entry { @@ -32,6 +33,14 @@ func GetAccountID(context *Context, tags map[string]string) string { return tags["accountID"] } +func getIsFreeAccount(context *Context, tags map[string]string) bool { + // if freeCI is a key in tags, use it + if tags["freeCI"] == "true" { + return true + } + return context.IsFreeAccount +} + func getTaskID(context *Context, tags map[string]string) string { if context.TaskID != "" { return context.TaskID diff --git a/command/harness/delegate/delegate.go b/command/harness/delegate/delegate.go index 15b8f265..efdb1403 100644 --- a/command/harness/delegate/delegate.go +++ b/command/harness/delegate/delegate.go @@ -5,12 +5,12 @@ import ( "encoding/json" "net/http" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/httprender" + errors "github.com/drone-runners/drone-runner-aws/app/types" "github.com/drone-runners/drone-runner-aws/command/config" "github.com/drone-runners/drone-runner-aws/command/harness" "github.com/drone-runners/drone-runner-aws/engine/resource" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/httprender" - errors "github.com/drone-runners/drone-runner-aws/internal/types" "github.com/drone-runners/drone-runner-aws/metric" "github.com/drone-runners/drone-runner-aws/store" "github.com/drone-runners/drone-runner-aws/store/database" @@ -192,7 +192,7 @@ func (c *delegateCommand) handleSetup(w http.ResponseWriter, r *http.Request) { return } ctx := r.Context() - resp, _, err := harness.HandleSetup(ctx, req, c.stageOwnerStore, &c.env, c.poolManager, c.metrics) + resp, _, err := harness.HandleSetup(ctx, req, c.stageOwnerStore, c.env.Runner.Volumes, c.env.Dlite.PoolMapByAccount.Convert(), c.env.Runner.Name, c.env.LiteEngine.EnableMock, c.env.LiteEngine.MockStepTimeoutSecs, c.poolManager, c.metrics) if err != nil { logrus.WithField("stage_runtime_id", req.ID).WithError(err).Error("could not setup VM") writeError(w, err) @@ -209,7 +209,8 @@ func (c *delegateCommand) handleStep(w http.ResponseWriter, r *http.Request) { return } ctx := r.Context() - resp, err := harness.HandleStep(ctx, req, c.stageOwnerStore, &c.env, c.poolManager, c.metrics, false) + resp, err := harness.HandleStep(ctx, req, c.stageOwnerStore, c.env.Runner.Volumes, + c.env.LiteEngine.EnableMock, c.env.LiteEngine.MockStepTimeoutSecs, c.poolManager, c.metrics, false) if err != nil { logrus.WithField("stage_runtime_id", req.StageRuntimeID).WithField("step_id", req.ID). WithError(err).Error("could not execute step on VM") diff --git a/command/harness/delegate/tester/tester.go b/command/harness/delegate/tester/tester.go index 7c9256db..4d04eaf1 100644 --- a/command/harness/delegate/tester/tester.go +++ b/command/harness/delegate/tester/tester.go @@ -123,7 +123,6 @@ func (c *command) runPipeline(id string) error { runIn := &harness.ExecuteVMRequest{ StageRuntimeID: id, CorrelationID: id, - PoolID: c.pool, StartStepRequest: api.StartStepRequest{ ID: uuid.NewString(), Run: api.RunConfig{ diff --git a/command/harness/destroy.go b/command/harness/destroy.go index eb9c6082..1ab155b9 100644 --- a/command/harness/destroy.go +++ b/command/harness/destroy.go @@ -8,10 +8,10 @@ import ( "github.com/drone-runners/drone-runner-aws/command/config" "github.com/drone-runners/drone-runner-aws/command/harness/storage" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" - ierrors "github.com/drone-runners/drone-runner-aws/internal/types" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" + "github.com/drone-runners/drone-runner-aws/app/oshelp" + ierrors "github.com/drone-runners/drone-runner-aws/app/types" "github.com/drone-runners/drone-runner-aws/metric" "github.com/drone-runners/drone-runner-aws/store" "github.com/drone-runners/drone-runner-aws/types" diff --git a/command/harness/dlite/dlite.go b/command/harness/dlite/dlite.go index 0dfa7c14..185fea80 100644 --- a/command/harness/dlite/dlite.go +++ b/command/harness/dlite/dlite.go @@ -4,9 +4,9 @@ import ( "context" "time" + "github.com/drone-runners/drone-runner-aws/app/drivers" "github.com/drone-runners/drone-runner-aws/command/config" "github.com/drone-runners/drone-runner-aws/command/harness" - "github.com/drone-runners/drone-runner-aws/internal/drivers" "github.com/drone-runners/drone-runner-aws/metric" "github.com/drone-runners/drone-runner-aws/store/database" "github.com/drone-runners/drone-runner-aws/types" @@ -185,7 +185,17 @@ func (c *dliteCommand) setupDistributedPool(ctx context.Context) (*config.PoolFi logrus.WithError(err).Fatalln("Unable to start the database") return nil, err } - c.distributedPoolManager = drivers.NewDistributedManager(drivers.NewManager(ctx, instanceStore, stageOwnerStore, &c.env)) + c.distributedPoolManager = drivers.NewDistributedManager( + drivers.NewManager( + ctx, + instanceStore, + stageOwnerStore, + types.Tmate(c.env.Tmate), + c.env.Runner.Name, + c.env.LiteEngine.Path, + c.env.Settings.HarnessTestBinaryURI, + c.env.Settings.PluginBinaryURI, + c.env.Settings.AutoInjectionBinaryURI)) poolConfig, err := harness.SetupPool(ctx, &c.env, c.distributedPoolManager, c.poolFile) if err != nil { logrus.WithError(err).Error("could not setup distributed pool") diff --git a/command/harness/dlite/execute.go b/command/harness/dlite/execute.go index e5407751..b21bb64e 100644 --- a/command/harness/dlite/execute.go +++ b/command/harness/dlite/execute.go @@ -89,7 +89,8 @@ func (t *VMExecuteTask) ServeHTTP(w http.ResponseWriter, r *http.Request) { } var stepResp *api.PollStepResponse - stepResp, err = harness.HandleStep(ctx, &req.ExecuteVMRequest, poolManager.GetStageOwnerStore(), &t.c.env, poolManager, t.c.metrics, distributed) + stepResp, err = harness.HandleStep(ctx, &req.ExecuteVMRequest, poolManager.GetStageOwnerStore(), t.c.env.Runner.Volumes, + t.c.env.LiteEngine.EnableMock, t.c.env.LiteEngine.MockStepTimeoutSecs, poolManager, t.c.metrics, distributed) if err != nil { t.c.metrics.ErrorCount.WithLabelValues(accountID, strconv.FormatBool(distributed)).Inc() logr.WithError(err). diff --git a/command/harness/dlite/init.go b/command/harness/dlite/init.go index d89511e8..a2631508 100644 --- a/command/harness/dlite/init.go +++ b/command/harness/dlite/init.go @@ -60,7 +60,11 @@ func (t *VMInitTask) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Make the setup call req.SetupVMRequest.CorrelationID = task.ID poolManager := t.c.getPoolManager(req.Distributed) - setupResp, selectedPoolDriver, err := harness.HandleSetup(ctx, &req.SetupVMRequest, poolManager.GetStageOwnerStore(), &t.c.env, poolManager, t.c.metrics) + setupResp, selectedPoolDriver, err := harness.HandleSetup( + ctx, &req.SetupVMRequest, poolManager.GetStageOwnerStore(), + t.c.env.Runner.Volumes, t.c.env.Dlite.PoolMapByAccount.Convert(), + t.c.env.Runner.Name, t.c.env.LiteEngine.EnableMock, t.c.env.LiteEngine.MockStepTimeoutSecs, + poolManager, t.c.metrics) if err != nil { t.c.metrics.ErrorCount.WithLabelValues(accountID, strconv.FormatBool(req.Distributed)).Inc() logr.WithError(err).WithField("account_id", accountID).Error("could not setup VM") @@ -76,7 +80,8 @@ func (t *VMInitTask) ServeHTTP(w http.ResponseWriter, r *http.Request) { req.Services[i].IPAddress = setupResp.IPAddress req.Services[i].CorrelationID = task.ID status = VMServiceStatus{ID: s.ID, Name: s.Name, Image: s.Image, LogKey: s.LogKey, Status: Running, ErrorMessage: ""} - resp, err := harness.HandleStep(ctx, req.Services[i], poolManager.GetStageOwnerStore(), &t.c.env, poolManager, t.c.metrics, false) + resp, err := harness.HandleStep(ctx, req.Services[i], poolManager.GetStageOwnerStore(), t.c.env.Runner.Volumes, + t.c.env.LiteEngine.EnableMock, t.c.env.LiteEngine.MockStepTimeoutSecs, poolManager, t.c.metrics, false) if err != nil { status.Status = Error status.ErrorMessage = err.Error() diff --git a/command/harness/pool.go b/command/harness/pool.go index 54215896..4285eb06 100644 --- a/command/harness/pool.go +++ b/command/harness/pool.go @@ -4,9 +4,9 @@ import ( "context" "time" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/poolfile" "github.com/drone-runners/drone-runner-aws/command/config" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/poolfile" "github.com/sirupsen/logrus" ) @@ -16,7 +16,7 @@ func SetupPool(ctx context.Context, env *config.EnvConfig, poolManager drivers.I logrus.WithError(confErr).Fatalln("Unable to load pool file, or use an in memory pool") } - pools, err := poolfile.ProcessPool(configPool, env.Runner.Name, env) + pools, err := poolfile.ProcessPool(configPool, env.Runner.Name, env.Passwords()) if err != nil { logrus.WithError(err).Errorln("unable to process pool file") return configPool, err @@ -35,13 +35,6 @@ func SetupPool(ctx context.Context, env *config.EnvConfig, poolManager drivers.I return configPool, err } - err = poolManager.AddTmate(env) - if err != nil { - logrus.WithError(err). - Errorln("unable to set tmate configuration") - return configPool, err - } - // setup lifetimes of instances busyMaxAge := time.Hour * time.Duration(env.Settings.BusyMaxAge) // includes time required to setup an instance freeMaxAge := time.Hour * time.Duration(env.Settings.FreeMaxAge) diff --git a/command/harness/pool_mapper.go b/command/harness/pool_mapper.go index b9bbdf54..09df6f62 100644 --- a/command/harness/pool_mapper.go +++ b/command/harness/pool_mapper.go @@ -1,13 +1,12 @@ package harness import ( - "github.com/drone-runners/drone-runner-aws/command/config" "github.com/sirupsen/logrus" ) // if pool mapping is defined in env config, it figures out the mapped pool name & returns it // else returns the input pool -func fetchPool(accountID, inputPool string, p config.PoolMapperByAccount) string { +func fetchPool(accountID, inputPool string, p map[string]map[string]string) string { if accountID == "" { return inputPool } diff --git a/command/harness/setup.go b/command/harness/setup.go index 8bf22d90..ca2683e0 100644 --- a/command/harness/setup.go +++ b/command/harness/setup.go @@ -8,14 +8,13 @@ import ( "strings" "time" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/metric" - "github.com/drone-runners/drone-runner-aws/command/config" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" + errors "github.com/drone-runners/drone-runner-aws/app/types" "github.com/drone-runners/drone-runner-aws/engine/resource" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" - errors "github.com/drone-runners/drone-runner-aws/internal/types" "github.com/drone-runners/drone-runner-aws/store" "github.com/drone-runners/drone-runner-aws/types" "github.com/harness/lite-engine/api" @@ -54,7 +53,21 @@ var ( // HandleSetup tries to setup an instance in any of the pools given in the setup request. // It calls handleSetup internally for each pool instance trying to complete a setup. -func HandleSetup(ctx context.Context, r *SetupVMRequest, s store.StageOwnerStore, env *config.EnvConfig, poolManager drivers.IManager, metrics *metric.Metrics) (*SetupVMResponse, string, error) { +// Instead of passing in the env config, we pass in whatever is needed. This is because +// this same code is being used in the new runner and we want to make sure nothing breaking +// is added here which is not added in the new runner. +func HandleSetup( + ctx context.Context, + r *SetupVMRequest, + s store.StageOwnerStore, + globalVolumes []string, + poolMapByAccount map[string]map[string]string, + runnerName string, + enableMock bool, // only used for scale testing + mockTimeout int, // only used for scale testing + poolManager drivers.IManager, + metrics *metric.Metrics, +) (*SetupVMResponse, string, error) { stageRuntimeID := r.ID if stageRuntimeID == "" { return nil, "", errors.NewBadRequestError("mandatory field 'id' in the request body is empty") @@ -86,7 +99,7 @@ func HandleSetup(ctx context.Context, r *SetupVMRequest, s store.StageOwnerStore } // append global volumes to the setup request. - for _, pair := range env.Runner.Volumes { + for _, pair := range globalVolumes { src, _, ro, err := resource.ParseVolume(pair) if err != nil { log.Warn(err) @@ -119,7 +132,7 @@ func HandleSetup(ctx context.Context, r *SetupVMRequest, s store.StageOwnerStore var owner string // TODO: Remove this once we start populating license information. - if strings.Contains(r.PoolID, freeAccount) || r.Tags[freeCI] == "true" { + if strings.Contains(r.PoolID, freeAccount) || getIsFreeAccount(&r.Context, r.Tags) { owner = freeAccount } else { owner = GetAccountID(&r.Context, r.Tags) @@ -130,9 +143,9 @@ func HandleSetup(ctx context.Context, r *SetupVMRequest, s store.StageOwnerStore if idx > 0 { fallback = true } - pool := fetchPool(r.SetupRequest.LogConfig.AccountID, p, env.Dlite.PoolMapByAccount) + pool := fetchPool(r.SetupRequest.LogConfig.AccountID, p, poolMapByAccount) logr.WithField("pool_id", pool).Traceln("starting the setup process") - instance, poolErr = handleSetup(ctx, logr, r, env, poolManager, pool, owner) + instance, poolErr = handleSetup(ctx, logr, r, runnerName, enableMock, mockTimeout, poolManager, pool, owner) if poolErr != nil { logr.WithField("pool_id", pool).WithError(poolErr).Errorln("could not setup instance") continue @@ -193,7 +206,17 @@ func HandleSetup(ctx context.Context, r *SetupVMRequest, s store.StageOwnerStore // run a health check on the lite engine. It returns information about the setup // VM and an error if setup failed. // It is idempotent so in case there was a setup failure, it cleans up any intermediate state. -func handleSetup(ctx context.Context, logr *logrus.Entry, r *SetupVMRequest, env *config.EnvConfig, poolManager drivers.IManager, pool, owner string) (*types.Instance, error) { +func handleSetup( + ctx context.Context, + logr *logrus.Entry, + r *SetupVMRequest, + runnerName string, + enableMock bool, + mockTimeout int, + poolManager drivers.IManager, + pool, + owner string, +) (*types.Instance, error) { // check if the pool exists in the pool manager. if !poolManager.Exists(pool) { return nil, fmt.Errorf("could not find pool: %s", pool) @@ -205,10 +228,10 @@ func handleSetup(ctx context.Context, logr *logrus.Entry, r *SetupVMRequest, env var query *types.QueryParams if poolManager.IsDistributed() { query = &types.QueryParams{ - RunnerName: env.Runner.Name, + RunnerName: runnerName, } } - instance, err := poolManager.Provision(ctx, pool, env.Runner.Name, poolManager.GetTLSServerName(), owner, r.ResourceClass, env, query, &r.GitspaceAgentConfig, &r.StorageConfig) + instance, err := poolManager.Provision(ctx, pool, poolManager.GetTLSServerName(), owner, r.ResourceClass, query, &r.GitspaceAgentConfig, &r.StorageConfig) if err != nil { return nil, fmt.Errorf("failed to provision instance: %w", err) } @@ -283,7 +306,7 @@ func handleSetup(ctx context.Context, logr *logrus.Entry, r *SetupVMRequest, env } client, err := lehelper.GetClient(instance, poolManager.GetTLSServerName(), instance.Port, - env.LiteEngine.EnableMock, env.LiteEngine.MockStepTimeoutSecs) + enableMock, mockTimeout) if err != nil { go cleanUpInstanceFn(false) return nil, fmt.Errorf("failed to create LE client: %w", err) diff --git a/command/harness/step.go b/command/harness/step.go index 2c9ef3a2..d4aef808 100644 --- a/command/harness/step.go +++ b/command/harness/step.go @@ -6,13 +6,12 @@ import ( "strings" "time" - "github.com/drone-runners/drone-runner-aws/command/config" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" + "github.com/drone-runners/drone-runner-aws/app/oshelp" + ierrors "github.com/drone-runners/drone-runner-aws/app/types" "github.com/drone-runners/drone-runner-aws/command/harness/scripts" "github.com/drone-runners/drone-runner-aws/engine/resource" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" - ierrors "github.com/drone-runners/drone-runner-aws/internal/types" "github.com/drone-runners/drone-runner-aws/metric" "github.com/drone-runners/drone-runner-aws/store" "github.com/drone-runners/drone-runner-aws/types" @@ -28,7 +27,6 @@ type ExecuteVMRequest struct { StageRuntimeID string `json:"stage_runtime_id"` InstanceID string `json:"instance_id"` IPAddress string `json:"ip_address"` - PoolID string `json:"pool_id"` CorrelationID string `json:"correlation_id"` TaskID string `json:"task_id,omitempty"` Distributed bool `json:"distributed,omitempty"` @@ -42,7 +40,9 @@ var ( func HandleStep(ctx context.Context, r *ExecuteVMRequest, s store.StageOwnerStore, - env *config.EnvConfig, + globalVolumes []string, + enableMock bool, // only used for scale testing + mockTimeoutSecs int, // only used for scale testing poolManager drivers.IManager, metrics *metric.Metrics, async bool) (*api.PollStepResponse, error) { @@ -73,7 +73,7 @@ func HandleStep(ctx context.Context, // add global volumes as mounts only if image is specified if r.Image != "" { - for _, pair := range env.Runner.Volumes { + for _, pair := range globalVolumes { src, dest, _, err := resource.ParseVolume(pair) //nolint:govet if err != nil { logr.Warn(err) @@ -93,7 +93,7 @@ func HandleStep(ctx context.Context, logr = logr.WithField("ip", inst.Address) - client, err := lehelper.GetClient(inst, poolManager.GetTLSServerName(), inst.Port, env.LiteEngine.EnableMock, env.LiteEngine.MockStepTimeoutSecs) + client, err := lehelper.GetClient(inst, poolManager.GetTLSServerName(), inst.Port, enableMock, mockTimeoutSecs) if err != nil { return nil, fmt.Errorf("failed to create client: %w", err) } diff --git a/command/setup/setup.go b/command/setup/setup.go index f7abeeb4..432ef1b8 100644 --- a/command/setup/setup.go +++ b/command/setup/setup.go @@ -10,10 +10,10 @@ import ( "os" "time" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" + "github.com/drone-runners/drone-runner-aws/app/poolfile" "github.com/drone-runners/drone-runner-aws/command/config" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" - "github.com/drone-runners/drone-runner-aws/internal/poolfile" "github.com/drone-runners/drone-runner-aws/store/database" "github.com/drone/runner-go/client" "github.com/drone/runner-go/logger" @@ -143,7 +143,7 @@ func (c *setupCommand) run(*kingpin.ParseContext) error { //nolint Fatalln("Unable to load pool file, or use an in memory pool") } // process the pool file - pools, processErr := poolfile.ProcessPool(configPool, runnerName, &env) + pools, processErr := poolfile.ProcessPool(configPool, runnerName, env.Passwords()) if processErr != nil { logrus.WithError(processErr). Fatalln("setup: unable to process pool file") @@ -155,7 +155,7 @@ func (c *setupCommand) run(*kingpin.ParseContext) error { //nolint Fatalln("setup: unable to add pool") } // provision - instance, provisionErr := poolManager.Provision(ctx, testPoolName, runnerName, runnerName, "drone", "", &env, nil, nil, nil) + instance, provisionErr := poolManager.Provision(ctx, testPoolName, runnerName, "drone", "", nil, nil, nil) if provisionErr != nil { consoleLogs, consoleErr := poolManager.InstanceLogs(ctx, testPoolName, instance.ID) logrus.Infof("setup: instance logs for %s: %s", instance.ID, consoleLogs) diff --git a/engine/compiler/compiler.go b/engine/compiler/compiler.go index 279638c8..17f7eebb 100644 --- a/engine/compiler/compiler.go +++ b/engine/compiler/compiler.go @@ -11,9 +11,9 @@ import ( "github.com/drone-runners/drone-runner-aws/engine" "github.com/drone-runners/drone-runner-aws/engine/resource" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/encoder" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/encoder" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone/drone-go/drone" "github.com/drone/runner-go/clone" diff --git a/engine/compiler/compiler_test.go b/engine/compiler/compiler_test.go index acf6f136..fecc8c20 100644 --- a/engine/compiler/compiler_test.go +++ b/engine/compiler/compiler_test.go @@ -12,12 +12,13 @@ import ( "sort" "testing" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/oshelp" + "github.com/drone-runners/drone-runner-aws/app/poolfile" "github.com/drone-runners/drone-runner-aws/command/config" "github.com/drone-runners/drone-runner-aws/engine" "github.com/drone-runners/drone-runner-aws/engine/resource" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" - "github.com/drone-runners/drone-runner-aws/internal/poolfile" + "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/drone-go/drone" "github.com/drone/runner-go/environ/provider" "github.com/drone/runner-go/manifest" @@ -184,7 +185,7 @@ func testCompile(t *testing.T, source, golden string) *engine.Spec { return nil } - pools, err := poolfile.ProcessPool(poolFile, "runner", nil) + pools, err := poolfile.ProcessPool(poolFile, "runner", types.Passwords{}) if err != nil { t.Errorf("unable to process pool file: %s", err) return nil diff --git a/engine/engine.go b/engine/engine.go index d6c76443..ee4ef355 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -14,9 +14,9 @@ import ( "github.com/drone-runners/drone-runner-aws/command/config" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/lehelper" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/lehelper" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone/runner-go/environ" "github.com/drone/runner-go/logger" "github.com/drone/runner-go/pipeline/runtime" @@ -66,7 +66,7 @@ func (e *Engine) Setup(ctx context.Context, specv runtime.Spec) error { } // lets see if there is anything in the pool - instance, err := manager.Provision(ctx, poolName, e.config.Runner.Name, e.config.Runner.Name, "drone", "", e.config, nil, nil, nil) + instance, err := manager.Provision(ctx, poolName, e.config.Runner.Name, "drone", "", nil, nil, nil) if err != nil { logr.WithError(err).Errorln("failed to provision an instance") return err diff --git a/engine/linter/linter.go b/engine/linter/linter.go index 1ac1a7f8..15aebdca 100644 --- a/engine/linter/linter.go +++ b/engine/linter/linter.go @@ -11,8 +11,8 @@ import ( "strings" "github.com/drone-runners/drone-runner-aws/engine/resource" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone/drone-go/drone" "github.com/drone/runner-go/manifest" ) diff --git a/engine/linter/linter_test.go b/engine/linter/linter_test.go index bbbf8e18..e3d44ffc 100644 --- a/engine/linter/linter_test.go +++ b/engine/linter/linter_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/drone-runners/drone-runner-aws/engine/resource" - "github.com/drone-runners/drone-runner-aws/internal/drivers" - "github.com/drone-runners/drone-runner-aws/internal/drivers/amazon" + "github.com/drone-runners/drone-runner-aws/app/drivers" + "github.com/drone-runners/drone-runner-aws/app/drivers/amazon" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/drone-go/drone" "github.com/drone/runner-go/manifest" diff --git a/engine/resource/parser_test.go b/engine/resource/parser_test.go index 3a41a56f..2e66f9a1 100644 --- a/engine/resource/parser_test.go +++ b/engine/resource/parser_test.go @@ -7,7 +7,7 @@ package resource import ( "testing" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/runner-go/manifest" diff --git a/engine/resource/pipeline_test.go b/engine/resource/pipeline_test.go index 1e65131f..518b9242 100644 --- a/engine/resource/pipeline_test.go +++ b/engine/resource/pipeline_test.go @@ -7,7 +7,7 @@ package resource import ( "testing" - "github.com/drone-runners/drone-runner-aws/internal/oshelp" + "github.com/drone-runners/drone-runner-aws/app/oshelp" "github.com/drone-runners/drone-runner-aws/types" "github.com/drone/runner-go/manifest" diff --git a/types/types.go b/types/types.go index 348ad361..a0736ac4 100644 --- a/types/types.go +++ b/types/types.go @@ -71,6 +71,12 @@ type Instance struct { EnableNestedVirtualization bool `db:"enable_nested_virtualization" json:"enable_nested_virtualization"` } +// Passwords holds sensitive data. +type Passwords struct { + AnkaToken string + Tart string +} + type Tmate struct { Enabled bool Image string