---
kind: pipeline
type: docker
name: validation

platform:
  arch: amd64

clone:
  depth: 1

volumes:
  - name: dockersock
    host:
      path: /run/docker.sock

steps:
  - name: Format Code
    image: golang:1.16-alpine3.13
    # volumes:
    #   - name: dockersock
    #     path: /var/run/docker.sock
    commands:
      - go fmt ./...
      - go vet ./...
      - curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.18.2
      - trivy repo ${DRONE_GIT_HTTP_URL}

#   - name: Send Status To Datadog
#     image: masci/drone-datadog
#     settings:
#       api_key:
#         from_secret: Datadog
#       events:
#         - title: "Build failure on amd64"
#           text: "Build ${DRONE_BUILD_NUMBER}"
#           alert_type: "error"
#     when:
#       status:
#         - failure
#