Open
Description
Describe the bug
Using the github runner's container image fails if using shell: python
.
There is no alias to python in the image.
Manually entering the running container and running:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
resolves the issue - this should be part of the image build.
To Reproduce
Steps to reproduce the behaviour:
- pull the ghcr.io/actions/actions-runner:2.322.0 image
- start the container,
- configure and start the runner service within the container
- create a simple workflow
name: Run On-Prem activity
on:
workflow_dispatch:
permissions:
id-token: write
contents: read
actions: read
jobs:
simple_output:
name: Test Output
runs-on: [self-hosted]
steps:
- name: Checkout Source
id: checkout_source
uses: actions/checkout@v4
- name: echo hostname (Python)
id: echo_hostname
shell: python
# needs to have run: sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
run: |
"""output host info """
import os
import uuid
import platform
def write_step_summary(message: str):
"""
Write to the step output summary.
"""
with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as fh:
print(message, file=fh)
print(message)
hostname = platform.node()
write_step_summary('# Container Information')
write_step_summary(f"Executing on *{ hostname }*")
- the workflow fails with Error: python: command not found
A clear and concise description of what you expected to happen.
The inline python script should execute if shell: python
is specified
Runner Version and Platform
Version of your runner?
OS of the machine running the runner?
- container image ghcr.io/actions/actions-runner:2.322.0
What's not working?
Please include error messages and screenshots.
Job Log Output
If applicable, include the relevant part of the job / step log output here. All sensitive information should already be masked out, but please double-check before pasting here.
Run """output host info """
"""output host info """
import os
import uuid
import platform
def write_step_summary(message: str):
"""
Write to the step output summary.
"""
with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-[8]") as fh:
print(message, file=fh)
print(message)
hostname = platform.node()
write_step_summary('# Container Information')
write_step_summary(f"Executing on *{ hostname }*")
Error: python: command not found
Runner and Worker's Diagnostic Logs
[2025-02-13 23:59:26Z INFO HostContext] Well known directory 'Temp': '/home/runner/_work/_temp'
[2025-02-13 23:59:26Z INFO ExecutionContext] Write event payload to /home/runner/_work/_temp/_github_workflow/event.json
[2025-02-13 23:59:26Z INFO HostContext] Well known directory 'Bin': '/home/runner/bin'
[2025-02-13 23:59:26Z INFO HostContext] Well known directory 'Root': '/home/runner'
[2025-02-13 23:59:26Z INFO HostContext] Well known directory 'Work': '/home/runner/_work'
[2025-02-13 23:59:26Z INFO HostContext] Well known directory 'Temp': '/home/runner/_work/_temp'
[2025-02-13 23:59:26Z INFO ExtensionManager] Getting extensions for interface: 'GitHub.Runner.Worker.IFileCommandExtension'
[2025-02-13 23:59:26Z INFO ExtensionManager] Getting extensions for interface: 'GitHub.Runner.Worker.IActionCommandExtension'
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command internal-set-repo-path
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command set-env
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command set-output
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command save-state
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command add-path
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command add-mask
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command add-matcher
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command remove-matcher
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command warning
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command error
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command notice
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command debug
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command group
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command endgroup
[2025-02-13 23:59:26Z INFO ActionCommandManager] Register action command extension for command echo
[2025-02-13 23:59:26Z INFO ScriptHandler] Which2: 'python'
[2025-02-13 23:59:26Z INFO ScriptHandler] python: command not found. Make sure 'python' is installed and its location included in the 'PATH' environment variable.
[2025-02-13 23:59:26Z INFO JobServerQueue] Try to append 1 batches web console lines for record 'd07233d5-e26b-5a1b-079e-a773d0c1bb7a', success rate: 1/1.
[2025-02-13 23:59:26Z ERR StepsRunner] Caught exception from step: System.IO.FileNotFoundException: python: command not found
File name: 'python'
at GitHub.Runner.Sdk.WhichUtil.Which(String command, Boolean require, ITraceWriter trace, String prependPath)
at GitHub.Runner.Worker.Handlers.ScriptHandler.PrintActionDetails(ActionRunStage stage)
at GitHub.Runner.Worker.Handlers.Handler.PrepareExecution(ActionRunStage stage)
at GitHub.Runner.Worker.ActionRunner.RunAsync()
at GitHub.Runner.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)
[2025-02-13 23:59:26Z INFO JobServerQueue] Try to append 1 batches web console lines for record 'fe32ccd7-b645-517b-f0ee-13c90cb626de', success rate: 1/1.
[2025-02-13 23:59:26Z INFO JobServerQueue] Try to append 1 batches web console lines for record '3e07e684-8013-57c2-1d26-65b8b2529d93', success rate: 1/1.
[2025-02-13 23:59:26Z INFO StepsRunner] Step result: Failed
Activity