Skip to content

Fix for broken Kubernetes mode#117

Closed
timmjd wants to merge 2 commits intoactions:mainfrom
timmjd:fix/args_escaped
Closed

Fix for broken Kubernetes mode#117
timmjd wants to merge 2 commits intoactions:mainfrom
timmjd:fix/args_escaped

Conversation

@timmjd
Copy link
Copy Markdown

@timmjd timmjd commented Nov 14, 2023

Issue

Within the current implementation of hooks 0.4.0 in combination with ARC 0.6.1 running in mode=kubernetes and the lastest runner 2.311.0 on an Enterprise instance, the handover of args towards the k8s job container is buggy. The args will be forwarded to the job pod in a escaped way, which will be disrespected by some tools like mkdocs:

Usage: mkdocs [OPTIONS] COMMAND [ARGS]...

  MkDocs - Project documentation with Markdown.

Options:
  -V, --version  Show the version and exit.
  -q, --quiet    Silence warnings
  -v, --verbose  Enable verbose output
  -h, --help     Show this message and exit.

Commands:
  build      Build the MkDocs documentation
  gh-deploy  Deploy your documentation to GitHub Pages
  new        Create a new MkDocs project
  serve      Run the builtin development server

This fix will remove the leading and ending quotes from the args before handing over to the k8s pod creation.

Example 1

The args as an array with all parameters as a space separated string

action.yml

name: Build MKDocs

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

Runner to Hooks

["\"build","--verbose","--strict\""]

Pod config without fix

  containers:
  - image: squidfunk/mkdocs-material:latest
    command:
    - mkdocs
  - args:
    - '"build'
    - --verbose
    - --string"

Pod config with fix

spec:
  containers:
  - image: squidfunk/mkdocs-material:latest
    command:
    - mkdocs
    args:
    - build
    - --verbose
    - --strict

Example 2

The args as an array with each parameter as a separate string

action.yml

name: Build MKDocs

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

Runner to Hooks

["\"build\"","\"--verbose\"","\"--strict\""]

Pod config without fix

  containers:
  - image: squidfunk/mkdocs-material:latest
    command:
    - mkdocs
  - args:
    - '"build"'
    - '"--verbose"'
    - '"--strict"'

Pod config with fix

spec:
  containers:
  - image: squidfunk/mkdocs-material:latest
    command:
    - mkdocs
    args:
    - build
    - --verbose
    - --strict

@timmjd
Copy link
Copy Markdown
Author

timmjd commented Nov 17, 2023

Fixed by #115

@timmjd timmjd closed this Nov 17, 2023
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.

1 participant