Skip to content

Commit eaf2fa8

Browse files
authored
Merge pull request #449 from Kern--/main
Pin dependencies
2 parents da8e44a + e73af86 commit eaf2fa8

File tree

8 files changed

+1978
-19
lines changed

8 files changed

+1978
-19
lines changed

.buildkite/pipeline.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ steps:
7676
# To use ${FC_TEST_DATA_PATH} as testdata/, all files in the original directory must be
7777
# copied to the new directory.
7878
- cp -r testdata/* ${FC_TEST_DATA_PATH}
79-
# Install tc-redirect-tap.
80-
- 'go get github.com/awslabs/tc-redirect-tap/cmd/tc-redirect-tap'
8179
# Copy vmlinux and root-drive.img.
8280
- ln -s /var/lib/fc-ci/vmlinux.bin ${FC_TEST_DATA_PATH}/vmlinux
8381
- ln -s /var/lib/fc-ci/rootfs.ext4 ${FC_TEST_DATA_PATH}/root-drive.img

.hack/go.mod

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This is a fake go.mod
2+
// Older versions of go have different go get/go install semantics. In particular:
3+
// 1. `go get` with `GO111MODULES=off` will retrieve and and install a package, but you can't specify a version
4+
// 2. `go get` with `GO111MODULES=on` will retrive a packge at a specific version, but messes with the go.mod. The package can then be installed with `go install`
5+
6+
// We don't actually want binary dependencies to modify the go.mod but since we want to pin versions, we create this unused go.mod
7+
// that `go get` can mess with without affecting our main codebase.
8+
module hack
9+
10+
go 1.11
11+
12+
require (
13+
github.com/awslabs/tc-redirect-tap v0.0.0-20220715050423-f2af44521093 // indirect
14+
github.com/containernetworking/plugins v1.1.1 // indirect
15+
)

.hack/go.sum

Lines changed: 956 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ testdata_dir = testdata/firecracker.tgz testdata/firecracker_spec-$(firecracker_
5555
# --location is needed to follow redirects on github.com
5656
curl = curl --location
5757

58+
GO_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1,2)
59+
ifeq ($(GO_VERSION), $(filter $(GO_VERSION),1.14 1.15))
60+
define install_go
61+
cd .hack; GO111MODULE=on GOBIN=$(abspath $(FC_TEST_BIN_PATH)) go get $(1)@$(2)
62+
cd .hack; GO111MODULE=on GOBIN=$(abspath $(FC_TEST_BIN_PATH)) go install $(1)
63+
endef
64+
else
65+
define install_go
66+
GOBIN=$(abspath $(FC_TEST_BIN_PATH)) go install $(1)@$(2)
67+
endef
68+
endif
69+
5870
all: build
5971

6072
test: all-tests
@@ -106,24 +118,19 @@ else
106118
endif
107119

108120
$(FC_TEST_BIN_PATH)/ptp:
109-
GO111MODULE=off GOBIN=$(abspath $(FC_TEST_BIN_PATH)) \
110-
go get github.com/containernetworking/plugins/plugins/main/ptp
121+
$(call install_go,github.com/containernetworking/plugins/plugins/main/ptp,v1.1.1)
111122

112123
$(FC_TEST_BIN_PATH)/host-local:
113-
GO111MODULE=off GOBIN=$(abspath $(FC_TEST_BIN_PATH)) \
114-
go get github.com/containernetworking/plugins/plugins/ipam/host-local
124+
$(call install_go,github.com/containernetworking/plugins/plugins/ipam/host-local,v1.1.1)
115125

116126
$(FC_TEST_BIN_PATH)/static:
117-
GO111MODULE=off GOBIN=$(abspath $(FC_TEST_BIN_PATH)) \
118-
go get github.com/containernetworking/plugins/plugins/ipam/static
127+
$(call install_go,github.com/containernetworking/plugins/plugins/ipam/static,v1.1.1)
119128

120129
$(FC_TEST_BIN_PATH)/tc-redirect-tap:
121-
GO111MODULE=off GOBIN=$(abspath $(FC_TEST_BIN_PATH)) \
122-
go get github.com/awslabs/tc-redirect-tap/cmd/tc-redirect-tap
130+
$(call install_go,github.com/awslabs/tc-redirect-tap/cmd/tc-redirect-tap,v0.0.0-20220715050423-f2af44521093)
123131

124132
$(FC_TEST_DATA_PATH)/ltag:
125-
GO111MODULE=on GOBIN=$(abspath $(FC_TEST_BIN_PATH)) \
126-
go get github.com/kunalkushwaha/[email protected]
133+
$(call install_go,github.com/kunalkushwaha/ltag,v0.2.3)
127134

128135
$(FIRECRACKER_DIR):
129136
- git clone https://github.com/firecracker-microvm/firecracker.git $(FIRECRACKER_DIR)

examples/cmd/snapshotting/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin/
2+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This is a fake go.mod
2+
// Older versions of go have different go get/go install semantics. In particular:
3+
// 1. `go get` with `GO111MODULES=off` will retrieve and and install a package, but you can't specify a version
4+
// 2. `go get` with `GO111MODULES=on` will retrive a packge at a specific version, but messes with the go.mod. The package can then be installed with `go install`
5+
6+
// We don't actually want binary dependencies to modify the go.mod but since we want to pin versions, we create this unused go.mod
7+
// that `go get` can mess with without affecting our main codebase.
8+
module hack
9+
10+
go 1.11
11+
12+
require (
13+
github.com/awslabs/tc-redirect-tap v0.0.0-20220715050423-f2af44521093 // indirect
14+
github.com/containernetworking/plugins v1.1.1 // indirect
15+
)

examples/cmd/snapshotting/.hack/go.sum

Lines changed: 956 additions & 0 deletions
Large diffs are not rendered by default.

examples/cmd/snapshotting/Makefile

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,21 @@ ARCH=$(shell uname -m)
1818
GID = $(shell id -g)
1919

2020
PWD=$(shell pwd)
21+
GOBIN=$(PWD)/bin
2122
FC_TEST_DATA_PATH?=$(PWD)
2223

24+
GO_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1,2)
25+
ifeq ($(GO_VERSION), $(filter $(GO_VERSION),1.14 1.15))
26+
define install_go
27+
cd .hack; GO111MODULE=on GOBIN=$(GOBIN) go get $(1)@$(2)
28+
cd .hack; GO111MODULE=on GOBIN=$(GOBIN) go install $(1)
29+
endef
30+
else
31+
define install_go
32+
GOBIN=$(GOBIN) go install $(1)@$(2)
33+
endef
34+
endif
35+
2336
all: plugins image vmlinux firecracker
2437

2538
plugins: bin/tc-redirect-tap bin/ptp bin/host-local | bin
@@ -28,16 +41,13 @@ bin:
2841
mkdir -p bin
2942

3043
bin/tc-redirect-tap: bin
31-
GO111MODULE=off GOBIN=$(PWD)/bin \
32-
go get github.com/awslabs/tc-redirect-tap/cmd/tc-redirect-tap
44+
$(call install_go,github.com/awslabs/tc-redirect-tap/cmd/tc-redirect-tap,v0.0.0-20220715050423-f2af44521093)
3345

3446
bin/ptp: bin
35-
GO111MODULE=off GOBIN=$(PWD)/bin \
36-
go get github.com/containernetworking/plugins/plugins/main/ptp
47+
$(call install_go,github.com/containernetworking/plugins/plugins/main/ptp,v1.1.1)
3748

3849
bin/host-local: bin
39-
GO111MODULE=off GOBIN=$(PWD)/bin \
40-
go get github.com/containernetworking/plugins/plugins/ipam/host-local
50+
$(call install_go,github.com/containernetworking/plugins/plugins/ipam/host-local,v1.1.1)
4151

4252
image:
4353
ifeq ($(GID), 0)
@@ -70,4 +80,4 @@ run: all
7080
clean:
7181
rm -rf bin firecracker root-drive-ssh-key root-drive-with-ssh.img vmlinux
7282

73-
.PHONY: all clean image plugins run
83+
.PHONY: all clean image plugins run

0 commit comments

Comments
 (0)