Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ArgumentException is thrown when running the action on GitHub hosted runners #26

Open
ShahradR opened this issue Jul 16, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ShahradR
Copy link
Owner

ShahradR commented Jul 16, 2020

When running the action on GitHub-hosted runners, the following exceptions is thrown:

System.ArgumentException: Unexpected type 'SequenceToken' encountered while reading 'entrypoint'. The type 'StringToken' was expected.

This is because the action.yaml file provides a sequence of commands as the entrypoint, rather than a single string.

action.yaml file

entrypoint:
- /bin/sh
- -c
- ${{ format('taskcat {0}', inputs.commands) }}

Exception thrown by GitHub hosted runner

image

@ShahradR ShahradR added the bug Something isn't working label Jul 16, 2020
@ShahradR ShahradR self-assigned this Jul 16, 2020
@ShahradR
Copy link
Owner Author

Looking at the runner's source code, the runner is hard-coded to expect a string. However, act is hard-coded to expect a sequence.

To quickly resolve this issue, the sequence will be converted to a string, and the tests will be temporarily disabled.

ShahradR added a commit that referenced this issue Jul 17, 2020
Update the action.yaml file to pass the `entrypoint` parameter as a
single string, rather than a sequence of arguments.

act expects the entrypoint to be of type string[]. However, the GitHub
runner expects type string. Because of this disconnect, workflow files
that pass their act tests throw exceptions when ran on GitHub hosted
runners, and vice-versa.

To work around this issue, the act JUnit tests have been temporarily
ignored until this issue can be resolved.

To see the entrypoint parser in act, see https://git.io/JJZx0
To see the entrypoint parter in the GH runner, see https://git.io/JJZxV

Associated issue: #26
ShahradR added a commit that referenced this issue Jul 17, 2020
Update the action.yaml file to pass the `entrypoint` parameter as a
single string, rather than a sequence of arguments.

act expects the entrypoint to be of type string[]. However, the GitHub
runner expects type string. Because of this disconnect, workflow files
that pass their act tests throw exceptions when ran on GitHub hosted
runners, and vice-versa.

To work around this issue, the act JUnit tests have been temporarily
ignored until this issue can be resolved.

To see the entrypoint parser in act, see https://git.io/JJZx0
To see the entrypoint parter in the GH runner, see https://git.io/JJZxV

Associated issue: #26
ShahradR added a commit to ShahradR/cfn-template that referenced this issue Jul 18, 2020
Bump the action-taskcat version to v1.0.2. This solves the issue where a
System.ArgumentException is thrown because the `entrypoint` parameter in
the action's definition was defined as a sequence instead of a string.

Associated issues: ShahradR/action-taskcat#26, #4
ShahradR added a commit that referenced this issue Jul 19, 2020
After trying to reduce dependencies and eliminate the need to create a
new container to run taskcat in GitHub workflows, it seems that it might
be easier to simply control the execution from within a script,
bypassing the restrictions set by the GitHub Action's metadata syntax.

This commit re-introduces the entrypoint.sh script and the Dockerfile.
Building on the official taskcat/taskcat container, the script allows
users to pass arbitrary commands to taskcat from GitHub workflows, as
they would when invoking the taskcat from the command line.

Associated issues: #20, #26
ShahradR added a commit that referenced this issue Jul 19, 2020
Due to validation and implementation differences between act and the
GitHub hosted runners, we cannot solely rely on the JUnit tests to ensure
the correct functionality of the action.

To help catch errors, a job was added to this repository's GitHub
workflow, which runs the example in this project's README file against
the sample CloudFormation template used by the JUnit tests.

While we can only rely on the action's return code to determine if the
execution was successful, it can act as a simple tool to detect errors
that act might have missed.

Associated issue: #20, #26
ShahradR added a commit that referenced this issue Jul 20, 2020
Re-enable the JUnit tests which have been disabled in commit 0cfb762.
With the introduction of our own container layer in previous commits,
the entrypoint is now defined in the Dockerfile, rather than the
action.yaml file.

While the underlying issue still persists, we're no longer affected by
the discrepancy between act and the GitHub runner, each expecting
different types for the entrypoint element in the action's definition.

Associated issue: #26, #24
ShahradR added a commit that referenced this issue Nov 29, 2020
fix: reduce size of README GIF, and add pre-commit hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant