[PR #539] [MERGED] properly parse arguments to Docker container steps #1491

Closed
opened 2026-03-01 21:51:24 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/539
Author: @kdomanski
Created: 2/21/2021
Status: Merged
Merged: 2/23/2021
Merged by: @cplee

Base: masterHead: split


📝 Commits (1)

  • a869d00 properly parse arguments to Docker container steps

📊 Changes

2 files changed (+10 additions, -2 deletions)

View changed files

📝 go.mod (+1 -0)
📝 pkg/runner/step_context.go (+9 -2)

📄 Description

At present, act uses strings.Fields to split up args passed to a docker:// step. This completely ignores any sort of quoting and instead splits the string at every single space.

Example workflow:

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: docker://ubuntu:latest
      with:
        args: bash -c "echo test"

Currently it results with:

[test.yaml/build]   🐳  docker run image=ubuntu:latest entrypoint=[] cmd=["bash" "-c" "\"echo" "test\""]
| test": -c: line 0: unexpected EOF while looking for matching `"'
| test": -c: line 1: syntax error: unexpected end of file
[test.yaml/build]   ❌  Failure - docker://ubuntu:latest

Meanwhile Github parses the args as ["bash" "-c" "echo test"]. This PR introduces proper quotation parsing using github.com/kballard/go-shellquote. Resulting behavior:

[test.yaml/build]   🐳  docker run image=ubuntu:latest entrypoint=[] cmd=["bash" "-c" "echo test"]
| test
[test.yaml/build]   ✅  Success - docker://ubuntu:latest

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/539 **Author:** [@kdomanski](https://github.com/kdomanski) **Created:** 2/21/2021 **Status:** ✅ Merged **Merged:** 2/23/2021 **Merged by:** [@cplee](https://github.com/cplee) **Base:** `master` ← **Head:** `split` --- ### 📝 Commits (1) - [`a869d00`](https://github.com/nektos/act/commit/a869d008593fcc94715edeb3391c74b14ec44349) properly parse arguments to Docker container steps ### 📊 Changes **2 files changed** (+10 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `go.mod` (+1 -0) 📝 `pkg/runner/step_context.go` (+9 -2) </details> ### 📄 Description At present, act uses `strings.Fields` to split up `args` passed to a `docker://` step. This completely ignores any sort of quoting and instead splits the string at every single space. Example workflow: ```yaml on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: docker://ubuntu:latest with: args: bash -c "echo test" ``` Currently it results with: ```none [test.yaml/build] 🐳 docker run image=ubuntu:latest entrypoint=[] cmd=["bash" "-c" "\"echo" "test\""] | test": -c: line 0: unexpected EOF while looking for matching `"' | test": -c: line 1: syntax error: unexpected end of file [test.yaml/build] ❌ Failure - docker://ubuntu:latest ``` Meanwhile Github parses the args as `["bash" "-c" "echo test"]`. This PR introduces proper quotation parsing using `github.com/kballard/go-shellquote`. Resulting behavior: ```none [test.yaml/build] 🐳 docker run image=ubuntu:latest entrypoint=[] cmd=["bash" "-c" "echo test"] | test [test.yaml/build] ✅ Success - docker://ubuntu:latest ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:51:24 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1491
No description provided.