anusha94 has triggered Scan Action 🚀 #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CDK Scan Pipeline Demo | |
run-name: ${{ github.actor }} has triggered Scan Action 🚀 | |
on: | |
pull_request: | |
branches: | |
- "main" | |
push: | |
branches: | |
- "main" | |
env: | |
NIRMATA_TOKEN: ${{ secrets.NIRMATA_TOKEN }} | |
NIRMATA_URL: ${{ secrets.NIRMATA_URL }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} | |
jobs: | |
NCTL-Scan-CDK: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- name: Checkout PR branch | |
uses: actions/checkout@v3 | |
with: | |
# Checks out the repository linked to the PR | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
# Checks out the branch from the PR | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: NCTL-scan-installer | |
uses: supplypike/setup-bin@v4 | |
with: | |
uri: 'https://nirmata-downloads.s3.us-east-2.amazonaws.com/nctl/nctl_4.3.5/nctl_4.3.5_linux_386.zip' | |
name: 'nctl' | |
version: '4.3.5' | |
- name: Check nctl version | |
run: | | |
nctl version | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' # Specify the Node.js version you want to use | |
- name: Install dependencies | |
run: | | |
npm install | |
- name: Install Python dependencies and CDK | |
run: | | |
python -m pip install --upgrade pip | |
cd sample-cdk | |
pip install -r requirements.txt | |
npm install -g aws-cdk | |
- name: CDK Synth | |
run: | | |
cd sample-cdk | |
cdk synth --json | |
- name: Checkout policies repo | |
uses: actions/checkout@v3 | |
with: | |
repository: nirmata/demo-policies | |
- name: nctl login | |
run: nctl login nch --url $NIRMATA_URL --userid [email protected] --token $NIRMATA_TOKEN | |
- name: NCTL Scan Repository for CDK | |
run: | | |
pwd | |
ls /home/runner/work | |
ls | |
nctl scan json -r sample-cdk/cdk.out/MyEcsStack.template.json --policies demo-policies/cdk-policies/best-practices --details --publish | |
- run: echo "🍏 This job's status is ${{ job.status }}." |