jarulraj/sqlcheck

Feature / Enhancement Request To Exit With Status Code 1 When Results are Found

sinktech opened this issue · 1 comments

Thanks for this project. I think it is awesome. So awesome in fact, that I wanted to throw it in a CI/CD pipeline. Would it be possible to update the application to exit with status 1 if results are returned? This will allow pipeline jobs to properly fail if there are high risk items detected vs the job always passing.

Attached is a Dockerfile I used to create an image ( Dockerfile.txt )

GitLab job looks something like this:

sql_check:
  stage: static_analysis
  image:
    name: <ACCOUNT>.dkr.ecr.<REGION>.amazonaws.com/cicd/sqlcheck:latest
  before_script:
    - git fetch
    - git checkout $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
    - sqlcheck --version
  script:
    - git diff --name-only $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
      origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME -c 'deployment/sql/*.sql' | xargs -I % -n1 sqlcheck -c -r 3 -v -f %
  when: always
  allow_failure: false
  only:
    refs:
      - merge_requests
    changes:
      - "deployment/sql/**/*.sql"
  except:
    refs:
      - master
      - /^release\/.*$/I

Thank you for the consideration.

resolved by #22, pending release