Skip to content

Commit

Permalink
feat: add CircleCI, Gitlab CI snippet for cfn-lint (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnu-deepsource authored Feb 6, 2024
1 parent 0c203c5 commit d824f2b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
29 changes: 29 additions & 0 deletions analyzers/cfn-lint/CI/circleci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2.1

jobs:
run-cfn-lint:
docker:
- image: cimg/python:3.12
steps:
- checkout
- run:
name: Install cfn-lint
command: |
python -m pip install --upgrade pip
pip3 install cfn-lint
- run:
name: Run cfn-lint
command: |
cfn-lint -t ./**/*.yaml -f sarif > cfn-lint.sarif || true
- run:
name: Upload SARIF report to DeepSource
command: |
# Install the DeepSource CLI
curl https://deepsource.io/cli | sh
# Send the report to DeepSource
./bin/deepsource report --analyzer cfn-lint --analyzer-type community --value-file ./cfn-lint.sarif
workflows:
run-cfn-lint-workflow:
jobs:
- run-cfn-lint
14 changes: 14 additions & 0 deletions analyzers/cfn-lint/CI/gitlab-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
stages:
- scan

scan:
stage: scan
image: python:latest # Using Python image because cfn-lint is a Python package
before_script:
- pip install cfn-lint # Install cfn-lint
script:
- cfn-lint -t ./**/*.yaml -f sarif > cfn-lint.sarif || true # Run cfn-lint and generate SARIF report
- curl -sSL https://deepsource.io/cli | sh # Install DeepSource CLI
- ./bin/deepsource report --analyzer cfn-lint --analyzer-type community --value-file ./cfn-lint.sarif # Upload SARIF report to DeepSource
rules:
- if: $CI_PIPELINE_SOURCE == "push"

0 comments on commit d824f2b

Please sign in to comment.