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

Iactest #1111

Closed
wants to merge 8 commits into from
Closed

Iactest #1111

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/snyk_code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Snyk Code Test"

on:
push:
branches:
- master

jobs:
Pipeline-Job:
# Configure Environment
name: 'Snyk Test'
runs-on: ubuntu-latest
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

steps:
# Checkout Code
- name: Checkout Code
uses: actions/checkout@v1

# Install and Authenticate to Snyk
- name: Install Snyk & Authenticate
run: |
sudo npm install -g snyk
snyk auth ${SNYK_TOKEN}
# Run Snyk Code
- name: Run Snyk Code
run: |
snyk code test --severity-threshold=high --sarif >> results.sarif
continue-on-error: true
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v1
with:
# Path to SARIF file relative to the root of the repository
sarif_file: results.sarif
27 changes: 27 additions & 0 deletions .github/workflows/snyk_iac_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
pull_request:

jobs:
security:
runs-on: ubuntu-latest
steps:
- name: Run Snyk to check Kubernetes manifest file for issues
uses: snyk/actions/iac@master
continue-on-error: true
json: true
serif: false
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
file: goof-deployment.yaml
- name: Parse results
id: snyk_results
uses: b4den/snyk-to-markdown-action@master
with:
file-name: snyk.json
- name: Comment PR
uses: b4den/comment-pr-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: "${{ steps.snyk_results.outputs.vuln_text }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ node_modules
sass
config.rb
npm-debug.log

.dccache
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# FROM node:6-stretch
FROM node:14.1.0
FROM node:8
LABEL org.opencontainers.image.source="https://github.com/oliversnyk/goof"
LABEL io.snyk.containers.image.dockerfile="/Dockerfile"

RUN mkdir /usr/src/goof
RUN mkdir /tmp/extracted_files
Expand Down
17 changes: 17 additions & 0 deletions bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
image: node:10.15.3

pipelines:
default:
- step:
name: Build and Test
caches:
- node
script:
- npm install
- pipe: snyk/snyk-scan:0.4.6
variables:
SNYK_TOKEN: $SNYK_TOKEN
LANGUAGE: "npm"
SEVERITY_THRESHOLD: "high"
DONT_BREAK_BUILD: "false"
MONITOR: "true"
47 changes: 47 additions & 0 deletions goof-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
apiVersion: v1
kind: Service
metadata:
name: goof
spec:
ports:
- name: "3001"
port: 3001
targetPort: 3001
nodePort: 30001 #port exposed on localhost
- name: "9229"
port: 9229
targetPort: 9229
nodePort: 30002
selector:
app: goof
type: LoadBalancer


---
apiVersion: apps/v1
kind: Deployment
metadata:
name: goof
spec:
replicas: 2
selector:
matchLabels:
app: goof
template:
metadata:
labels:
app: goof
spec:
containers:
- image: oliversnyk/docker-goof
name: goof
ports:
- containerPort: 3001
- containerPort: 9229
resources: {}
env:
- name: "DOCKER"
value: "1"
restartPolicy: Always

37 changes: 37 additions & 0 deletions goof-mongo-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
apiVersion: v1
kind: Service
metadata:
name: goof-mongo
spec:
ports:
- name: "27017"
port: 27017
targetPort: 27017
selector:
app: goof-mongo


---
apiVersion: apps/v1
kind: Deployment
metadata:
name: goof-mongo
spec:
replicas: 1
selector:
matchLabels:
app: goof-mongo
template:
metadata:
labels:
app: goof-mongo
spec:
containers:
- image: mongo
name: goof-mongo
ports:
- containerPort: 27017
resources: {}
restartPolicy: Always

11 changes: 11 additions & 0 deletions namespace-test01.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"apiVersion": "v1",
"kind": "Namespace",
"metadata": {
"name": "test01",
"labels": {
"name": "development"
}
}
}

Loading