Skip to content

Commit

Permalink
Merge pull request #54 from GSA/update
Browse files Browse the repository at this point in the history
Unlock hashicorp/aws provider version
  • Loading branch information
bryanlalexander authored Oct 31, 2022
2 parents fe1459e + 9d1a515 commit a4f32fa
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 680 deletions.
113 changes: 56 additions & 57 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:
- run:
name: Install curl
command: apk add --update curl && apk upgrade
- run:
name: terraform providers
command: terraform providers
- run:
name: terraform init
command: find . -type f -name "*.tf" -exec dirname {} \;|sort -u | while read m; do (cd "$m" && terraform init -input=false -backend=false) || exit 1; done
Expand All @@ -29,75 +32,71 @@ jobs:
environment:
AWS_DEFAULT_REGION: us-east-1
docker:
- image: circleci/golang:latest
working_directory: /go/src/github.com/GSA/grace-inventory
- image: cimg/go:1.19.2
steps:
- checkout
- run:
name: Lint Handler
command: make lint_handler
integration_test:
environment:
AWS_REGION: us-east-1
machine:
# https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
name: Install make, curl, unzip
command: |
sudo apt-get update
sudo apt-get install -y make curl unzip software-properties-common
- run:
name: Install Terraform
command: |
TERRAFORM_LATEST_URL=$(curl --silent --location --head --output /dev/null --write-out '%{url_effective}' -- https://github.com/hashicorp/terraform/releases/latest)
TERRAFORM_VERSION=${TERRAFORM_LATEST_URL##*/}
TERRAFORM_VERSION=${TERRAFORM_VERSION:1:${#TERRAFORM_VERSION}}
curl -o terraform.zip -sSL "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
sudo unzip terraform.zip -d /bin
sudo chmod +x /bin/terraform
- run:
name: Install Moto Server
command: |
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt install -y python3.7-dev python3.7-distutils python3-pip
sudo python3.7 -m pip install --upgrade pip setuptools flask requests six distro
git clone https://github.com/brady-gsa/moto.git
cd moto
git checkout fix_lambda_config
cd ..
sudo python3.7 -m pip install -e moto --ignore-installed PyYAML
- run:
name: Install golang
command: |
curl -o go.tar.gz -sSL https://dl.google.com/go/go1.16.linux-amd64.tar.gz
sudo tar -xvf go.tar.gz
sudo rm -rf /usr/local/go
sudo mv -f go /usr/local
mkdir ~/go
echo 'export GOROOT=/usr/local/go' >> $BASH_ENV
echo 'export GOPATH=$HOME/go' >> $BASH_ENV
echo 'export PATH=$GOPATH/bin:$GOROOT/bin:$PATH' >> $BASH_ENV
- run:
name: Test Terraform
command: |
make integration_test
# integration_test:
# environment:
# AWS_REGION: us-east-1
# machine:
# image: cimg/base #ubuntu base image
# steps:
# - checkout
# - run:
# name: Install make, curl, unzip
# command: |
# sudo apt-get update
# sudo apt-get install -y make curl unzip software-properties-common
# - run:
# name: Install Terraform
# command: |
# TERRAFORM_LATEST_URL=$(curl --silent --location --head --output /dev/null --write-out '%{url_effective}' -- https://github.com/hashicorp/terraform/releases/latest)
# TERRAFORM_VERSION=${TERRAFORM_LATEST_URL##*/}
# TERRAFORM_VERSION=${TERRAFORM_VERSION:1:${#TERRAFORM_VERSION}}
# curl -o terraform.zip -sSL "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
# sudo unzip terraform.zip -d /bin
# sudo chmod +x /bin/terraform
# - run:
# name: Install Moto Server
# command: |
# sudo add-apt-repository ppa:deadsnakes/ppa
# sudo apt-get update
# sudo apt install -y python3.7-dev python3.7-distutils python3-pip
# sudo python3.7 -m pip install --upgrade pip setuptools flask requests six distro
# git clone https://github.com/brady-gsa/moto.git
# cd moto
# git checkout fix_lambda_config
# cd ..
# sudo python3.7 -m pip install -e moto --ignore-installed PyYAML
# - run:
# name: Install golang
# command: |
# curl -o go.tar.gz -sSL https://dl.google.com/go/go1.19.2.linux-amd64.tar.gz
# sudo tar -xvf go.tar.gz
# sudo rm -rf /usr/local/go
# sudo mv -f go /usr/local
# mkdir ~/go
# echo 'export GOROOT=/usr/local/go' >> $BASH_ENV
# echo 'export GOPATH=$HOME/go' >> $BASH_ENV
# echo 'export PATH=$GOPATH/bin:$GOROOT/bin:$PATH' >> $BASH_ENV
# - run:
# name: Test Terraform
# command: |
# make integration_test
test_handler:
docker:
- image: circleci/golang:latest
working_directory: /go/src/github.com/GSA/grace-inventory
- image: cimg/go:1.19.2
steps:
- checkout
- run:
name: Run Unit Tests
command: make test_handler
release_handler:
docker:
- image: circleci/golang:latest
working_directory: /go/src/github.com/GSA/grace-inventory
- image: cimg/go:1.19.2
steps:
- checkout
- run:
Expand All @@ -111,7 +110,7 @@ jobs:
path: release/
tfsec:
docker:
- image: circleci/golang:latest
- image: cimg/go:1.19.2
steps:
- checkout
- run:
Expand All @@ -128,7 +127,7 @@ workflows:
- tfsec
- lint_handler
- test_handler
- integration_test
#- integration_test
- release_handler:
filters:
tags:
Expand Down
38 changes: 2 additions & 36 deletions handler/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,55 +34,21 @@ linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- errcheck
- gocyclo
- gofmt
- goimports
- golint
- revive
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- misspell
- nakedret
- scopelint
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

# don't enable:
# - dupl
# - funlen
# - gochecknoglobals
# - gochecknoinits
# - gocognit
# - goconst
# - gocritic
# - godox
# - lll
# - maligned
# - prealloc

run:
skip-dirs:
- test/testdata_etc
- internal/cache
- internal/renameio
- internal/robustio

# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.20.x # use the fixed version to not introduce new linters unexpectedly
prepare:
- echo "here I can run custom commands, but no preparation needed for this repo"
- unused
6 changes: 3 additions & 3 deletions handler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ endif
dependencies: precommit $(GOLANGCILINT) $(GOSEC) $(GHR)

$(GOLANGCILINT):
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1

$(GOSEC):
go install github.com/securego/gosec/cmd/gosec@latest
go install github.com/securego/gosec/v2/cmd/gosec@v2.14.0

$(GHR):
go install github.com/tcnksm/ghr@latest
go install github.com/tcnksm/ghr@v0.16.0

precommit:
ifneq ($(strip $(hooksPath)),.github/hooks)
Expand Down
39 changes: 30 additions & 9 deletions handler/go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
module github.com/GSA/grace-inventory/handler

go 1.16
go 1.19

require (
github.com/aws/aws-lambda-go v1.23.0
github.com/aws/aws-sdk-go v1.38.39
github.com/caarlos0/env/v6 v6.5.0
github.com/google/go-cmp v0.5.5
github.com/gruntwork-io/terratest v0.34.6
github.com/aws/aws-lambda-go v1.34.1
github.com/aws/aws-sdk-go v1.44.126
github.com/caarlos0/env/v6 v6.10.1
github.com/google/go-cmp v0.5.9
github.com/gruntwork-io/terratest v0.40.24
github.com/tealeg/xlsx v1.0.5
golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
gotest.tools/v3 v3.4.0
)

require (
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-errors/errors v1.0.2-0.20180813162953-d98b870cc4e0 // indirect
github.com/go-sql-driver/mysql v1.4.1 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/gruntwork-io/go-commons v0.8.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/otp v1.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/stretchr/testify v1.7.2 // indirect
github.com/urfave/cli v1.22.2 // indirect
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e // indirect
google.golang.org/appengine v1.6.7 // indirect
gotest.tools/v3 v3.0.3
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit a4f32fa

Please sign in to comment.