Skip to content

Support entrypoint and command for service containers#4276

Merged
ericsciple merged 2 commits intomainfrom
users/ericsciple/26-03-services
Mar 4, 2026
Merged

Support entrypoint and command for service containers#4276
ericsciple merged 2 commits intomainfrom
users/ericsciple/26-03-services

Conversation

@ericsciple
Copy link
Copy Markdown
Collaborator

@ericsciple ericsciple commented Mar 4, 2026

Summary

Adds support for entrypoint and command properties on service containers in workflow YAML.

Feature flag:

  • actions_service_container_command

Changes

  • Updated both legacy (PipelineTemplateConverter) and new (WorkflowTemplateConverter) parsers to support entrypoint and command on service containers when the flag is on, and emit context.Error with source location when the flag is off
  • Set existing ContainerInfo.EntryPoint and ContainerInfo.Command properties, which DockerCommandManager already uses for docker create

E2E Testing

Validated end-to-end using the following workflow:

Test workflow

services:
  custom-nginx:
    image: nginx:alpine
    ports:
      - 19080:80
    entrypoint: /bin/sh
    command: >-
      -c "echo 'entrypoint-and-command-works' > /usr/share/nginx/html/proof.txt && nginx -g 'daemon off;'"
steps:
  - name: Verify entrypoint and command
    run: |
      RESULT=$(curl -sf http://localhost:19080/proof.txt)
      [ "$RESULT" = "entrypoint-and-command-works" ] && echo "SUCCESS" || exit 1

@ericsciple ericsciple force-pushed the users/ericsciple/26-03-services branch from b5f9f62 to 296ae07 Compare March 4, 2026 17:32
"image": {
"type": "string",
"description": "Use `jobs.<job_id>.container.image` to define the Docker image to use as the container to run the action. The value can be the Docker Hub image or a registry name."
"description": "The Docker image to use as the container. The value can be the Docker Hub image or a registry name."
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matches descriptions from server copy

this.ContainerImage = containerImage;
this.ContainerDisplayName = $"{container.Alias}_{Pipelines.Validation.NameValidation.Sanitize(containerImage)}_{Guid.NewGuid().ToString("N").Substring(0, 6)}";
this.ContainerCreateOptions = container.Options;
this.ContainerEntryPoint = container.Entrypoint;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sets existing properties, which DockerCommandManager already uses for docker create

@ericsciple ericsciple marked this pull request as ready for review March 4, 2026 20:21
@ericsciple ericsciple requested a review from a team as a code owner March 4, 2026 20:21
Copilot AI review requested due to automatic review settings March 4, 2026 20:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for entrypoint and command on service containers in workflow YAML, gated behind the actions_service_container_command feature flag, and wires the parsed values through to container creation.

Changes:

  • Extend both legacy (DTPipelines) and new (WorkflowParser) schemas/parsers to recognize services.<id>.entrypoint and services.<id>.command.
  • Gate parsing/evaluation via actions_service_container_command (plus ACTIONS_SERVICE_CONTAINER_COMMAND env var fallback) and emit a validation error when disabled.
  • Add/extend L0 coverage to validate parity between legacy and new evaluators (flag on/off cases).

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Test/L0/Worker/PipelineTemplateEvaluatorWrapperL0.cs Updates wrapper construction and adds tests for service container entrypoint/command with flag on/off.
src/Sdk/WorkflowParser/workflow-v1.0.json Introduces service-container-mapping and allows entrypoint/command under services.
src/Sdk/WorkflowParser/WorkflowFeatures.cs Adds AllowServiceContainerCommand feature switch to WorkflowParser feature set.
src/Sdk/WorkflowParser/JobContainer.cs Adds Entrypoint and Command properties to WorkflowParser JobContainer.
src/Sdk/WorkflowParser/Conversion/WorkflowTemplateConverter.cs Parses/gates entrypoint/command and sets them on the converted container model.
src/Sdk/WorkflowParser/Conversion/WorkflowTemplateConstants.cs Adds constants for entrypoint and command keys.
src/Sdk/DTPipelines/workflow-v1.0.json Introduces service-container-mapping for legacy schema and allows entrypoint/command under services.
src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateEvaluator.cs Threads AllowServiceContainerCommand through service container evaluation.
src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConverter.cs Parses/gates entrypoint/command for legacy JobContainer conversion.
src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConstants.cs Adds constants for entrypoint and command keys in legacy pipeline templating.
src/Sdk/DTPipelines/Pipelines/JobContainer.cs Adds Entrypoint and Command properties to legacy JobContainer.
src/Runner.Worker/PipelineTemplateEvaluatorWrapper.cs Passes the flag into both evaluators and compares Entrypoint/Command for mismatch recording.
src/Runner.Worker/ExecutionContext.cs Reads feature flag + env var and propagates it to evaluators/wrapper.
src/Runner.Worker/Container/ContainerInfo.cs Maps parsed Entrypoint/Command into ContainerInfo for downstream container creation.
src/Runner.Common/Constants.cs Adds actions_service_container_command feature flag constant.
Comments suppressed due to low confidence (1)

src/Runner.Worker/PipelineTemplateEvaluatorWrapper.cs:418

  • These mismatch logs include the full Command value. command often contains long shell fragments and can include secrets; consider avoiding logging the raw command (or redact/limit it) to reduce the risk of leaking sensitive workflow content into diagnostic logs.
            if (!string.Equals(legacyResult.Command, newResult.Command, StringComparison.Ordinal))
            {
                _trace.Info($"CompareJobContainer mismatch - Command differs (legacy='{legacyResult.Command}', new='{newResult.Command}')");
                return false;
            }

@ericsciple ericsciple changed the title Support entrypoint and command for service containers Support entrypoint and command for service containers Mar 4, 2026
@ericsciple ericsciple enabled auto-merge (squash) March 4, 2026 23:32
@ericsciple ericsciple merged commit 20111cb into main Mar 4, 2026
11 checks passed
@ericsciple ericsciple deleted the users/ericsciple/26-03-services branch March 4, 2026 23:36
dawidmalina pushed a commit to dawidmalina/github-runner that referenced this pull request Mar 19, 2026
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 this pull request may close these issues.

3 participants