Fail build if go mod vendor changes anything. (#10524)
This commit is contained in:
parent
5497446d4f
commit
a73e834fda
|
@ -1988,6 +1988,42 @@ jobs:
|
|||
name: Install CircleCI CLI
|
||||
- run:
|
||||
command: make ci-verify
|
||||
go-mod-vendor:
|
||||
machine: true
|
||||
shell: /usr/bin/env bash -euo pipefail -c
|
||||
working_directory: /go/src/github.com/hashicorp/vault
|
||||
steps:
|
||||
- run:
|
||||
command: |
|
||||
[ -n "$GO_VERSION" ] || { echo "You must set GO_VERSION"; exit 1; }
|
||||
# Install Go
|
||||
curl -sSLO "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz"
|
||||
sudo rm -rf /usr/local/go
|
||||
sudo tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz"
|
||||
rm -f "go${GO_VERSION}.linux-amd64.tar.gz"
|
||||
GOPATH="/go"
|
||||
mkdir $GOPATH 2>/dev/null || { sudo mkdir $GOPATH && sudo chmod 777 $GOPATH; }
|
||||
echo "export GOPATH='$GOPATH'" >> "$BASH_ENV"
|
||||
echo "export PATH='$PATH:$GOPATH/bin:/usr/local/go/bin'" >> "$BASH_ENV"
|
||||
|
||||
echo "$ go version"
|
||||
go version
|
||||
name: Setup Go
|
||||
working_directory: ~/
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
command: |
|
||||
GO111MODULE=on go mod vendor
|
||||
git diff --exit-code
|
||||
name: Run go mod vendor
|
||||
environment:
|
||||
- CIRCLECI_CLI_VERSION: 0.1.5546
|
||||
- GO_TAGS: ''
|
||||
- GO_VERSION: 1.15.3
|
||||
- GO111MODULE: 'off'
|
||||
- GOTESTSUM_VERSION: 0.5.2
|
||||
test-go-race-remote-docker:
|
||||
docker:
|
||||
- image: docker.mirror.hashicorp.services/circleci/golang:1.15.3-buster
|
||||
|
@ -2194,6 +2230,9 @@ workflows:
|
|||
- build-go-dev:
|
||||
requires:
|
||||
- pre-flight-checks
|
||||
- go-mod-vendor:
|
||||
requires:
|
||||
- pre-flight-checks
|
||||
- test-ui:
|
||||
requires:
|
||||
- install-ui-dependencies
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
executor: go-machine
|
||||
steps:
|
||||
- setup-go
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
name: Run go mod vendor
|
||||
command: |
|
||||
GO111MODULE=on go mod vendor
|
||||
git diff --exit-code
|
|
@ -6,6 +6,9 @@ jobs:
|
|||
- build-go-dev:
|
||||
requires:
|
||||
- pre-flight-checks
|
||||
- go-mod-vendor:
|
||||
requires:
|
||||
- pre-flight-checks
|
||||
- test-ui:
|
||||
requires:
|
||||
- install-ui-dependencies
|
||||
|
|
1
go.mod
1
go.mod
|
@ -122,6 +122,7 @@ require (
|
|||
github.com/oklog/run v1.0.0
|
||||
github.com/okta/okta-sdk-golang/v2 v2.0.0
|
||||
github.com/oracle/oci-go-sdk v12.5.0+incompatible
|
||||
github.com/ory/dockertest v3.3.5+incompatible
|
||||
github.com/ory/dockertest/v3 v3.6.2
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
|
||||
|
|
|
@ -35,63 +35,31 @@ func (c *Sys) CORSStatus() (*CORSResponse, error) {
|
|||
return &result, err
|
||||
}
|
||||
|
||||
func (c *Sys) ConfigureCORS(req *CORSRequest) (*CORSResponse, error) {
|
||||
func (c *Sys) ConfigureCORS(req *CORSRequest) error {
|
||||
r := c.c.NewRequest("PUT", "/v1/sys/config/cors")
|
||||
if err := r.SetJSONBody(req); err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
|
||||
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||
defer cancelFunc()
|
||||
resp, err := c.c.RawRequestWithContext(ctx, r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err == nil {
|
||||
defer resp.Body.Close()
|
||||
|
||||
secret, err := ParseSecret(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if secret == nil || secret.Data == nil {
|
||||
return nil, errors.New("data from server response is empty")
|
||||
}
|
||||
|
||||
var result CORSResponse
|
||||
err = mapstructure.Decode(secret.Data, &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &result, err
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Sys) DisableCORS() (*CORSResponse, error) {
|
||||
func (c *Sys) DisableCORS() error {
|
||||
r := c.c.NewRequest("DELETE", "/v1/sys/config/cors")
|
||||
|
||||
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||
defer cancelFunc()
|
||||
resp, err := c.c.RawRequestWithContext(ctx, r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err == nil {
|
||||
defer resp.Body.Close()
|
||||
|
||||
secret, err := ParseSecret(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if secret == nil || secret.Data == nil {
|
||||
return nil, errors.New("data from server response is empty")
|
||||
}
|
||||
|
||||
var result CORSResponse
|
||||
err = mapstructure.Decode(secret.Data, &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &result, err
|
||||
return err
|
||||
}
|
||||
|
||||
type CORSRequest struct {
|
||||
|
|
Loading…
Reference in New Issue