Skip to content

Commit

Permalink
fix: fix report file inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
beiertu-mms committed Jan 8, 2024
1 parent b86965b commit c22cb63
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test_action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ jobs:
with:
image: ${{ env.image }}
config_files: ./test/config.yaml
output_format: json
report_file: report.json

- run: |
cat report.json
jq '.' report.json
17 changes: 12 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ inputs:
The path to where the executable will be installed to.
required: false
default: ".bin"
output_format:
description: |
The output format for the test report.
Available format: text, json, junit
Default: text
default: "text"
report_file:
description: |
Write the test report to the specified file. Supported file types are json and junit.
Expand All @@ -44,6 +50,8 @@ runs:
if [[ "${{ steps.cache.outputs.cache-hit }}" == 'true' ]]; then
echo "container-structure-test found in cache. It will not be installed for this run."
else
echo "container-structure-test not found in cache. ${{ inputs.version }} version will be installed."
case "$RUNNER_OS" in
Linux)
curl --location \
Expand Down Expand Up @@ -79,14 +87,13 @@ runs:
PULL_IMAGE=""
[[ "${{ inputs.pull_image }}" == 'true' ]] && PULL_IMAGE="--pull"
OUTPUT_FORMAT="--output ${{ inputs.output_format }}"
REPORT_FILE=""
[[ -n "${{ inputs.report_file }}" ]] && REPORT_FILE="--test-report ${{ inputs.report_file }}"
container-structure-test test \
container-structure-test test $NO_COLOR $PULL_IMAGE $OUTPUT_FORMAT $REPORT_FILE \
--image "${{ inputs.image }}" \
--config "${{ inputs.config_files }}" \
"$NO_COLOR" \
"$PULL_IMAGE" \
"$REPORT_FILE"
--config "${{ inputs.config_files }}"
shell: bash
1 change: 1 addition & 0 deletions output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Pass":4,"Fail":0,"Total":4,"Duration":1584986689,"Results":[{"Name":"Command Test: bash","Pass":true,"Stdout":"GNU bash, version 5.2.21(1)-release-(x86_64-alpine-linux-musl)\nUsage:\tbash [GNU long option] [option] ...\n\tbash [GNU long option] [option] script-file ...\nGNU long options:\n\t--debug\n\t--debugger\n\t--dump-po-strings\n\t--dump-strings\n\t--help\n\t--init-file\n\t--login\n\t--noediting\n\t--noprofile\n\t--norc\n\t--posix\n\t--pretty-print\n\t--rcfile\n\t--restricted\n\t--verbose\n\t--version\nShell options:\n\t-ilrsD or -c command or -O shopt_option\t\t(invocation only)\n\t-abefhkmnptuvxBCEHPT or -o option\nType `bash -c \"help set\"' for more information about shell options.\nType `bash -c help' for more information about shell builtin commands.\nUse the `bashbug' command to report bugs.\n\nbash home page: \u003chttp://www.gnu.org/software/bash\u003e\nGeneral help using GNU software: \u003chttp://www.gnu.org/gethelp/\u003e\n","Duration":492120774},{"Name":"Command Test: jq","Pass":true,"Stdout":"jq - commandline JSON processor [version 1.7.1]\n\nUsage:\tjq [options] \u003cjq filter\u003e [file...]\n\tjq [options] --args \u003cjq filter\u003e [strings...]\n\tjq [options] --jsonargs \u003cjq filter\u003e [JSON_TEXTS...]\n\njq is a tool for processing JSON inputs, applying the given filter to\nits JSON text inputs and producing the filter's results as JSON on\nstandard output.\n\nThe simplest filter is ., which copies jq's input to its output\nunmodified except for formatting. For more advanced filters see\nthe jq(1) manpage (\"man jq\") and/or https://jqlang.github.io/jq/.\n\nExample:\n\n\t$ echo '{\"foo\": 0}' | jq .\n\t{\n\t \"foo\": 0\n\t}\n\nCommand options:\n -n, --null-input use `null` as the single input value;\n -R, --raw-input read each line as string instead of JSON;\n -s, --slurp read all inputs into an array and use it as\n the single input value;\n -c, --compact-output compact instead of pretty-printed output;\n -r, --raw-output output strings without escapes and quotes;\n --raw-output0 implies -r and output NUL after each output;\n -j, --join-output implies -r and output without newline after\n each output;\n -a, --ascii-output output strings by only ASCII characters\n using escape sequences;\n -S, --sort-keys sort keys of each object on output;\n -C, --color-output colorize JSON output;\n -M, --monochrome-output disable colored output;\n --tab use tabs for indentation;\n --indent n use n spaces for indentation (max 7 spaces);\n --unbuffered flush output stream after each output;\n --stream parse the input value in streaming fashion;\n --stream-errors implies --stream and report parse error as\n an array;\n --seq parse input/output as application/json-seq;\n -f, --from-file file load filter from the file;\n -L directory search modules from the directory;\n --arg name value set $name to the string value;\n --argjson name value set $name to the JSON value;\n --slurpfile name file set $name to an array of JSON values read\n from the file;\n --rawfile name file set $name to string contents of file;\n --args consume remaining arguments as positional\n string values;\n --jsonargs consume remaining arguments as positional\n JSON values;\n -e, --exit-status set exit status code based on the output;\n -V, --version show the version;\n --build-configuration show jq's build configuration;\n -h, --help show the help;\n -- terminates argument processing;\n\nNamed arguments are also available as $ARGS.named[], while\npositional arguments are available as $ARGS.positional[].\n","Duration":533256984},{"Name":"Command Test: curl","Pass":true,"Stdout":"Usage: curl [options...] \u003curl\u003e\n -d, --data \u003cdata\u003e HTTP POST data\n -f, --fail Fail fast with no output on HTTP errors\n -h, --help \u003ccategory\u003e Get help for commands\n -i, --include Include protocol response headers in the output\n -o, --output \u003cfile\u003e Write to file instead of stdout\n -O, --remote-name Write output to a file named as the remote file\n -s, --silent Silent mode\n -T, --upload-file \u003cfile\u003e Transfer local FILE to destination\n -u, --user \u003cuser:password\u003e Server user and password\n -A, --user-agent \u003cname\u003e Send User-Agent \u003cname\u003e to server\n -v, --verbose Make the operation more talkative\n -V, --version Show version number and quit\n\nThis is not the full help, this menu is stripped into categories.\nUse \"--help category\" to get an overview of all categories.\nFor all options use the manual or \"--help all\".\n","Duration":559608931},{"Name":"Metadata Test","Pass":true,"Duration":0}]}

0 comments on commit c22cb63

Please sign in to comment.