Upgrading to Golang 1.16.4 and fixed drone.yml format.

This commit is contained in:
James Wells 2021-08-09 17:47:44 -07:00
parent 610ae5eed4
commit d12a59fd13
No known key found for this signature in database
GPG key ID: A31F808006BEE150
2 changed files with 60 additions and 61 deletions

View file

@ -4,80 +4,80 @@ type: docker
name: validation
platform:
arch: amd64
arch: amd64
clone:
depth: 1
depth: 1
volumes:
- name: dockersock
host:
path: /run/docker.sock
- name: dockersock
host:
path: /run/docker.sock
steps:
- name: Notify Datadog That We Are Starting
image: masci/drone-datadog
settings:
api_key:
from_secret: Datadog
events:
- title: "Begin Build: ${DRONE_REPO}"
text: "Build ${DRONE_BUILD_NUMBER}(${DRONE_COMMIT_LINK})"
alert_type: "info"
- name: Notify Datadog That We Are Starting
image: masci/drone-datadog
settings:
api_key:
from_secret: Datadog
events:
- title: "Begin Build: ${DRONE_REPO}"
text: "Build ${DRONE_BUILD_NUMBER}(${DRONE_COMMIT_LINK})"
alert_type: "info"
- name: Validate code base and dependencies
image: dragonheim/golang:1.16.4
volumes:
- name: dockersock
path: /var/run/docker.sock
environment:
TRIVY_QUIET: true
TRIVY_LIGHT: true
TRIVY_FORMAT: table
TRIVY_IGNORE_UNFIXED: true
TRIVY_NO_PROGRESS: true
commands:
### Populate temporary container with tools / files we will need for building and testing
- apk add --no-cache zeromq-dev zeromq
# - curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.18.2
- name: Validate code base and dependencies
image: dragonheim/golang:1.16.4
volumes:
- name: dockersock
path: /var/run/docker.sock
environment:
TRIVY_QUIET: true
TRIVY_LIGHT: true
TRIVY_FORMAT: table
TRIVY_IGNORE_UNFIXED: true
TRIVY_NO_PROGRESS: true
commands:
### Populate temporary container with tools / files we will need for building and testing
- apk add --no-cache zeromq-dev zeromq
# - curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.18.2
### Format the go code. Go does not care about it, but it helps to ensure everything is formated the same.
- go fmt ./...
### Format the go code. Go does not care about it, but it helps to ensure everything is formated the same.
- go fmt ./...
### Perform a basic lint of the code, we do this after formatting, just in case there are edge cases with the formatting.
- go vet ./...
### Perform a basic lint of the code, we do this after formatting, just in case there are edge cases with the formatting.
- go vet ./...
### Run a security check and warn us about lower level vulnerabilities
- trivy fs --exit-code 0 --severity UNKNOWN,LOW,MEDIUM .
### Run a security check and warn us about lower level vulnerabilities
- trivy fs --exit-code 0 --severity UNKNOWN,LOW,MEDIUM .
### Re-run the scan, but this time looking for higher level vulnerabilities that we want to block for.
- trivy fs --skip-update --exit-code 1 --severity CRITICAL,HIGH .
### Re-run the scan, but this time looking for higher level vulnerabilities that we want to block for.
- trivy fs --skip-update --exit-code 1 --severity CRITICAL,HIGH .
### Perform unit tests
# - @TODO I really don't know how to do unit tests. Will need to figure this out eventually.
### Perform unit tests
# - @TODO I really don't know how to do unit tests. Will need to figure this out eventually.
### Build test container.
# - docker buildx build --platform linux/arm/v7,linux/amd64,linux/arm64 --progress plain -t ${DRONE_REPO}:${DRONE_COMMIT} -f docker/Dockerfile .
- docker buildx build --platform linux/amd64 --progress plain -t ${DRONE_REPO}:${DRONE_COMMIT} -f docker/Dockerfile .
### Build test container.
# - docker buildx build --platform linux/arm/v7,linux/amd64,linux/arm64 --progress plain -t ${DRONE_REPO}:${DRONE_COMMIT} -f docker/Dockerfile .
- docker buildx build --platform linux/amd64 --progress plain -t ${DRONE_REPO}:${DRONE_COMMIT} -f docker/Dockerfile .
### Run a security check and warn us about lower level vulnerabilities
- trivy image --skip-update --exit-code 0 --severity UNKNOWN,LOW,MEDIUM,HIGH ${DRONE_REPO}:${DRONE_COMMIT}
### Run a security check and warn us about lower level vulnerabilities
- trivy image --skip-update --exit-code 0 --severity UNKNOWN,LOW,MEDIUM,HIGH ${DRONE_REPO}:${DRONE_COMMIT}
### Re-run the scan, but this time looking for critical vulnerabilities that we want to block for.
- trivy image --skip-update --exit-code 1 --severity CRITICAL ${DRONE_REPO}:${DRONE_COMMIT}
### Re-run the scan, but this time looking for critical vulnerabilities that we want to block for.
- trivy image --skip-update --exit-code 1 --severity CRITICAL ${DRONE_REPO}:${DRONE_COMMIT}
# - name: Create Test Environment
# image: dragonheim/terraform:latest
# - name: Create Test Environment
# image: dragonheim/terraform:latest
- name: Notify Datadog That We Have Completed
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
- name: Notify Datadog That We Have Completed
image: masci/drone-datadog
settings:
api_key:
from_secret: Datadog
events:
- title: "Build failure on ${DRONE_STAGE_ARCH}"
text: "Build ${DRONE_BUILD_NUMBER}"
alert_type: "error"
when:
status:
- failure

1
go.sum
View file

@ -49,7 +49,6 @@ github.com/zclconf/go-cty v1.8.3 h1:48gwZXrdSADU2UW9eZKHprxAI7APZGW9XmExpJpSjT0=
github.com/zclconf/go-cty v1.8.3/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo=
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=