actions / runner-container-hooks

Runner Container Hooks for GitHub Actions
MIT License
67 stars 43 forks source link

Docker and K8s: Fix shell arguments when split by the runner #115

Closed nikola-jokic closed 9 months ago

nikola-jokic commented 9 months ago

When runner passes arguments to the hook, there may be situations where quoted strings are interpreted as separate arguments.

This PR addresses the issue and fixes the arguments based on shlex expansion

Fixes the issue in this discussion

timmjd commented 9 months ago

@nikola-jokic : does this cover the same as described in #117?

nikola-jokic commented 9 months ago

Hey @timmjd,

Yes! Your solution helped fix one problem in case the quotes are broken. This is the problem I was fixing for docker, I just extended it to be the same for k8s. Thank you for raising it, by the way! Would you mind testing it to make sure it works?

timmjd commented 9 months ago

Awesome!

This implementation is even better than #117 due to you keep the array consistency.

Example 1

name: Build MKDocs

runs:
  using: docker
  image: docker://squidfunk/mkdocs-material:latest
  entrypoint: mkdocs
  args:
  - build --verbose --strict
spec:
  containers:
  - command:
    - mkdocs
    args:
    - build --verbose --strict

Example 2

name: Build MKDocs

runs:
  using: docker
  image: docker://squidfunk/mkdocs-material:latest
  entrypoint: mkdocs
  args:
  - build
  - --verbose
  - --strict
spec:
  containers:
  - command:
    - mkdocs
    args:
    - build
    - --verbose
    - --strict