Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: K8s Prepare job webhook fails to create a pod for two services that use the same image #139

Open
DenisPalnitsky opened this issue Feb 27, 2024 · 1 comment · May be fixed by #138
Open

Comments

@DenisPalnitsky
Copy link

Prerequisites

Have Actions Runners Controller with AutoscalingRunnerSet configured in Kubernetes mode

Steps to reproduce

  1. Create workflow
name: CI
on:  
  push:   
  workflow_dispatch:

jobs:
  build:    
    container:
      image: ghcr.io/actions/actions-runner:latest

    services:
      redis:
        image: redis:6.2.5

      redis01:
          image: redis:6.2.5

    runs-on: [MY_ACTIONS_RUNNERSET_NAME]
    steps:
      - run: echo "Hello, world!"
        name: echo

Note that we want to use two redis service one with redis and other redis01 and that's how we want to reach them from workflow.

  1. Run workflow

Expected Result

Workflow executed.

Actual result

Workflow fails on Initialise containers step with error

##[debug]Evaluating condition for step: 'Initialize containers'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Initialize containers
##[debug]Register post job cleanup for stopping/deleting containers.
Run '/home/runner/k8s/index.js'
  shell: /home/runner/externals/node16/bin/node {0}
##[debug]/home/runner/externals/node16/bin/node /home/runner/k8s/index.js
##[debug]Using image 'ghcr.io/actions/actions-runner:latest' for job image
##[debug]Adding service 'redis:6.[2](https://github.com/OWNER/REPO/runs/8066535859/job/22034965318#step:2:2).[5](https://github.com/OWNER/REPO/actions/runs/8066535859/job/22034965318#step:2:5)' to pod definition
##[debug]Adding service 'redis:[6](https://github.com/OWNER/REPO/actions/runs/8066535859/job/22034965318#step:2:6).2.5' to pod definition
Error: Error: failed to create job pod: HttpError: HTTP request failed
Error: Process completed with exit code 1.
Error: Executing the custom container implementation failed. Please contact your self hosted runner administrator.
##[debug]System.Exception: Executing the custom container implementation failed. Please contact your self hosted runner administrator.
##[debug] ---> System.Exception: The hook script at '/home/runner/k[8](https://github.com/OWNER/REPO/actions/runs/8066535859/job/22034965318#step:2:8)s/index.js' running command 'PrepareJob' did not execute successfully
##[debug]   at GitHub.Runner.Worker.Container.ContainerHooks.ContainerHookManager.ExecuteHookScript[T](IExecutionContext context, HookInput input, ActionRunStage stage, String prependPath)
##[debug]   --- End of inner exception stack trace ---
##[debug]   at GitHub.Runner.Worker.Container.ContainerHooks.ContainerHookManager.ExecuteHookScript[T](IExecutionContext context, HookInput input, ActionRunStage stage, String prependPath)
##[debug]   at GitHub.Runner.Worker.Container.ContainerHooks.ContainerHookManager.PrepareJobAsync(IExecutionContext context, List`1 containers)
##[debug]   at GitHub.Runner.Worker.ContainerOperationProvider.StartContainersAsync(IExecutionContext executionContext, Object data)
##[debug]   at GitHub.Runner.Worker.JobExtensionRunner.RunAsync()
##[debug]   at GitHub.Runner.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)
##[debug]Finishing: Initialize containers
@DenisPalnitsky
Copy link
Author

I checked the args that prepareJob function receives and it does not have unique 'name'

  "services": [
        {
            "image": "redis:6.2.5",
            "dockerfile": null,
            "entryPointArgs": [],
            "entryPoint": null,
            "workingDirectory": null,
            "createOptions": null,
            "registry": null,
            "environmentVariables": {},
            "portMappings": [],
            "systemMountVolumes": [],
            "userMountVolumes": []
        },
        {
            "image": "redis:6.2.5",
            "dockerfile": null,
            "entryPointArgs": [],
            "entryPoint": null,
            "workingDirectory": null,
            "createOptions": null,
            "registry": null,
            "environmentVariables": {},
            "portMappings": [],
            "systemMountVolumes": [],
            "userMountVolumes": []
        }
    ]

I guess we need to add names to that code that passes those args first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant