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

Missing optional dependencies (sarif) #426

Closed
ankon opened this issue Aug 13, 2024 · 3 comments · Fixed by #429
Closed

Missing optional dependencies (sarif) #426

ankon opened this issue Aug 13, 2024 · 3 comments · Fixed by #429
Assignees
Labels
bug Something isn't working

Comments

@ankon
Copy link

ankon commented Aug 13, 2024

Describe the bug

Our linting action is failing, because it doesn't seem to install the needed dependencies:

To Reproduce

  1. Install cfn-lint using action
  2. Run cfn-lint with options to make it produce sarif

Expected behavior

cfn-lint works -- and produces sarif output.

Screenshots

2024-08-13T17:53:35.2825093Z ##[debug]Evaluating condition for step: 'Install cfn-lint'
2024-08-13T17:53:35.2827453Z ##[debug]Evaluating: success()
2024-08-13T17:53:35.2827878Z ##[debug]Evaluating success:
2024-08-13T17:53:35.2828334Z ##[debug]=> true
2024-08-13T17:53:35.2828784Z ##[debug]Result: true
2024-08-13T17:53:35.2829529Z ##[debug]Starting: Install cfn-lint
2024-08-13T17:53:35.2848935Z ##[debug]Loading inputs
2024-08-13T17:53:35.2850677Z ##[debug]Loading env
2024-08-13T17:53:35.2855877Z ##[group]Run scottbrenner/cfn-lint-action@v2
2024-08-13T17:53:35.2856212Z with:
2024-08-13T17:53:35.2856400Z ##[endgroup]
2024-08-13T17:53:35.3227431Z ##[add-matcher]/home/runner/work/_actions/scottbrenner/cfn-lint-action/v2/.github/cfn-lint.json
2024-08-13T17:53:35.3250601Z ##[debug]Added matchers: 'cfn-lint', 'cfn-lint-warnings'. Problem matchers scan action output for known warning or error strings and report these inline.
2024-08-13T17:53:35.3268186Z [command]/usr/bin/python3 --version
2024-08-13T17:53:35.3316555Z Python 3.10.12
2024-08-13T17:53:35.3560917Z [command]/usr/bin/python3 -m venv /tmp/setup-cfn-lint-Pd1H6K/.venv
2024-08-13T17:53:38.8282217Z [command]/tmp/setup-cfn-lint-Pd1H6K/.venv/bin/python -m pip install --upgrade pip
2024-08-13T17:53:39.6641635Z Requirement already satisfied: pip in /tmp/setup-cfn-lint-Pd1H6K/.venv/lib/python3.10/site-packages (22.0.2)
2024-08-13T17:53:39.7715968Z Collecting pip
2024-08-13T17:53:39.8070849Z   Downloading pip-24.2-py3-none-any.whl (1.8 MB)
2024-08-13T17:53:39.8518458Z      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 42.8 MB/s eta 0:00:00
2024-08-13T17:53:39.8792008Z Installing collected packages: pip
2024-08-13T17:53:39.8794317Z   Attempting uninstall: pip
2024-08-13T17:53:39.8800465Z     Found existing installation: pip 22.0.2
2024-08-13T17:53:40.0983509Z     Uninstalling pip-22.0.2:
2024-08-13T17:53:40.1050030Z       Successfully uninstalled pip-22.0.2
2024-08-13T17:53:40.8128884Z Successfully installed pip-24.2
2024-08-13T17:53:40.8633058Z [command]/tmp/setup-cfn-lint-Pd1H6K/.venv/bin/python -m pip install --upgrade setuptools wheel
2024-08-13T17:53:41.6952981Z Requirement already satisfied: setuptools in /tmp/setup-cfn-lint-Pd1H6K/.venv/lib/python3.10/site-packages (59.6.0)
2024-08-13T17:53:41.8867106Z Collecting setuptools
2024-08-13T17:53:41.8957677Z   Downloading setuptools-72.2.0-py3-none-any.whl.metadata (6.6 kB)
2024-08-13T17:53:41.9332444Z Collecting wheel
2024-08-13T17:53:41.9363502Z   Downloading wheel-0.44.0-py3-none-any.whl.metadata (2.3 kB)
2024-08-13T17:53:41.9428323Z Downloading setuptools-72.2.0-py3-none-any.whl (2.3 MB)
2024-08-13T17:53:41.9659312Z    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 132.5 MB/s eta 0:00:00
2024-08-13T17:53:41.9688979Z Downloading wheel-0.44.0-py3-none-any.whl (67 kB)
2024-08-13T17:53:41.9981597Z Installing collected packages: wheel, setuptools
2024-08-13T17:53:42.0335043Z   Attempting uninstall: setuptools
2024-08-13T17:53:42.0356952Z     Found existing installation: setuptools 59.6.0
2024-08-13T17:53:42.0471623Z     Uninstalling setuptools-59.6.0:
2024-08-13T17:53:42.0550883Z       Successfully uninstalled setuptools-59.6.0
2024-08-13T17:53:42.6715769Z Successfully installed setuptools-72.2.0 wheel-0.44.0
2024-08-13T17:53:42.8158514Z [command]/tmp/setup-cfn-lint-Pd1H6K/.venv/bin/python -m pip install --upgrade cfn-lint==1.*
2024-08-13T17:53:43.4118536Z Collecting cfn-lint==1.*
2024-08-13T17:53:43.4213496Z   Downloading cfn_lint-1.10.1-py3-none-any.whl.metadata (22 kB)
2024-08-13T17:53:43.4672847Z Collecting pyyaml>5.4 (from cfn-lint==1.*)
2024-08-13T17:53:43.4704096Z   Downloading PyYAML-6.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
2024-08-13T17:53:43.5056042Z Collecting aws-sam-translator>=1.89.0 (from cfn-lint==1.*)
2024-08-13T17:53:43.5085075Z   Downloading aws_sam_translator-1.89.0-py3-none-any.whl.metadata (8.3 kB)
2024-08-13T17:53:43.5292752Z Collecting jsonpatch (from cfn-lint==1.*)
2024-08-13T17:53:43.5332277Z   Downloading jsonpatch-1.33-py2.py3-none-any.whl.metadata (3.0 kB)
2024-08-13T17:53:43.5603118Z Collecting networkx<4,>=2.4 (from cfn-lint==1.*)
2024-08-13T17:53:43.5632324Z   Downloading networkx-3.3-py3-none-any.whl.metadata (5.1 kB)
2024-08-13T17:53:43.5892259Z Collecting sympy>=1.0.0 (from cfn-lint==1.*)
2024-08-13T17:53:43.5921222Z   Downloading sympy-1.13.2-py3-none-any.whl.metadata (12 kB)
2024-08-13T17:53:43.9147601Z Collecting regex (from cfn-lint==1.*)
2024-08-13T17:53:43.9177946Z   Downloading regex-2024.7.24-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (40 kB)
2024-08-13T17:53:43.9388331Z Collecting typing-extensions (from cfn-lint==1.*)
2024-08-13T17:53:43.9420857Z   Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
2024-08-13T17:53:44.3811465Z Collecting boto3==1.*,>=1.19.5 (from aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:44.3846529Z   Downloading boto3-1.34.159-py3-none-any.whl.metadata (6.6 kB)
2024-08-13T17:53:44.4190587Z Collecting jsonschema<5,>=3.2 (from aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:44.4242552Z   Downloading jsonschema-4.23.0-py3-none-any.whl.metadata (7.9 kB)
2024-08-13T17:53:44.5463718Z Collecting pydantic<3,>=1.8 (from aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:44.5496633Z   Downloading pydantic-2.8.2-py3-none-any.whl.metadata (125 kB)
2024-08-13T17:53:44.9946119Z Collecting botocore<1.35.0,>=1.34.159 (from boto3==1.*,>=1.19.5->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:44.9986553Z   Downloading botocore-1.34.159-py3-none-any.whl.metadata (5.7 kB)
2024-08-13T17:53:45.0153597Z Collecting jmespath<2.0.0,>=0.7.1 (from boto3==1.*,>=1.19.5->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:45.0183829Z   Downloading jmespath-1.0.1-py3-none-any.whl.metadata (7.6 kB)
2024-08-13T17:53:45.0358302Z Collecting s3transfer<0.11.0,>=0.10.0 (from boto3==1.*,>=1.19.5->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:45.0386340Z   Downloading s3transfer-0.10.2-py3-none-any.whl.metadata (1.7 kB)
2024-08-13T17:53:45.0523359Z Collecting mpmath<1.4,>=1.1.0 (from sympy>=1.0.0->cfn-lint==1.*)
2024-08-13T17:53:45.0554953Z   Downloading mpmath-1.3.0-py3-none-any.whl.metadata (8.6 kB)
2024-08-13T17:53:45.0723719Z Collecting jsonpointer>=1.9 (from jsonpatch->cfn-lint==1.*)
2024-08-13T17:53:45.0753896Z   Downloading jsonpointer-3.0.0-py2.py3-none-any.whl.metadata (2.3 kB)
2024-08-13T17:53:45.0957255Z Collecting attrs>=22.2.0 (from jsonschema<5,>=3.2->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:45.0987776Z   Downloading attrs-24.2.0-py3-none-any.whl.metadata (11 kB)
2024-08-13T17:53:45.1232664Z Collecting jsonschema-specifications>=2023.03.6 (from jsonschema<5,>=3.2->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:45.1259427Z   Downloading jsonschema_specifications-2023.12.1-py3-none-any.whl.metadata (3.0 kB)
2024-08-13T17:53:45.1570016Z Collecting referencing>=0.28.4 (from jsonschema<5,>=3.2->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:45.1648711Z   Downloading referencing-0.35.1-py3-none-any.whl.metadata (2.8 kB)
2024-08-13T17:53:45.4035533Z Collecting rpds-py>=0.7.1 (from jsonschema<5,>=3.2->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:45.4064533Z   Downloading rpds_py-0.20.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.2 kB)
2024-08-13T17:53:45.4208973Z Collecting annotated-types>=0.4.0 (from pydantic<3,>=1.8->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:45.4240185Z   Downloading annotated_types-0.7.0-py3-none-any.whl.metadata (15 kB)
2024-08-13T17:53:45.9684856Z Collecting pydantic-core==2.20.1 (from pydantic<3,>=1.8->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:45.9808630Z   Downloading pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.6 kB)
2024-08-13T17:53:46.0099807Z Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.35.0,>=1.34.159->boto3==1.*,>=1.19.5->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:46.0131679Z   Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
2024-08-13T17:53:46.0569875Z Collecting urllib3!=2.2.0,<3,>=1.25.4 (from botocore<1.35.0,>=1.34.159->boto3==1.*,>=1.19.5->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:46.0605823Z   Downloading urllib3-2.2.2-py3-none-any.whl.metadata (6.4 kB)
2024-08-13T17:53:46.1690907Z Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.35.0,>=1.34.159->boto3==1.*,>=1.19.5->aws-sam-translator>=1.89.0->cfn-lint==1.*)
2024-08-13T17:53:46.1718038Z   Downloading six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
2024-08-13T17:53:46.1833536Z Downloading cfn_lint-1.10.1-py3-none-any.whl (4.1 MB)
2024-08-13T17:53:46.2241963Z    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.1/4.1 MB 107.0 MB/s eta 0:00:00
2024-08-13T17:53:46.2286251Z Downloading aws_sam_translator-1.89.0-py3-none-any.whl (383 kB)
2024-08-13T17:53:46.2374463Z Downloading boto3-1.34.159-py3-none-any.whl (139 kB)
2024-08-13T17:53:46.2471646Z Downloading networkx-3.3-py3-none-any.whl (1.7 MB)
2024-08-13T17:53:46.2624369Z    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 120.3 MB/s eta 0:00:00
2024-08-13T17:53:46.2656193Z Downloading PyYAML-6.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (751 kB)
2024-08-13T17:53:46.2744520Z    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 751.2/751.2 kB 81.8 MB/s eta 0:00:00
2024-08-13T17:53:46.2780232Z Downloading sympy-1.13.2-py3-none-any.whl (6.2 MB)
2024-08-13T17:53:46.3191923Z    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.2/6.2 MB 156.6 MB/s eta 0:00:00
2024-08-13T17:53:46.3224905Z Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)
2024-08-13T17:53:46.3279988Z Downloading jsonpatch-1.33-py2.py3-none-any.whl (12 kB)
2024-08-13T17:53:46.3331278Z Downloading regex-2024.7.24-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (776 kB)
2024-08-13T17:53:46.3421536Z    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 776.5/776.5 kB 86.5 MB/s eta 0:00:00
2024-08-13T17:53:46.3450016Z Downloading jsonpointer-3.0.0-py2.py3-none-any.whl (7.6 kB)
2024-08-13T17:53:46.3503735Z Downloading jsonschema-4.23.0-py3-none-any.whl (88 kB)
2024-08-13T17:53:46.3558098Z Downloading mpmath-1.3.0-py3-none-any.whl (536 kB)
2024-08-13T17:53:46.3630957Z    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 kB 67.3 MB/s eta 0:00:00
2024-08-13T17:53:46.3661668Z Downloading pydantic-2.8.2-py3-none-any.whl (423 kB)
2024-08-13T17:53:46.3752576Z Downloading pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)
2024-08-13T17:53:46.3928563Z    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 126.3 MB/s eta 0:00:00
2024-08-13T17:53:46.3956425Z Downloading annotated_types-0.7.0-py3-none-any.whl (13 kB)
2024-08-13T17:53:46.4007441Z Downloading attrs-24.2.0-py3-none-any.whl (63 kB)
2024-08-13T17:53:46.4085381Z Downloading botocore-1.34.159-py3-none-any.whl (12.5 MB)
2024-08-13T17:53:46.5044261Z    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.5/12.5 MB 131.6 MB/s eta 0:00:00
2024-08-13T17:53:46.5074990Z Downloading jmespath-1.0.1-py3-none-any.whl (20 kB)
2024-08-13T17:53:46.5128270Z Downloading jsonschema_specifications-2023.12.1-py3-none-any.whl (18 kB)
2024-08-13T17:53:46.5177355Z Downloading referencing-0.35.1-py3-none-any.whl (26 kB)
2024-08-13T17:53:46.5228592Z Downloading rpds_py-0.20.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (354 kB)
2024-08-13T17:53:46.5298012Z Downloading s3transfer-0.10.2-py3-none-any.whl (82 kB)
2024-08-13T17:53:46.5386044Z Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
2024-08-13T17:53:46.5450548Z Downloading urllib3-2.2.2-py3-none-any.whl (121 kB)
2024-08-13T17:53:46.5519500Z Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
2024-08-13T17:53:46.7321054Z Installing collected packages: mpmath, urllib3, typing-extensions, sympy, six, rpds-py, regex, pyyaml, networkx, jsonpointer, jmespath, attrs, annotated-types, referencing, python-dateutil, pydantic-core, jsonpatch, pydantic, jsonschema-specifications, botocore, s3transfer, jsonschema, boto3, aws-sam-translator, cfn-lint
2024-08-13T17:53:53.8464205Z Successfully installed annotated-types-0.7.0 attrs-24.2.0 aws-sam-translator-1.89.0 boto3-1.34.159 botocore-1.34.159 cfn-lint-1.10.1 jmespath-1.0.1 jsonpatch-1.33 jsonpointer-3.0.0 jsonschema-4.23.0 jsonschema-specifications-2023.12.1 mpmath-1.3.0 networkx-3.3 pydantic-2.8.2 pydantic-core-2.20.1 python-dateutil-2.9.0.post0 pyyaml-6.0.2 referencing-0.35.1 regex-2024.7.24 rpds-py-0.20.0 s3transfer-0.10.2 six-1.16.0 sympy-1.13.2 typing-extensions-4.12.2 urllib3-2.2.2
2024-08-13T17:53:54.2948617Z ##[debug]Node Action run completed with exit code 0
2024-08-13T17:53:54.2951794Z ##[debug]Finishing: Install cfn-lint
2024-08-13T17:53:54.2959196Z ##[debug]Evaluating condition for step: 'Run cfn-lint'
2024-08-13T17:53:54.2961036Z ##[debug]Evaluating: success()
2024-08-13T17:53:54.2961463Z ##[debug]Evaluating success:
2024-08-13T17:53:54.2961896Z ##[debug]=> true
2024-08-13T17:53:54.2962327Z ##[debug]Result: true
2024-08-13T17:53:54.2962906Z ##[debug]Starting: Run cfn-lint
2024-08-13T17:53:54.2973441Z ##[debug]Loading inputs
2024-08-13T17:53:54.3008322Z ##[debug]Loading env
2024-08-13T17:53:54.3045108Z ##[group]Run cfn-lint --version
2024-08-13T17:53:54.3045507Z �[36;1mcfn-lint --version�[0m
2024-08-13T17:53:54.3045808Z �[36;1m# Ignored checks:�[0m
2024-08-13T17:53:54.3046214Z �[36;1m# - W3002: Code may only work with `package`: We do that.�[0m
2024-08-13T17:53:54.3046980Z �[36;1m# Note that the "weird" invocation is done to ignore the error code from xargs/cfn-lint, because that will stop�[0m
2024-08-13T17:53:54.3047672Z �[36;1m# Github action execution immediately.�[0m
2024-08-13T17:53:54.3048426Z �[36;1mexit=$(sh -c "find aws -name '*.cfn.yaml' | xargs cfn-lint --ignore-checks=W3002 -f sarif > cfn-lint.sarif.in; echo $?")�[0m
2024-08-13T17:53:54.3049172Z �[36;1mecho "::set-output name=cfn-lint-exit::${exit}"�[0m
2024-08-13T17:53:54.3049677Z �[36;1m# Drop out the empty `helpUri` inside the Sarif output, see�[0m
2024-08-13T17:53:54.3050289Z �[36;1m# https://github.com/aws-cloudformation/cfn-lint/pull/2276 for details�[0m
2024-08-13T17:53:54.3051021Z �[36;1mjq 'del(.runs[].tool.driver.rules[].helpUri|select(.==""))' <cfn-lint.sarif.in >cfn-lint.sarif�[0m
2024-08-13T17:53:54.3246802Z shell: /usr/bin/bash -e {0}
2024-08-13T17:53:54.3247135Z ##[endgroup]
2024-08-13T17:53:54.3393498Z ##[debug]/usr/bin/bash -e /home/runner/work/_temp/667c213b-7818-4af3-9122-94b3f8c15a7f.sh
2024-08-13T17:53:54.9129132Z cfn-lint 1.10.1
2024-08-13T17:53:59.9823845Z Traceback (most recent call last):
2024-08-13T17:53:59.9825626Z   File "/tmp/setup-cfn-lint-Pd1H6K/.venv/lib/python3.10/site-packages/cfnlint/formatters/sarif.py", line 45, in print_matches
2024-08-13T17:53:59.9826994Z     import sarif_om as sarif
2024-08-13T17:53:59.9827668Z ModuleNotFoundError: No module named 'sarif_om'
2024-08-13T17:53:59.9828145Z 
2024-08-13T17:53:59.9828532Z The above exception was the direct cause of the following exception:
2024-08-13T17:53:59.9829085Z 
2024-08-13T17:53:59.9829260Z Traceback (most recent call last):
2024-08-13T17:53:59.9830011Z   File "/tmp/setup-cfn-lint-Pd1H6K/bin/cfn-lint", line 8, in <module>
2024-08-13T17:53:59.9831410Z     sys.exit(main())
2024-08-13T17:53:59.9832403Z   File "/tmp/setup-cfn-lint-Pd1H6K/.venv/lib/python3.10/site-packages/cfnlint/runner.py", line 451, in main
2024-08-13T17:53:59.9833318Z     runner.cli()
2024-08-13T17:53:59.9834261Z   File "/tmp/setup-cfn-lint-Pd1H6K/.venv/lib/python3.10/site-packages/cfnlint/runner.py", line 442, in cli
2024-08-13T17:53:59.9835256Z     self._cli_output(list(self.run()))
2024-08-13T17:53:59.9836390Z   File "/tmp/setup-cfn-lint-Pd1H6K/.venv/lib/python3.10/site-packages/cfnlint/runner.py", line 330, in _cli_output
2024-08-13T17:53:59.9837640Z     output = formatter.print_matches(matches, self.rules, config=self.config)
2024-08-13T17:53:59.9839097Z   File "/tmp/setup-cfn-lint-Pd1H6K/.venv/lib/python3.10/site-packages/cfnlint/formatters/sarif.py", line 48, in print_matches
2024-08-13T17:53:59.9840334Z     raise ImportError("Missing optional dependencies sarif") from e
2024-08-13T17:53:59.9841074Z ImportError: Missing optional dependencies sarif
2024-08-13T17:54:00.1383722Z ::set-output name=cfn-lint-exit::0
2024-08-13T17:54:00.1400106Z ##[warning]The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2024-08-13T17:54:00.1411465Z ##[debug]='0'
2024-08-13T17:54:00.1621699Z ##[debug]Finishing: Run cfn-lint

GitHub Actions Runner configuration (please complete the following information):

  • OS: Ubuntu 22.04.4 (workflow doesn't specify it, but logs show it)
  • Inputs: none when installing, see below for invocation
  • Version: scottbrenner/cfn-lint-action@v2 (based on logs: 4f8adb0)

Additional context

Bit of a guess, but: aws-cloudformation/cfn-lint#3452 (comment) hints that they use "extra keywords", and it seems the sarif dependency is optional -- so depending on cfn-lint[full] likely fixes things.
Also, if that is true the hint from #274 (comment) should work: Install the whole thing afterwards.

Actual workflow invocation of cfn-lint:

      - name: Run cfn-lint
        run: |
          cfn-lint --version
          # Ignored checks:
          # - W3002: Code may only work with `package`: We do that.
          # Note that the "weird" invocation is done to ignore the error code from xargs/cfn-lint, because that will stop
          # Github action execution immediately.
          exit=$(sh -c "find aws -name '*.cfn.yaml' | xargs cfn-lint --ignore-checks=W3002 -f sarif > cfn-lint.sarif.in; echo $?")
          echo "::set-output name=cfn-lint-exit::${exit}"
          # Drop out the empty `helpUri` inside the Sarif output, see 
          # https://github.com/aws-cloudformation/cfn-lint/pull/2276 for details
          jq 'del(.runs[].tool.driver.rules[].helpUri|select(.==""))' <cfn-lint.sarif.in >cfn-lint.sarif
@ankon ankon added the bug Something isn't working label Aug 13, 2024
@ankon
Copy link
Author

ankon commented Aug 13, 2024

Installing with [full] might be the quickest fix for the general case, in our situation we will first try whether [sarif] works well enough: aws-cloudformation/cfn-lint#3454

@ankon
Copy link
Author

ankon commented Aug 13, 2024

Confirmed: The following diff to our workflow fixes things.

diff --git a/.github/workflows/cfn-lint.yml b/.github/workflows/cfn-lint.yml
index 005d89a60..246650fc1 100644
--- a/.github/workflows/cfn-lint.yml
+++ b/.github/workflows/cfn-lint.yml
@@ -19,6 +19,12 @@ jobs:
       - name: Install cfn-lint
         uses: scottbrenner/cfn-lint-action@v2
 
+      - name: Find Python Virtual Env
+        run: echo "VIRTUAL_ENV=\"$(find /tmp/setup-cfn-lint-*/.venv/bin/python -name 'python' -maxdepth 1)\"" >> $GITHUB_ENV
+
+      - name: Install cfn-lint optional dependencies
+        run: ${{ env.VIRTUAL_ENV }} -m pip install --upgrade 'cfn-lint[sarif]==1.*'
+
       - name: Run cfn-lint
         run: |
           cfn-lint --version

@ScottBrenner
Copy link
Owner

Thanks for reporting and suggesting the fix, https://github.com/ScottBrenner/cfn-lint-action/releases/tag/v2.4.4 includes this and has been tagged as v2, please try again

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

Successfully merging a pull request may close this issue.

2 participants