Browse Source

add-security-scanners

pull/9/head
fedy95 4 years ago
parent
commit
8de92f6266
  1. 58
      .drone.yml

58
.drone.yml

@ -16,6 +16,7 @@ steps:
- yamllint -c /yamllint/relaxed.yaml . - yamllint -c /yamllint/relaxed.yaml .
when: when:
event: pull_request event: pull_request
- name: lint json - name: lint json
image: registry.fedy95.com/baseimage-jsonlint:latest image: registry.fedy95.com/baseimage-jsonlint:latest
commands: commands:
@ -23,6 +24,63 @@ steps:
when: when:
event: pull_request event: pull_request
- name: build image
image: docker:dind
volumes:
- name: dockersock
path: /var/run/docker.sock
environment:
REGISTRY: registry.fedy95.com
commands:
- docker build -t "$REGISTRY"/baseimage-jsonlint:$DRONE_COMMIT_SHA image -f image/Dockerfile
when:
event: pull_request
- name: trivy security scan
image: aquasec/trivy
volumes:
- name: dockersock
path: /var/run/docker.sock
environment:
REGISTRY: registry.fedy95.com
commands:
- "trivy \
--exit-code 1 \
--format json \
--no-progress \
$REGISTRY/baseimage-jsonlint:$DRONE_COMMIT_SHA"
when:
event: pull_request
- name: grype security scan
image: docker:dind
volumes:
- name: dockersock
path: /var/run/docker.sock
environment:
REGISTRY: registry.fedy95.com
commands:
- apk add --no-cache curl
- "curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | \
sh -s -- -b /usr/local/bin"
- "grype $REGISTRY/baseimage-jsonlint:$DRONE_COMMIT_SHA \
--scope all-layers \
--fail-on=critical \
--verbose"
when:
event: pull_request
- name: cleanup
image: docker:dind
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- docker rmi registry.fedy95.com/baseimage-jsonlint:$DRONE_COMMIT_SHA
when:
event: pull_request
status: [ success, failure ]
- name: release - name: release
image: docker:dind image: docker:dind
volumes: volumes: