fix: [CI SKIP] Converting various files to the same basic format.

This commit is contained in:
James Wells 2021-06-03 16:15:26 -07:00
parent 8f8ac47155
commit 0cf7f36f17
Signed by: jwells
GPG key ID: 73196D10B8E65666
9 changed files with 129 additions and 132 deletions

View file

@ -4,78 +4,78 @@ type: docker
name: validation name: validation
platform: platform:
arch: amd64 arch: amd64
clone: clone:
depth: 1 depth: 1
volumes: volumes:
- name: dockersock - name: dockersock
host: host:
path: /run/docker.sock path: /run/docker.sock
steps: steps:
- name: Notify Datadog That We Are Starting - name: Notify Datadog That We Are Starting
image: masci/drone-datadog image: masci/drone-datadog
settings: settings:
api_key: api_key:
from_secret: Datadog from_secret: Datadog
events: events:
- title: "Begin Build: ${DRONE_REPO}" - title: "Begin Build: ${DRONE_REPO}"
text: "Build ${DRONE_BUILD_NUMBER}(${DRONE_COMMIT_LINK})" text: "Build ${DRONE_BUILD_NUMBER}(${DRONE_COMMIT_LINK})"
alert_type: "info" alert_type: "info"
- name: Validate code base and dependencies - name: Validate code base and dependencies
image: dragonheim/golang:1.16.4 image: dragonheim/golang:1.16.4
volumes: volumes:
- name: dockersock - name: dockersock
path: /var/run/docker.sock path: /var/run/docker.sock
environment: environment:
TRIVY_QUIET: true TRIVY_QUIET: true
TRIVY_LIGHT: true TRIVY_LIGHT: true
TRIVY_FORMAT: table TRIVY_FORMAT: table
TRIVY_IGNORE_UNFIXED: true TRIVY_IGNORE_UNFIXED: true
TRIVY_NO_PROGRESS: true TRIVY_NO_PROGRESS: true
commands: commands:
### Populate temporary container with tools / files we will need for building and testing ### Populate temporary container with tools / files we will need for building and testing
- apk add --no-cache zeromq-dev zeromq - 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 # - 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. ### Format the go code. Go does not care about it, but it helps to ensure everything is formated the same.
- go fmt ./... - go fmt ./...
### Perform a basic lint of the code, we do this after formatting, just in case there are edge cases with the formatting. ### Perform a basic lint of the code, we do this after formatting, just in case there are edge cases with the formatting.
- go vet ./... - go vet ./...
### Run a security check and warn us about lower level vulnerabilities ### Run a security check and warn us about lower level vulnerabilities
- trivy fs --exit-code 0 --severity UNKNOWN,LOW,MEDIUM . - 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. ### 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 . - trivy fs --skip-update --exit-code 1 --severity CRITICAL,HIGH .
### Perform unit tests ### Perform unit tests
# - @TODO I really don't know how to do unit tests. Will need to figure this out eventually. # - @TODO I really don't know how to do unit tests. Will need to figure this out eventually.
### Build test container. ### 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/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 . - 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 ### 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} - 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. ### 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} - trivy image --skip-update --exit-code 1 --severity CRITICAL ${DRONE_REPO}:${DRONE_COMMIT}
- name: Notify Datadog That We Have Completed - name: Notify Datadog That We Have Completed
image: masci/drone-datadog image: masci/drone-datadog
settings: settings:
api_key: api_key:
from_secret: Datadog from_secret: Datadog
events: events:
- title: "Build failure on amd64" - title: "Build failure on amd64"
text: "Build ${DRONE_BUILD_NUMBER}" text: "Build ${DRONE_BUILD_NUMBER}"
alert_type: "error" alert_type: "error"
when: when:
status: status:
- failure - failure

View file

@ -5,9 +5,6 @@ import (
"unicode/utf8" "unicode/utf8"
) )
/*
* ptESC is @TODO
*/
const ( const (
ptESC = iota ptESC = iota
ptSTR ptSTR

View file

@ -1,9 +1,9 @@
provider "aws" { provider "aws" {
alias = "us-west-2" alias = "us-west-2"
region = "us-west-2" region = "us-west-2"
} }
provider "aws" { provider "aws" {
alias = "us-east-1" alias = "us-east-1"
region = "us-east-1" region = "us-east-1"
} }

View file

@ -1,38 +1,38 @@
# variable "vpc_id" {} # variable "vpc_id" {}
data "aws_vpc" "selected" { data "aws_vpc" "selected" {
id = var.vpc_id id = var.vpc_id
} }
variable "regional_cidr_blocks" { variable "regional_cidr_blocks" {
description = "A simple map of subnets used by region" description = "A simple map of subnets used by region"
type = map type = map
default = { default = {
"us-west-2a-private" = "10.172.64.0/23", "us-west-2a-private" = "10.172.64.0/23",
"us-west-2b-private" = "10.172.66.0/23", "us-west-2b-private" = "10.172.66.0/23",
"us-west-2a-public" = "10.172.68.0/26", "us-west-2a-public" = "10.172.68.0/26",
"us-west-2b-public" = "10.172.68.64/26", "us-west-2b-public" = "10.172.68.64/26",
"us-east-1a-private" = "10.172.0.0/23", "us-east-1a-private" = "10.172.0.0/23",
"us-east-1b-private" = "10.172.2.0/23", "us-east-1b-private" = "10.172.2.0/23",
"us-east-1a-public" = "10.172.4.0/26", "us-east-1a-public" = "10.172.4.0/26",
"us-east-1b-public" = "10.172.4.64/26" "us-east-1b-public" = "10.172.4.64/26"
} }
} }
resource "aws_subnet" "aza-private" { resource "aws_subnet" "aza-private" {
depends_on = [data.aws_vpc.selected] depends_on = [data.aws_vpc.selected]
vpc_id = data.aws_vpc.id vpc_id = data.aws_vpc.id
availability_zone = format("%sa", var.region) availability_zone = format("%sa", var.region)
cidr_block = var.regional_cidr_blocks[ cidr_block = var.regional_cidr_blocks[
format("%sa-private", var.region) format("%sa-private", var.region)
] ]
tags = merge( tags = merge(
var.extra_tags, var.extra_tags,
{ {
Name = "aza-private" Name = "aza-private"
tier = "private" tier = "private"
} }
) )
} }
# resource "aws_subnet" "aza-public" { # resource "aws_subnet" "aza-public" {

View file

@ -1,9 +1,9 @@
variable "extra_tags" { variable "extra_tags" {
description = "Tags required on all resources" description = "Tags required on all resources"
type = map type = map
default = { default = {
"org" = "dragonheim" "org" = "dragonheim"
"service" = "gagent" "service" = "gagent"
"maintained_by" = "jwells@dragonheim.net" "maintained_by" = "jwells@dragonheim.net"
} }
} }

View file

@ -2,22 +2,22 @@ variable "region" {}
variable "provider_alias" {} variable "provider_alias" {}
variable "regional_vpc_cidr" { variable "regional_vpc_cidr" {
description = "A simple map of VPC subnets used by region" description = "A simple map of VPC subnets used by region"
type = map type = map
default = { default = {
"us-west-2" = "10.172.64.0/19", "us-west-2" = "10.172.64.0/19",
"us-east-1" = "10.172.0.0/19", "us-east-1" = "10.172.0.0/19",
} }
} }
resource "aws_vpc" "gagent" { resource "aws_vpc" "gagent" {
instance_tenancy = "default" instance_tenancy = "default"
enable_dns_support = true enable_dns_support = true
cidr_block = var.regional_vpc_cidr[var.region] cidr_block = var.regional_vpc_cidr[var.region]
tags = merge( tags = merge(
var.extra_tags, var.extra_tags,
{ {
Name = "gagent" Name = "gagent"
} }
) )
} }

View file

@ -1,18 +1,18 @@
# main.tf # main.tf
module "us-east-1" { module "us-east-1" {
source = "./cluster" source = "./cluster"
region = "us-east-1" region = "us-east-1"
provider_alias = us-west-2 provider_alias = us-west-2
providers = { providers = {
aws = "aws.us-east-1" aws = "aws.us-east-1"
} }
} }
module "us-west-2" { module "us-west-2" {
source = "./cluster" source = "./cluster"
region = "us-west-2" region = "us-west-2"
provider_alias = us-west-2 provider_alias = us-west-2
providers = { providers = {
aws = "aws.us-west-2" aws = "aws.us-west-2"
} }
} }

View file

@ -1,9 +1,9 @@
terraform { terraform {
required_version = ">= 0.15.3" required_version = ">= 0.15.3"
required_providers { required_providers {
aws = { aws = {
source = "hashicorp/aws" source = "hashicorp/aws"
version = "~> 3.42.0" version = "~> 3.42.0"
} }
} }
} }