diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f77204..b09de80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,30 +43,95 @@ jobs: bin/druid_rcon_web_rust .docker/entrypoint.sh .docker/druid-install-command.sh - docker: + docker-base: runs-on: ubuntu-latest needs: build + strategy: + matrix: + include: + - dockerfile: Dockerfile + tag_suffix: "" + - dockerfile: Dockerfile.steamcmd + tag_suffix: "-steamcmd" steps: - uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to Artifacts Registry + uses: docker/login-action@v3 + with: + registry: artifacts.druid.gg + username: ${{ vars.DRUID_ARTIFACTS_REGISTRY_USERNAME }} + password: ${{ secrets.DRUID_ARTIFACTS_REGISTRY_TOKEN }} #stable is still pretty bleeding edge at this point - name: Build and push Docker image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: - file: Dockerfile + context: . + file: ${{ matrix.dockerfile }} tags: | - highcard/druidd-base:latest - highcard/druidd-base:stable - highcard/druidd-base:${{ needs.build.outputs.version }} - highcard/druidd-base:${{ needs.build.outputs.version_tag }} + highcard/druid:latest${{ matrix.tag_suffix }} + highcard/druid:stable${{ matrix.tag_suffix }} + highcard/druid:${{ needs.build.outputs.version }}${{ matrix.tag_suffix }} + highcard/druid:${{ needs.build.outputs.version_tag }}${{ matrix.tag_suffix }} + artifacts.druid.gg/druid-team/druid:latest${{ matrix.tag_suffix }} + artifacts.druid.gg/druid-team/druid:stable${{ matrix.tag_suffix }} + artifacts.druid.gg/druid-team/druid:${{ needs.build.outputs.version }}${{ matrix.tag_suffix }} + artifacts.druid.gg/druid-team/druid:${{ needs.build.outputs.version_tag }}${{ matrix.tag_suffix }} push: true build-args: | VERSION=${{ needs.build.outputs.version }} GIT_COMMIT=${{ github.sha }} GIT_BRANCH=${{ github.ref_name }} + + docker-nix: + runs-on: ubuntu-latest + needs: [build, docker-base] + strategy: + matrix: + include: + - base_tag_suffix: "" + tag_suffix: "-nix" + - base_tag_suffix: "-steamcmd" + tag_suffix: "-nix-steamcmd" + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to Artifacts Registry + uses: docker/login-action@v3 + with: + registry: artifacts.druid.gg + username: ${{ vars.DRUID_ARTIFACTS_REGISTRY_USERNAME }} + password: ${{ secrets.DRUID_ARTIFACTS_REGISTRY_TOKEN }} + - name: Build and push Nix Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.nix + tags: | + highcard/druid:latest${{ matrix.tag_suffix }} + highcard/druid:stable${{ matrix.tag_suffix }} + highcard/druid:${{ needs.build.outputs.version }}${{ matrix.tag_suffix }} + highcard/druid:${{ needs.build.outputs.version_tag }}${{ matrix.tag_suffix }} + artifacts.druid.gg/druid-team/druid:latest${{ matrix.tag_suffix }} + artifacts.druid.gg/druid-team/druid:stable${{ matrix.tag_suffix }} + artifacts.druid.gg/druid-team/druid:${{ needs.build.outputs.version }}${{ matrix.tag_suffix }} + artifacts.druid.gg/druid-team/druid:${{ needs.build.outputs.version_tag }}${{ matrix.tag_suffix }} + push: true + build-args: | + VERSION=${{ needs.build.outputs.version }}${{ matrix.base_tag_suffix }} diff --git a/Dockerfile b/Dockerfile index 271f055..953e624 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN make build-plugins # The binaries are in ./bin/ directory after build # Second stage: minimal runtime image -FROM debian:bullseye-slim +FROM ubuntu:24.04 RUN apt-get update && apt-get install -y \ ca-certificates \ diff --git a/Dockerfile.nix b/Dockerfile.nix new file mode 100644 index 0000000..cda4464 --- /dev/null +++ b/Dockerfile.nix @@ -0,0 +1,14 @@ +ARG VERSION=latest +FROM highcard/druid:${VERSION} +USER root + +RUN apt-get update && apt-get install -y \ + curl xz-utils \ + && rm -rf /var/lib/apt/lists/* +RUN mkdir -m 0755 /nix && chown druid /nix +USER druid + +# install Nix package manager +RUN bash -c "sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --no-daemon" +# Make nix available in PATH for all RUN commands +ENV PATH=/home/druid/.nix-profile/bin:/home/druid/.nix-profile/sbin:$PATH diff --git a/Dockerfile.steamcmd b/Dockerfile.steamcmd new file mode 100644 index 0000000..7db7bb0 --- /dev/null +++ b/Dockerfile.steamcmd @@ -0,0 +1,16 @@ +ARG VERSION=latest +FROM highcard/druid:${VERSION} AS base +FROM gameservermanagers/steamcmd:ubuntu-24.04 + +COPY --from=base /usr/bin/druid* /usr/bin/ +COPY --from=base /entrypoint.sh /entrypoint.sh + +# Set up user with the same UID/GID +ARG UID=1000 +ARG GID=1000 +RUN groupadd -g $GID -o druid +RUN useradd -m -u $UID -g $GID -o -s /bin/bash druid + +USER druid + +ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/cmd/run.go b/cmd/run.go index a9b20e0..225cd77 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -40,7 +40,10 @@ var RunCmd = &cobra.Command{ if err != nil { return fmt.Errorf("error creating scroll service: %w", err) } - processLauncher := services.NewProcedureLauncher(client, processManager, services.NewPluginManager(), consoleService, logManager, scrollService) + processLauncher, err := services.NewProcedureLauncher(client, processManager, services.NewPluginManager(), consoleService, logManager, scrollService, dependencyResolution) + if err != nil { + return err + } queueManager := services.NewQueueManager(scrollService, processLauncher) snapshotService := snapshotService.NewSnapshotService() @@ -65,4 +68,5 @@ var RunCmd = &cobra.Command{ func init() { RunCmd.Flags().BoolVarP(&ignoreVersionCheck, "ignore-version-check", "", false, "Ignore version check") + RunCmd.Flags().StringVarP(&dependencyResolution, "dependency-resolution", "", "auto", "Dependency resolution strategy. Valid values: auto, nix, external") } diff --git a/cmd/serve.go b/cmd/serve.go index 58a2f9e..5536426 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -38,6 +38,7 @@ var initSnapshotUrl string var skipArtifactDownload bool var allowPluginErrors bool var pprofBind string +var dependencyResolution string var ServeCommand = &cobra.Command{ Use: "serve", @@ -118,7 +119,10 @@ to interact and monitor the Scroll Application`, logger.Log().Info("Scroll loaded", zap.String("Name", currentScroll.Name), zap.Any("Version", currentScroll.Version), zap.String("AppVersion", currentScroll.AppVersion), zap.Any("Ports", currentScroll.Ports)) - processLauncher := services.NewProcedureLauncher(client, processManager, pluginManager, consoleService, logManager, scrollService) + processLauncher, err := services.NewProcedureLauncher(client, processManager, pluginManager, consoleService, logManager, scrollService, dependencyResolution) + if err != nil { + return err + } queueManager := services.NewQueueManager(scrollService, processLauncher) @@ -303,6 +307,9 @@ func init() { ServeCommand.Flags().BoolVarP(&skipArtifactDownload, "skip-artifact-download", "", false, "Skip downloading the artifact on startup") ServeCommand.Flags().BoolVarP(&allowPluginErrors, "allow-plugin-errors", "", false, "Ignore plugin errors on startup") + + ServeCommand.Flags().StringVarP(&dependencyResolution, "dependency-resolution", "", "auto", "Dependency resolution strategy. Valid values: auto, nix, external") + } func startup(scrollService *services.ScrollService, snapshotService ports.SnapshotService, processLauncher *services.ProcedureLauncher, queueManager *services.QueueManager, portSerivce *services.PortMonitor, coldStarter *services.ColdStarter, healthHandler *handler.HealthHandler, cwd string, doneChan chan error) { diff --git a/examples/minecraft/.scroll/scroll.yaml b/examples/minecraft/.scroll/scroll.yaml index 51b97bf..09e1e14 100644 --- a/examples/minecraft/.scroll/scroll.yaml +++ b/examples/minecraft/.scroll/scroll.yaml @@ -33,8 +33,14 @@ commands: start: needs: [install] run: restart + dependencies: [jdk17] procedures: - mode: exec + data: + - java + - -version + - mode: exec + id: start-process data: - java - -Xmx1024M @@ -46,7 +52,7 @@ commands: procedures: - mode: stdin data: - - start.0 + - start-process - stop install: run: once diff --git a/internal/core/domain/scroll.go b/internal/core/domain/scroll.go index 99cca76..58b44ad 100644 --- a/internal/core/domain/scroll.go +++ b/internal/core/domain/scroll.go @@ -78,9 +78,10 @@ type Procedure struct { } // @name Procedure type CommandInstructionSet struct { - Procedures []*Procedure `yaml:"procedures" json:"procedures"` - Needs []string `yaml:"needs,omitempty" json:"needs,omitempty"` - Run RunMode `yaml:"run,omitempty" json:"run,omitempty"` + Dependencies []string `yaml:"dependencies,omitempty" json:"dependencies,omitempty"` + Procedures []*Procedure `yaml:"procedures" json:"procedures"` + Needs []string `yaml:"needs,omitempty" json:"needs,omitempty"` + Run RunMode `yaml:"run,omitempty" json:"run,omitempty"` } // @name CommandInstructionSet var ErrScrollDoesNotExist = fmt.Errorf("scroll does not exist") diff --git a/internal/core/ports/services_ports.go b/internal/core/ports/services_ports.go index 6dcb1ac..857db64 100644 --- a/internal/core/ports/services_ports.go +++ b/internal/core/ports/services_ports.go @@ -41,7 +41,7 @@ type ScrollServiceInterface interface { type ProcedureLauchnerInterface interface { LaunchPlugins() error - RunProcedure(*domain.Procedure, string) (string, *int, error) + RunProcedure(*domain.Procedure, string, []string) (string, *int, error) Run(cmd string, runCommandCb func(cmd string) error) error GetProcedureStatuses() map[string]domain.ScrollLockStatus } @@ -184,3 +184,8 @@ type UiDevServiceInterface interface { IsWatching() bool SetCommands(procs map[string]*domain.CommandInstructionSet) } + +type NixDependencyServiceInterface interface { + GetCommand(cmd []string, deps []string) []string + EnsureNixInstalled() error +} diff --git a/internal/core/services/nix_dependency_service.go b/internal/core/services/nix_dependency_service.go new file mode 100644 index 0000000..d84c07c --- /dev/null +++ b/internal/core/services/nix_dependency_service.go @@ -0,0 +1,34 @@ +package services + +import ( + "fmt" + "os/exec" + "strings" + + "github.com/highcard-dev/daemon/internal/core/ports" +) + +type NixDependencyService struct{} + +func NewNixDependencyService() *NixDependencyService { return &NixDependencyService{} } + +func (s *NixDependencyService) EnsureNixInstalled() error { + if _, err := exec.LookPath("nix-shell"); err != nil { + return fmt.Errorf("nix-shell not found in PATH; install Nix from https://nixos.org/download and ensure 'nix-shell' is available: %w", err) + } + return nil +} + +func (s *NixDependencyService) GetCommand(cmd []string, deps []string) []string { + var cmds = []string{"nix-shell", "--pure"} + for _, dep := range deps { + cmds = append(cmds, "-p", dep) + } + + cmds = append(cmds, "--command", strings.Join(cmd, " ")) + + return cmds + +} + +var _ ports.NixDependencyServiceInterface = (*NixDependencyService)(nil) diff --git a/internal/core/services/nix_dependency_service_test.go b/internal/core/services/nix_dependency_service_test.go new file mode 100644 index 0000000..e2212ce --- /dev/null +++ b/internal/core/services/nix_dependency_service_test.go @@ -0,0 +1,27 @@ +package services + +import ( + "testing" +) + +func TestEnsureNixInstalled(t *testing.T) { + svc := NewNixDependencyService() + err := svc.EnsureNixInstalled() + // We accept either outcome because CI/dev environment may or may not have nix. + if err != nil { + t.Logf("nix-shell not found (acceptable if Nix not installed): %v", err) + } +} + +func TestGetCommandPassthrough(t *testing.T) { + svc := NewNixDependencyService() + in := []string{"echo", "hello"} + deps := []string{"nodejs", "python3"} + out := svc.GetCommand(in, deps) + expected := []string{"nix-shell", "--pure", "-p", "nodejs", "-p", "python3", "--command", "echo hello"} + for i, v := range expected { + if out[i] != v { + t.Errorf("expected out[%d] = %s got %s", i, v, out[i]) + } + } +} diff --git a/internal/core/services/procedure_launcher.go b/internal/core/services/procedure_launcher.go index c2d69d2..6161192 100644 --- a/internal/core/services/procedure_launcher.go +++ b/internal/core/services/procedure_launcher.go @@ -14,14 +14,15 @@ import ( ) type ProcedureLauncher struct { - pluginManager ports.PluginManagerInterface - processManager ports.ProcessManagerInterface - ociRegistry ports.OciRegistryInterface - consoleManager ports.ConsoleManagerInterface - logManager ports.LogManagerInterface - scrollService ports.ScrollServiceInterface - procedures map[string]domain.ScrollLockStatus - proceduresMutex *sync.Mutex + pluginManager ports.PluginManagerInterface + processManager ports.ProcessManagerInterface + ociRegistry ports.OciRegistryInterface + consoleManager ports.ConsoleManagerInterface + logManager ports.LogManagerInterface + scrollService ports.ScrollServiceInterface + nixDependencyService ports.NixDependencyServiceInterface + procedures map[string]domain.ScrollLockStatus + proceduresMutex *sync.Mutex } func NewProcedureLauncher( @@ -31,19 +32,48 @@ func NewProcedureLauncher( consoleManager ports.ConsoleManagerInterface, logManager ports.LogManagerInterface, scrollService ports.ScrollServiceInterface, -) *ProcedureLauncher { + dependecyResolution string, +) (*ProcedureLauncher, error) { + var nixDependencyService ports.NixDependencyServiceInterface = nil + + switch dependecyResolution { + case "nix": + logger.Log().Info("Using Nix for dependency resolution") + nixDependencyService = NewNixDependencyService() + err := nixDependencyService.EnsureNixInstalled() + if err != nil { + return nil, err + } + case "external": + logger.Log().Info("Using external system for dependency resolution") + default: + logger.Log().Warn("Unknown dependency resolution strategy, falling back to 'auto'", zap.String("dependecyResolution", dependecyResolution)) + fallthrough + case "auto": + logger.Log().Info("Using automatic dependency resolution") + nixDependencyService = NewNixDependencyService() + err := nixDependencyService.EnsureNixInstalled() + if err != nil { + logger.Log().Info("Nix not found, falling back to external system for dependency resolution") + nixDependencyService = nil + } else { + logger.Log().Info("Nix found, using Nix for dependency resolution") + } + } + s := &ProcedureLauncher{ - processManager: processManager, - ociRegistry: ociRegistry, - pluginManager: pluginManager, - consoleManager: consoleManager, - logManager: logManager, - scrollService: scrollService, - procedures: make(map[string]domain.ScrollLockStatus), - proceduresMutex: &sync.Mutex{}, + processManager: processManager, + ociRegistry: ociRegistry, + pluginManager: pluginManager, + consoleManager: consoleManager, + logManager: logManager, + scrollService: scrollService, + procedures: make(map[string]domain.ScrollLockStatus), + proceduresMutex: &sync.Mutex{}, + nixDependencyService: nixDependencyService, } - return s + return s, nil } func (sc *ProcedureLauncher) setProcedureStatus(procedure string, status domain.ScrollLockStatus) { @@ -91,6 +121,7 @@ func (sc *ProcedureLauncher) Run(cmd string, runCommandCb func(cmd string) error return err } + deps := command.Dependencies for idx, proc := range command.Procedures { commandIdx := fmt.Sprintf("%s.%d", cmd, idx) @@ -125,20 +156,20 @@ func (sc *ProcedureLauncher) Run(cmd string, runCommandCb func(cmd string) error case int: //run in go routine and wait for x seconds go func(procedure domain.Procedure) { time.Sleep(time.Duration(wait) * time.Second) - sc.RunProcedure(&procedure, commandIdx) + sc.RunProcedure(&procedure, commandIdx, deps) }(*proc) case bool: //run in go routine maybe wait if wait { - _, exitCode, err = sc.RunProcedure(proc, commandIdx) + _, exitCode, err = sc.RunProcedure(proc, commandIdx, deps) if err != nil { sc.setProcedureStatus(commandIdx, domain.ScrollLockStatusError) return err } } else { - go sc.RunProcedure(proc, commandIdx) + go sc.RunProcedure(proc, commandIdx, deps) } default: //run and wait - _, exitCode, err = sc.RunProcedure(proc, commandIdx) + _, exitCode, err = sc.RunProcedure(proc, commandIdx, deps) if err != nil { sc.setProcedureStatus(commandIdx, domain.ScrollLockStatusError) return err @@ -180,7 +211,7 @@ func (sc *ProcedureLauncher) Run(cmd string, runCommandCb func(cmd string) error return nil } -func (sc *ProcedureLauncher) RunProcedure(proc *domain.Procedure, cmd string) (string, *int, error) { +func (sc *ProcedureLauncher) RunProcedure(proc *domain.Procedure, cmd string, dependencies []string) (string, *int, error) { logger.Log().Info("Running procedure", zap.String("cmd", cmd), @@ -215,12 +246,17 @@ func (sc *ProcedureLauncher) RunProcedure(proc *domain.Procedure, cmd string) (s return "", nil, err } + var err error + var exitCode *int + + if sc.nixDependencyService != nil { + instructions = sc.nixDependencyService.GetCommand(instructions, dependencies) + } + logger.Log().Debug("Running exec process", zap.String("cwd", processCwd), zap.Strings("instructions", instructions), ) - var err error - var exitCode *int if proc.Mode == "exec-tty" { exitCode, err = sc.processManager.RunTty(cmd, instructions, processCwd) diff --git a/internal/core/services/process_manager.go b/internal/core/services/process_manager.go index 4044c78..3371141 100644 --- a/internal/core/services/process_manager.go +++ b/internal/core/services/process_manager.go @@ -137,8 +137,6 @@ func (po *ProcessManager) Run(commandName string, command []string, dir string) zap.String("dir", dir), ) - println("Starting process", commandName, name, args, dir) - process.Cmd = exec.Command(name, args...) process.Cmd.Dir = dir diff --git a/internal/core/services/queue_manager.go b/internal/core/services/queue_manager.go index c22f641..2ac085a 100644 --- a/internal/core/services/queue_manager.go +++ b/internal/core/services/queue_manager.go @@ -389,11 +389,6 @@ func (sc *QueueManager) WaitUntilEmpty() { sc.mu.Unlock() for { - sc.mu.Lock() - for cmd, item := range sc.commandQueue { - println(cmd + ": " + string(item.Status)) - } - sc.mu.Unlock() cmds := <-notifier if len(cmds) == 0 { diff --git a/internal/core/services/queue_manager_test.go b/internal/core/services/queue_manager_test.go index 1fc68c1..3a97458 100644 --- a/internal/core/services/queue_manager_test.go +++ b/internal/core/services/queue_manager_test.go @@ -61,7 +61,10 @@ func TestQueueManager(t *testing.T) { consoleManager := services.NewConsoleManager(logManager) processManager := services.NewProcessManager(logManager, consoleManager, processMonitor) - procedureLauncher := services.NewProcedureLauncher(ociRegistryMock, processManager, pluginManager, consoleManager, logManager, scrollService) + procedureLauncher, err := services.NewProcedureLauncher(ociRegistryMock, processManager, pluginManager, consoleManager, logManager, scrollService, "external") + if err != nil { + t.Error(err) + } queueManager := services.NewQueueManager(scrollService, procedureLauncher) processMonitor.EXPECT().AddProcess(gomock.Any(), "test.0").AnyTimes() @@ -178,7 +181,10 @@ func TestQueueManager(t *testing.T) { consoleManager := services.NewConsoleManager(logManager) processManager := services.NewProcessManager(logManager, consoleManager, processMonitor) - procedureLauncher := services.NewProcedureLauncher(ociRegistryMock, processManager, pluginManager, consoleManager, logManager, scrollService) + procedureLauncher, err := services.NewProcedureLauncher(ociRegistryMock, processManager, pluginManager, consoleManager, logManager, scrollService, "external") + if err != nil { + t.Error(err) + } queueManager := services.NewQueueManager(scrollService, procedureLauncher) processMonitor.EXPECT().AddProcess(gomock.Any(), "test.0").AnyTimes() @@ -243,7 +249,10 @@ func TestQueueManager(t *testing.T) { consoleManager := services.NewConsoleManager(logManager) processManager := services.NewProcessManager(logManager, consoleManager, processMonitor) - procedureLauncher := services.NewProcedureLauncher(ociRegistryMock, processManager, pluginManager, consoleManager, logManager, scrollService) + procedureLauncher, err := services.NewProcedureLauncher(ociRegistryMock, processManager, pluginManager, consoleManager, logManager, scrollService, "external") + if err != nil { + t.Error(err) + } queueManager := services.NewQueueManager(scrollService, procedureLauncher) lock := &domain.ScrollLock{ @@ -314,7 +323,7 @@ func TestQueueManager(t *testing.T) { scrollService.EXPECT().GetCwd().Return("/tmp").AnyTimes() go queueManager.Work() - err := queueManager.AddTempItem("test") + err = queueManager.AddTempItem("test") if err != nil { t.Error(err) } diff --git a/internal/handler/scroll_handler.go b/internal/handler/scroll_handler.go index 4b7cf49..1f1353f 100644 --- a/internal/handler/scroll_handler.go +++ b/internal/handler/scroll_handler.go @@ -22,10 +22,11 @@ type StartScrollRequestBody struct { } type StartProcedureRequestBody struct { - Mode string `json:"mode"` - Data string `json:"data"` - Process string `json:"process"` - Sync bool `json:"sync"` + Mode string `json:"mode"` + Data string `json:"data"` + Process string `json:"process"` + Dependencies []string `json:"dependencies"` + Sync bool `json:"sync"` } func NewScrollHandler( @@ -132,6 +133,7 @@ func (sl ScrollHandler) RunProcedure(c *fiber.Ctx) error { } command := requestBody.Process + deps := requestBody.Dependencies process := sl.ProcessManager.GetRunningProcess(command) if process == nil { c.SendString("Running process not found") @@ -140,10 +142,10 @@ func (sl ScrollHandler) RunProcedure(c *fiber.Ctx) error { if !requestBody.Sync { - go sl.ProcessLauncher.RunProcedure(&procedure, command) + go sl.ProcessLauncher.RunProcedure(&procedure, command, deps) return c.SendStatus(201) } else { - res, _, err := sl.ProcessLauncher.RunProcedure(&procedure, command) + res, _, err := sl.ProcessLauncher.RunProcedure(&procedure, command, deps) if err != nil { c.SendString(err.Error()) return c.SendStatus(400) diff --git a/renovate.json b/renovate.json index 22a9943..b6503cd 100644 --- a/renovate.json +++ b/renovate.json @@ -1,4 +1,10 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": ["config:recommended"] + "extends": ["config:recommended"], + "packageRules": [ + { + "groupName": "All non-major dependencies", + "matchUpdateTypes": ["minor", "patch", "pin", "digest", "rollback"] + } + ] } diff --git a/test/integration/example_test.go b/test/integration/example_test.go index f20b7b7..7d95bca 100644 --- a/test/integration/example_test.go +++ b/test/integration/example_test.go @@ -118,7 +118,11 @@ func TestExamples(t *testing.T) { consoleManager := services.NewConsoleManager(logManager) processMonitor := test_utils.GetMockedProcessMonitor(ctrl) processManager := services.NewProcessManager(logManager, consoleManager, processMonitor) - procedureLauncher := services.NewProcedureLauncher(ociRegistryMock, processManager, pluginManager, consoleManager, logManager, scrollService) + procedureLauncher, err := services.NewProcedureLauncher(ociRegistryMock, processManager, pluginManager, consoleManager, logManager, scrollService, "external") + if err != nil { + t.Error(err) + return + } queueManager := services.NewQueueManager(scrollService, procedureLauncher) go queueManager.Work() diff --git a/test/mock/services.go b/test/mock/services.go index 45bbac9..4e4ab90 100644 --- a/test/mock/services.go +++ b/test/mock/services.go @@ -344,9 +344,9 @@ func (mr *MockProcedureLauchnerInterfaceMockRecorder) Run(cmd, runCommandCb any) } // RunProcedure mocks base method. -func (m *MockProcedureLauchnerInterface) RunProcedure(arg0 *domain.Procedure, arg1 string) (string, *int, error) { +func (m *MockProcedureLauchnerInterface) RunProcedure(arg0 *domain.Procedure, arg1 string, arg2 []string) (string, *int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RunProcedure", arg0, arg1) + ret := m.ctrl.Call(m, "RunProcedure", arg0, arg1, arg2) ret0, _ := ret[0].(string) ret1, _ := ret[1].(*int) ret2, _ := ret[2].(error) @@ -354,9 +354,9 @@ func (m *MockProcedureLauchnerInterface) RunProcedure(arg0 *domain.Procedure, ar } // RunProcedure indicates an expected call of RunProcedure. -func (mr *MockProcedureLauchnerInterfaceMockRecorder) RunProcedure(arg0, arg1 any) *gomock.Call { +func (mr *MockProcedureLauchnerInterfaceMockRecorder) RunProcedure(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunProcedure", reflect.TypeOf((*MockProcedureLauchnerInterface)(nil).RunProcedure), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunProcedure", reflect.TypeOf((*MockProcedureLauchnerInterface)(nil).RunProcedure), arg0, arg1, arg2) } // MockPluginManagerInterface is a mock of PluginManagerInterface interface. @@ -1716,3 +1716,55 @@ func (mr *MockUiDevServiceInterfaceMockRecorder) Unsubscribe(client any) *gomock mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unsubscribe", reflect.TypeOf((*MockUiDevServiceInterface)(nil).Unsubscribe), client) } + +// MockNixDependencyServiceInterface is a mock of NixDependencyServiceInterface interface. +type MockNixDependencyServiceInterface struct { + ctrl *gomock.Controller + recorder *MockNixDependencyServiceInterfaceMockRecorder + isgomock struct{} +} + +// MockNixDependencyServiceInterfaceMockRecorder is the mock recorder for MockNixDependencyServiceInterface. +type MockNixDependencyServiceInterfaceMockRecorder struct { + mock *MockNixDependencyServiceInterface +} + +// NewMockNixDependencyServiceInterface creates a new mock instance. +func NewMockNixDependencyServiceInterface(ctrl *gomock.Controller) *MockNixDependencyServiceInterface { + mock := &MockNixDependencyServiceInterface{ctrl: ctrl} + mock.recorder = &MockNixDependencyServiceInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockNixDependencyServiceInterface) EXPECT() *MockNixDependencyServiceInterfaceMockRecorder { + return m.recorder +} + +// EnsureNixInstalled mocks base method. +func (m *MockNixDependencyServiceInterface) EnsureNixInstalled() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EnsureNixInstalled") + ret0, _ := ret[0].(error) + return ret0 +} + +// EnsureNixInstalled indicates an expected call of EnsureNixInstalled. +func (mr *MockNixDependencyServiceInterfaceMockRecorder) EnsureNixInstalled() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnsureNixInstalled", reflect.TypeOf((*MockNixDependencyServiceInterface)(nil).EnsureNixInstalled)) +} + +// GetCommand mocks base method. +func (m *MockNixDependencyServiceInterface) GetCommand(cmd, deps []string) []string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCommand", cmd, deps) + ret0, _ := ret[0].([]string) + return ret0 +} + +// GetCommand indicates an expected call of GetCommand. +func (mr *MockNixDependencyServiceInterfaceMockRecorder) GetCommand(cmd, deps any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCommand", reflect.TypeOf((*MockNixDependencyServiceInterface)(nil).GetCommand), cmd, deps) +}