Skip to content

Commit dca85b4

Browse files
Updated travis and bascule (#444)
* Updated travis and bascule * fixed travis
1 parent ef30089 commit dca85b4

File tree

6 files changed

+43
-9
lines changed

6 files changed

+43
-9
lines changed

.travis.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ go:
44
- 1.13.x
55
- tip
66

7-
matrix:
8-
allow_failures:
9-
- go: tip
10-
fast_finish: true
7+
os:
8+
- linux
119

1210
branches:
1311
only:
1412
- master
13+
- /^v[0-9]+\.[0-9]+\.[0-9]+$/
1514

1615
before_install:
1716
- curl -s https://codecov.io/bash > codecov.sh
@@ -23,3 +22,30 @@ install:
2322
script:
2423
- go test ./... -race -coverprofile=coverage.txt
2524
- ./codecov.sh
25+
26+
jobs:
27+
include:
28+
- stage: tag
29+
name: "Tag For Release"
30+
if: branch = master && type = push
31+
before_script:
32+
- echo -e "machine github.com\n login $GH_TOKEN" > ~/.netrc
33+
script:
34+
- export OLD_VERSION=$(git describe --tags `git rev-list --tags --max-count=1` | tail -1 | sed 's/v\(.*\)/\1/')
35+
- git config --global user.name "kristinaspring"
36+
- git config --global user.email "kmspring57@gmail.com"
37+
- export TAG=$(cat CHANGELOG.md | perl -0777 -ne 'print "$1" if /.*## \[Unreleased\]\s+## \[(v\d+.\d+.\d+)\].*/s')
38+
- export TODAY=`date +'%m/%d/%Y'`
39+
- export NOTES=$(cat CHANGELOG.md | perl -0777 -ne 'print "$ENV{TODAY}\n\n$1\n" if /.*## \[$ENV{TAG}\]\s(.*?)\s+## \[(v\d+.\d+.\d+)\].*/s')
40+
- if [[ "$TAG" != "" && "$TAG" != "$OLD_VERSION" ]]; then git tag -a "$TAG" -m "$NOTES"; git push origin --tags; echo $?; fi
41+
- stage: release
42+
name: "Make a Release"
43+
if: branch != master
44+
script: skip
45+
deploy:
46+
on:
47+
all_branches: true
48+
tags: true
49+
provider: releases
50+
api_key: "$GH_TOKEN"
51+
skip_cleanup: true

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9+
## [v1.5.1]
10+
- Added automated releases using travis [#444](https://github.com/xmidt-org/webpa-common/pull/444)
11+
- Bumped bascule version to v0.7.0 and updated basculechecks to match [#444](https://github.com/xmidt-org/webpa-common/pull/444)
12+
913
## [v1.5.0]
1014
- reduced logging for xhttp retry #441
1115
- modified capabilities check to be more restrictive #440
@@ -48,6 +52,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
4852
moving forward.
4953

5054
[Unreleased]: https://github.com/xmidt-org/webpa-common/compare/v1.5.0...HEAD
55+
[v1.5.1]: https://github.com/xmidt-org/webpa-common/compare/v1.5.0...v1.5.1
5156
[v1.5.0]: https://github.com/xmidt-org/webpa-common/compare/v1.4.0...v1.5.0
5257
[v1.4.0]: https://github.com/xmidt-org/webpa-common/compare/v1.3.2...v1.4.0
5358
[v1.3.2]: https://github.com/xmidt-org/webpa-common/compare/v1.3.1...v1.3.2

basculechecks/basculechecks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func CreateValidCapabilityCheck(prefix string, acceptAllMethod string) (func(con
4949
}
5050

5151
re := regexp.MustCompile(matches[1])
52-
matchIdxs := re.FindStringIndex(reqVal.URL)
52+
matchIdxs := re.FindStringIndex(reqVal.URL.EscapedPath())
5353
if matchIdxs == nil {
5454
continue
5555
}

basculechecks/basculechecks_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package basculechecks
22

33
import (
44
"context"
5+
"net/url"
56
"testing"
67

78
"github.com/stretchr/testify/assert"
@@ -19,11 +20,13 @@ func TestValidCapabilityCheck(t *testing.T) {
1920
prefix := "a:b:c:"
2021
check, err := CreateValidCapabilityCheck(prefix, acceptAll)
2122
assert.Nil(t, err)
23+
u, err := url.Parse("/test")
24+
assert.Nil(t, err)
2225
goodAuth := bascule.Authentication{
2326
Authorization: "jwt",
2427
Token: bascule.NewToken("Bearer", "jwt", bascule.Attributes{}),
2528
Request: bascule.Request{
26-
URL: "/test",
29+
URL: u,
2730
Method: "GET",
2831
},
2932
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ require (
4545
github.com/spf13/viper v1.3.1
4646
github.com/stretchr/testify v1.3.0
4747
github.com/ugorji/go/codec v1.1.7
48-
github.com/xmidt-org/bascule v0.5.0
48+
github.com/xmidt-org/bascule v0.7.0
4949
github.com/xmidt-org/wrp-go v1.3.3
5050
gopkg.in/ini.v1 v1.46.0 // indirect
5151
gopkg.in/natefinch/lumberjack.v2 v2.0.0-20170531160350-a96e63847dc3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 h1:3SVOIvH7Ae1KRYy
184184
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
185185
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
186186
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
187-
github.com/xmidt-org/bascule v0.5.0 h1:cpg0iX992y6VM+EQuI0qV4y3xzSrGL+eAh7dq2n0FTo=
188-
github.com/xmidt-org/bascule v0.5.0/go.mod h1:D2DuXSMa5+OpveCtaSWp0+/tmnxZqfYhkCC1oCzLZdI=
187+
github.com/xmidt-org/bascule v0.7.0 h1:TUbSKq68CzutTXYh5hq8mhMCHeYdIXaUffx3qCMo1yE=
188+
github.com/xmidt-org/bascule v0.7.0/go.mod h1:D2DuXSMa5+OpveCtaSWp0+/tmnxZqfYhkCC1oCzLZdI=
189189
github.com/xmidt-org/webpa-common v1.1.0/go.mod h1:oCpKzOC+9h2vYHVzAU/06tDTQuBN4RZz+rhgIXptpOI=
190190
github.com/xmidt-org/webpa-common v1.3.1/go.mod h1:oCpKzOC+9h2vYHVzAU/06tDTQuBN4RZz+rhgIXptpOI=
191191
github.com/xmidt-org/wrp-go v1.3.3 h1:WvODdrtxPwHEUqwfwHpu+kNUfBzLBfAIdrKCQjoCblc=

0 commit comments

Comments
 (0)