Skip to content

Commit 9aa9b1a

Browse files
authored
Merge pull request weaveworks#3797 from weaveworks/update-build-tools
Update build tools
2 parents 2c040c7 + 7243af7 commit 9aa9b1a

38 files changed

+184
-242
lines changed

.lintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Generated files
2+
./cri/runtime/api.pb.go
3+
# Files from different repo
4+
./tools/*

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ shell:
118118
tests: $(CODECGEN_TARGETS) prog/staticui/staticui.go prog/externalui/externalui.go
119119
./tools/test -no-go-get -tags $(GO_BUILD_TAGS)
120120

121-
lint:
121+
lint: prog/staticui/staticui.go prog/externalui/externalui.go
122122
./tools/lint
123123

124124
prog/staticui/staticui.go:
@@ -278,7 +278,7 @@ realclean: clean
278278
$(DOCKERHUB_USER)/scope $(DOCKERHUB_USER)/cloud-agent \
279279
$(DOCKERHUB_USER)/scope:$(IMAGE_TAG) $(DOCKERHUB_USER)/cloud-agent:$(IMAGE_TAG) \
280280
weaveworks/weaveexec:$(WEAVENET_VERSION) \
281-
ubuntu:yakkety alpine:3.5 node:6.9.0 2>/dev/null || true
281+
ubuntu:bionic alpine:3.11 node:6.9.0 2>/dev/null || true
282282

283283
# Dependencies are intentionally build without enforcing any tags
284284
# since they are build on the host

app/api_topology.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ type websocketState struct {
166166
}
167167

168168
func (wc *websocketState) update(ctx context.Context) error {
169-
span := ot.StartSpan("websocket.Render", ot.Tag{"topology", wc.topologyID})
169+
span := ot.StartSpan("websocket.Render", ot.Tag{Key: "topology", Value: wc.topologyID})
170170
defer span.Finish()
171171
ctx = ot.ContextWithSpan(ctx, span)
172172
// We measure how much time has passed since the channel was opened

app/multitenant/aws_collector.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func NewAWSCollector(config AWSCollectorConfig) (AWSCollector, error) {
213213
}
214214

215215
func (c *awsCollector) flushLoop() {
216-
for _ = range c.ticker.C {
216+
for range c.ticker.C {
217217
c.flushPending(context.Background())
218218
}
219219
}

app/multitenant/consul_client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type consulClient struct {
6161

6262
// Get and deserialise a JSON value from consul.
6363
func (c *consulClient) Get(ctx context.Context, key string, out interface{}) error {
64-
span, ctx := opentracing.StartSpanFromContext(ctx, "Consul Get", opentracing.Tag{"key", key})
64+
span, ctx := opentracing.StartSpanFromContext(ctx, "Consul Get", opentracing.Tag{Key: "key", Value: key})
6565
defer span.Finish()
6666
kvp, _, err := c.kv.Get(key, queryOptions)
6767
if err != nil {
@@ -76,7 +76,7 @@ func (c *consulClient) Get(ctx context.Context, key string, out interface{}) err
7676
// CAS atomically modify a value in a callback.
7777
// If value doesn't exist you'll get nil as a argument to your callback.
7878
func (c *consulClient) CAS(ctx context.Context, key string, out interface{}, f CASCallback) error {
79-
span, ctx := opentracing.StartSpanFromContext(ctx, "Consul CAS", opentracing.Tag{"key", key})
79+
span, ctx := opentracing.StartSpanFromContext(ctx, "Consul CAS", opentracing.Tag{Key: "key", Value: key})
8080
defer span.Finish()
8181
var (
8282
index = uint64(0)

app/multitenant/consul_pipe_router.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"time"
1010

1111
"context"
12+
1213
"github.com/gorilla/mux"
1314
"github.com/gorilla/websocket"
1415
opentracing "github.com/opentracing/opentracing-go"
@@ -289,7 +290,7 @@ func (pr *consulPipeRouter) Get(ctx context.Context, id string, e app.End) (xfer
289290
}
290291
key := fmt.Sprintf("%s%s-%s", pr.prefix, userID, id)
291292
log.Infof("Get %s:%s", key, e)
292-
span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Get", opentracing.Tag{"key", key})
293+
span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Get", opentracing.Tag{Key: "key", Value: key})
293294
defer span.Finish()
294295

295296
// Try to ensure the given end of the given pipe
@@ -333,7 +334,7 @@ func (pr *consulPipeRouter) Release(ctx context.Context, id string, e app.End) e
333334
}
334335
key := fmt.Sprintf("%s%s-%s", pr.prefix, userID, id)
335336
log.Infof("Release %s:%s", key, e)
336-
span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Release", opentracing.Tag{"key", key})
337+
span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Release", opentracing.Tag{Key: "key", Value: key})
337338
defer span.Finish()
338339

339340
// atomically clear my end of the pipe in consul
@@ -360,7 +361,7 @@ func (pr *consulPipeRouter) Delete(ctx context.Context, id string) error {
360361
}
361362
key := fmt.Sprintf("%s%s-%s", pr.prefix, userID, id)
362363
log.Infof("Delete %s", key)
363-
span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Delete", opentracing.Tag{"key", key})
364+
span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Delete", opentracing.Tag{Key: "key", Value: key})
364365
defer span.Finish()
365366

366367
return pr.client.CAS(ctx, key, &consulPipe{}, func(in interface{}) (interface{}, bool, error) {

bin/release

+26-26
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ setup() {
3939
else
4040
echo "Cannot determine version - multiple tags point at HEAD:" >&2
4141
for TAG in $HEAD_TAGS; do
42-
echo -e "\t$TAG" >&2
42+
echo -e "\\t$TAG" >&2
4343
done
4444
exit 1
4545
fi
@@ -65,8 +65,8 @@ build() {
6565

6666
echo "== Clone repo at $LATEST_TAG for version $VERSION"
6767
if [ -d "$RELEASE_DIR" ]; then
68-
echo -e "\u2757 Release directory $RELEASE_DIR already exists, you may want to" >&2
69-
echo -e "\trm -rf $RELEASE_DIR" >&2
68+
echo -e "\\u2757 Release directory $RELEASE_DIR already exists, you may want to" >&2
69+
echo -e "\\trm -rf $RELEASE_DIR" >&2
7070
exit 1
7171
fi
7272

@@ -78,7 +78,7 @@ build() {
7878
## Check that the top changelog entry is this version
7979
if ! latest_changelog=$(perl -nle'print $& if m{(?<=^## Release ).*}' ./CHANGELOG.md | head -1) \
8080
|| ! [ "$latest_changelog" = "$VERSION" ]; then
81-
echo -e "\u2757 Latest changelog entry \"$latest_changelog\" does not match the release version $VERSION" >&2
81+
echo -e "\\u2757 Latest changelog entry \"$latest_changelog\" does not match the release version $VERSION" >&2
8282
exit 1
8383
fi
8484

@@ -93,7 +93,7 @@ build() {
9393
if make tests SUDO="$SUDO"; then
9494
echo -e '\u2713 Tests pass'
9595
else
96-
echo -e "\u2757 Tests failed, probably best not publish this one" >&2
96+
echo -e "\\u2757 Tests failed, probably best not publish this one" >&2
9797
exit 1
9898
fi
9999

@@ -119,20 +119,20 @@ draft() {
119119

120120
## Check that the tag exists by looking at github
121121
if ! curl -sSf "https://api.github.com/repos/$GITHUB_USER/scope/git/tags/$LATEST_TAG_SHA" >/dev/null 2>&1; then
122-
echo -e "\u2757 Tag $LATEST_TAG is not on GitHub, or is not the same as the local tag" >&2
123-
echo -e "\thttps://github.com/$GITHUB_USER/scope/tags" >&2
122+
echo -e "\\u2757 Tag $LATEST_TAG is not on GitHub, or is not the same as the local tag" >&2
123+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/tags" >&2
124124
echo "You may need to" >&2
125-
echo -e "\tgit push [email protected]:$GITHUB_USER/scope $LATEST_TAG"
125+
echo -e "\\tgit push [email protected]:$GITHUB_USER/scope $LATEST_TAG"
126126
exit 1
127127
fi
128128

129-
echo -e "\u2713 Tag $LATEST_TAG exists in GitHub repo $GITHUB_USER/scope"
129+
echo -e "\\u2713 Tag $LATEST_TAG exists in GitHub repo $GITHUB_USER/scope"
130130

131131
## Check that the version does not already exist by looking at github
132132
## releases
133133
if github-release info --user "$GITHUB_USER" --repo scope --tag "$LATEST_TAG" >/dev/null 2>&1; then
134-
echo -e "\u2757 Release $LATEST_TAG already exists on GitHub" >&2
135-
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" >&2
134+
echo -e "\\u2757 Release $LATEST_TAG already exists on GitHub" >&2
135+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" >&2
136136
exit 1
137137
fi
138138

@@ -144,7 +144,7 @@ draft() {
144144
fi
145145

146146
echo "== Creating GitHub release $RELEASE_ARGS $RELEASE_NAME $VERSION"
147-
github-release release $RELEASE_ARGS \
147+
github-release release "$RELEASE_ARGS" \
148148
--user "$GITHUB_USER" \
149149
--repo scope \
150150
--tag "$LATEST_TAG" \
@@ -159,7 +159,7 @@ draft() {
159159
--file "./scope"
160160

161161
echo "** Draft $TYPE $RELEASE_NAME $VERSION created at"
162-
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
162+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
163163
}
164164

165165
publish() {
@@ -177,22 +177,22 @@ publish() {
177177
--tag "$LATEST_TAG"
178178

179179
echo "** Pre-release $RELEASE_NAME $VERSION published at"
180-
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
180+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
181181
else
182182
echo "== Sanity checks"
183183
if ! [ "$LATEST_TAG_COMMIT_SHA" == "$LATEST_RELEASE_COMMIT_SHA" ]; then
184-
echo -e "\u2757 The tag latest_release does not point to the same commit as $LATEST_TAG" >&2
184+
echo -e "\\u2757 The tag latest_release does not point to the same commit as $LATEST_TAG" >&2
185185
echo "You may need to" >&2
186-
echo -e "\tgit tag -af latest_release $LATEST_TAG" >&2
186+
echo -e "\\tgit tag -af latest_release $LATEST_TAG" >&2
187187
exit 1
188188
fi
189189

190190
## Check that the 'latest_release' tag exists by looking at github
191191
if ! curl -sSf "https://api.github.com/repos/$GITHUB_USER/scope/git/tags/$LATEST_RELEASE_SHA" >/dev/null 2>&1; then
192-
echo -e "\u2757 Tag latest_release is not on GitHub, or is not the same as the local tag" >&2
193-
echo -e "\thttps://github.com/$GITHUB_USER/scope/tags" >&2
192+
echo -e "\\u2757 Tag latest_release is not on GitHub, or is not the same as the local tag" >&2
193+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/tags" >&2
194194
echo "You may need to" >&2
195-
echo -e "\tgit push -f [email protected]:$GITHUB_USER/scope latest_release" >&2
195+
echo -e "\\tgit push -f [email protected]:$GITHUB_USER/scope latest_release" >&2
196196
exit 1
197197
fi
198198
echo '** Sanity checks OK for publishing tag' "$LATEST_TAG" as "$DOCKERHUB_USER/scope:$VERSION"
@@ -229,8 +229,8 @@ publish() {
229229
--file "./scope"
230230

231231
echo "** Release $RELEASE_NAME $VERSION published at"
232-
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
233-
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/latest_release"
232+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
233+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/latest_release"
234234
fi
235235
}
236236

@@ -254,19 +254,19 @@ push_images() {
254254

255255
usage() {
256256
echo "Usage:"
257-
echo -e "\t./bin/release build"
257+
echo -e "\\t./bin/release build"
258258
echo "-- Build artefacts for the latest version tag"
259-
echo -e "\t./bin/release draft"
259+
echo -e "\\t./bin/release draft"
260260
echo "-- Create draft release with artefacts in GitHub"
261-
echo -e "\t./bin/release publish"
261+
echo -e "\\t./bin/release publish"
262262
echo "-- Publish the GitHub release and update DockerHub"
263263
exit 1
264264
}
265265

266266
# Ensure required tooling is installed
267-
if ! which github-release >/dev/null; then
267+
if ! command -v github-release >/dev/null; then
268268
echo "Please install git-release:" >&2
269-
echo -e "\tgo get github.com/weaveworks/github-release" >&2
269+
echo -e "\\tgo get github.com/weaveworks/github-release" >&2
270270
echo "and create a git token per https://github.com/weaveworks/github-release" >&2
271271
exit 1
272272
fi

0 commit comments

Comments
 (0)