Skip to content

Commit

Permalink
Adding CI Tests (#330)
Browse files Browse the repository at this point in the history
* Adding Trivy scan to the GitHub repo

* Testing the added action

* Testing Trivy-Scan

* testing trivy action

* Testing Trivy scan

* Testing Trivy

* testing trivy

* Testing Trivy

* Testing Trivy

* Testing Trivy

* Testing Trivy

* Final Trivy test

* Final Trivy Test 2

* Creating a Lint Action

* Testint Lint

* Testing lint

* testint lint

* added all folders to lint test

* test new scope for lint

* Added CI Tests

---------

Co-authored-by: Victor Saad Bueno Valadares <Victor.Valadares@microsoft.com>
  • Loading branch information
vivalada and Victor Saad Bueno Valadares authored Jan 15, 2025
1 parent b07f2bf commit e2d83f6
Show file tree
Hide file tree
Showing 2 changed files with 171 additions and 0 deletions.
143 changes: 143 additions & 0 deletions .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
---
name: Code Review

on:
pull_request:
branches:
- main
workflow_dispatch: {}

jobs:
super-linter:
name: GitHub Super Linter
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Lint AVS-Landing-Zone directory
uses: docker://github/super-linter:v4.9.5
env:
# Only lint changed files
VALIDATE_ALL_CODEBASE: true
# Need to define main branch as default
# is set to master in super-linter
DEFAULT_BRANCH: main
# Enable setting the status of each individual linter
# run in the Checks section of a pull request
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Only the following files will be linted:
FILTER_REGEX_INCLUDE: .*AVS-Landing-Zone\/.*
# The following linter types will be enabled:
VALIDATE_ARM: true
VALIDATE_JSON: true
VALIDATE_TERRAFORM_FMT: true
VALIDATE_MARKDOWN: true
VALIDATE_POWERSHELL: true
# Additional settings:
# Disable errors to only generate a report
DISABLE_ERRORS: true
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: true

- name: Lint Brownfield directory
uses: docker://github/super-linter:v4.9.5
env:
# Only lint changed files
VALIDATE_ALL_CODEBASE: true
# Need to define main branch as default
# is set to master in super-linter
DEFAULT_BRANCH: main
# Enable setting the status of each individual linter
# run in the Checks section of a pull request
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Only the following files will be linted:
FILTER_REGEX_INCLUDE: .*Brownfield\/.*
# The following linter types will be enabled:
VALIDATE_ARM: true
VALIDATE_JSON: true
VALIDATE_TERRAFORM_FMT: true
VALIDATE_MARKDOWN: true
VALIDATE_POWERSHELL: true
# Additional settings:
# If a shell script is not executable, the bash-exec
# linter will report an error when set to true
DISABLE_ERRORS: true
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: true

- name: Lint hcx directory
uses: docker://github/super-linter:v4.9.5
env:
# Only lint changed files
VALIDATE_ALL_CODEBASE: true
# Need to define main branch as default
# is set to master in super-linter
DEFAULT_BRANCH: main
# Enable setting the status of each individual linter
# run in the Checks section of a pull request
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Only the following files will be linted:
FILTER_REGEX_INCLUDE: .*hcx\/.*
# The following linter types will be enabled:
VALIDATE_ARM: true
VALIDATE_JSON: true
VALIDATE_TERRAFORM_FMT: true
VALIDATE_MARKDOWN: true
VALIDATE_POWERSHELL: true
# Additional settings:
# If a shell script is not executable, the bash-exec
# linter will report an error when set to true
DISABLE_ERRORS: true
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: true

- name: Lint Network Design Guide directory
uses: docker://github/super-linter:v4.9.5
env:
# Only lint changed files
VALIDATE_ALL_CODEBASE: true
# Need to define main branch as default
# is set to master in super-linter
DEFAULT_BRANCH: main
# Enable setting the status of each individual linter
# run in the Checks section of a pull request
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Only the following files will be linted:
FILTER_REGEX_INCLUDE: .*Network Design Guide\/.*
# The following linter types will be enabled:
VALIDATE_ARM: true
VALIDATE_JSON: true
VALIDATE_TERRAFORM_FMT: true
VALIDATE_MARKDOWN: true
VALIDATE_POWERSHELL: true
# Additional settings:
# If a shell script is not executable, the bash-exec
# linter will report an error when set to true
DISABLE_ERRORS: true
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: true

- name: Lint terraform directory
uses: docker://github/super-linter:v4.9.5
env:
# Only lint changed files
VALIDATE_ALL_CODEBASE: true
# Need to define main branch as default
# is set to master in super-linter
DEFAULT_BRANCH: main
# Enable setting the status of each individual linter
# run in the Checks section of a pull request
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Only the following files will be linted:
FILTER_REGEX_INCLUDE: .*terraform\/.*
# The following linter types will be enabled:
VALIDATE_ARM: true
VALIDATE_JSON: true
VALIDATE_TERRAFORM_FMT: true
VALIDATE_MARKDOWN: true
VALIDATE_POWERSHELL: true
# Additional settings:
# If a shell script is not executable, the bash-exec
# linter will report an error when set to true
DISABLE_ERRORS: true
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: true
28 changes: 28 additions & 0 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: trivy-scanning
on:
push:
branches:
- main
pull_request:

jobs:
trivy-scanning-job:
name: trivy-sec-scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@0.28.0
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'HIGH,CRITICAL'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'

0 comments on commit e2d83f6

Please sign in to comment.