Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Commit

Permalink
Update build for go modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie Briggs committed Jun 18, 2019
1 parent c2dc4fe commit 0a50641
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
22 changes: 9 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ version: 2.1
executors:
golang:
docker:
- image: circleci/golang:1.11
working_directory: /go/src/github.com/Financial-Times/dyn-cli-utils
- image: circleci/golang:1.12
golang-node:
docker:
- image: circleci/golang:1.11-node
working_directory: /go/src/github.com/Financial-Times/dyn-cli-utils
- image: circleci/golang:1.12-node

jobs:
install:
Expand All @@ -17,19 +15,16 @@ jobs:
- checkout

- restore_cache:
key: v1-gopkg-{{ checksum "Gopkg.lock" }}
key: v1-gomod-{{ checksum "go.sum" }}

- run:
name: Install dependencies
command: |
if [ ! -d /go/src/github.com/Financial-Times/dyn-cli-utils/vendor ]; then
dep ensure
fi
command: go mod download

- save_cache:
key: v1-gopkg-{{ checksum "Gopkg.lock" }}
key: v1-gomod-{{ checksum "go.sum" }}
paths:
- /go/src/github.com/Financial-Times/dyn-cli-utils/vendor
- /go/pkg/mod

- persist_to_workspace:
root: .
Expand All @@ -40,7 +35,7 @@ jobs:
executor: golang-node
steps:
- attach_workspace:
at: /go/src/github.com/Financial-Times/dyn-cli-utils
at: ~/project

- run:
name: Check the style
Expand All @@ -58,11 +53,12 @@ jobs:
executor: golang-node
steps:
- attach_workspace:
at: /go/src/github.com/Financial-Times/dyn-cli-utils
at: ~/project

- run:
name: Update snyk monitoring
command: make security-monitor

workflows:
version: 2.1
build-and-deploy:
Expand Down
19 changes: 11 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,28 @@ vet: ## Examine the Go source code.

.PHONY: security
security: _security-login ## Scan dependencies for security vulnerabilities.
@printf '%b\n' ">> $(TEAL)scanning dependencies for vulnerabilities"
npx snyk test --org=reliability-engineering
@$(DONE)
# TODO: enable once snyk support go modules https://github.com/snyk/snyk/issues/354
# @printf '%b\n' ">> $(TEAL)scanning dependencies for vulnerabilities"
# npx snyk test --org=reliability-engineering
# @$(DONE)

_security-login:

_security-login-web: ## Login to snyk if not on CI.
@printf '%b\n' ">> $(TEAL)Not on CI, logging into Snyk"
npx snyk auth
# TODO: enable once snyk support go modules https://github.com/snyk/snyk/issues/354
# @printf '%b\n' ">> $(TEAL)Not on CI, logging into Snyk"
# npx snyk auth

ifeq ($(CI),)
_security-login: _security-login-web
endif

.PHONY: security-monitor
security-monitor: ## Update latest monitored dependencies in snyk. Needs to be run in an environment with the snyk CLI tool.
@printf '%b\n' ">> $(TEAL)updating snyk dependencies"
npx snyk monitor --org=reliability-engineering
@$(DONE)
# TODO: enable once snyk support go modules https://github.com/snyk/snyk/issues/354
# @printf '%b\n' ">> $(TEAL)updating snyk dependencies"
# npx snyk monitor --org=reliability-engineering
# @$(DONE)

.PHONY: help
help: ## Show this help message.
Expand Down

0 comments on commit 0a50641

Please sign in to comment.