Skip to content

Commit

Permalink
Merge pull request #3100 from kolyshkin/drop-go-1.13
Browse files Browse the repository at this point in the history
Drop Go 1.13 support, require go 1.15+
  • Loading branch information
kolyshkin authored Jul 27, 2021
2 parents 4071c3c + a91ce30 commit 1f5f237
Show file tree
Hide file tree
Showing 38 changed files with 169 additions and 657 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# Docker/Moby still builds runc with Go 1.13, so we should still support Go 1.13.
go-version: [1.13.x, 1.15.x, 1.16.x]
go-version: [1.15.x, 1.16.x]
rootless: ["rootless", ""]
race: ["-race", ""]

Expand Down
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@ BUILDTAGS ?= seccomp
COMMIT ?= $(shell git describe --dirty --long --always)
VERSION := $(shell cat ./VERSION)

# TODO: rm -mod=vendor once go 1.13 is unsupported
ifneq ($(GO111MODULE),off)
MOD_VENDOR := "-mod=vendor"
endif
ifeq ($(shell $(GO) env GOOS),linux)
ifeq (,$(filter $(shell $(GO) env GOARCH),mips mipsle mips64 mips64le ppc64))
ifeq (,$(findstring -race,$(EXTRA_FLAGS)))
GO_BUILDMODE := "-buildmode=pie"
endif
endif
endif
GO_BUILD := $(GO) build -trimpath $(MOD_VENDOR) $(GO_BUILDMODE) $(EXTRA_FLAGS) -tags "$(BUILDTAGS)" \
GO_BUILD := $(GO) build -trimpath $(GO_BUILDMODE) $(EXTRA_FLAGS) -tags "$(BUILDTAGS)" \
-ldflags "-X main.gitCommit=$(COMMIT) -X main.version=$(VERSION) $(EXTRA_LDFLAGS)"
GO_BUILD_STATIC := CGO_ENABLED=1 $(GO) build -trimpath $(MOD_VENDOR) $(EXTRA_FLAGS) -tags "$(BUILDTAGS) netgo osusergo" \
GO_BUILD_STATIC := CGO_ENABLED=1 $(GO) build -trimpath $(EXTRA_FLAGS) -tags "$(BUILDTAGS) netgo osusergo" \
-ldflags "-w -extldflags -static -X main.gitCommit=$(COMMIT) -X main.version=$(VERSION) $(EXTRA_LDFLAGS)"

.DEFAULT: runc
Expand Down Expand Up @@ -73,7 +69,7 @@ unittest: runcimage
$(RUNC_IMAGE) make localunittest TESTFLAGS=$(TESTFLAGS)

localunittest: all
$(GO) test $(MOD_VENDOR) -timeout 3m -tags "$(BUILDTAGS)" $(TESTFLAGS) -v ./...
$(GO) test -timeout 3m -tags "$(BUILDTAGS)" $(TESTFLAGS) -v ./...

integration: runcimage
$(CONTAINER_ENGINE) run $(CONTAINER_ENGINE_RUN_FLAGS) \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ A third party security audit was performed by Cure53, you can see the full repor
## Building

`runc` currently supports the Linux platform with various architecture support.
It must be built with Go version 1.13 or higher.
It must be built with Go version 1.15 or higher.

In order to enable seccomp support you will need to install `libseccomp` on your platform.
> e.g. `libseccomp-devel` for CentOS, or `libseccomp-dev` for Ubuntu
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/opencontainers/runc

go 1.13
go 1.15

require (
github.com/bits-and-blooms/bitset v1.2.0
Expand Down
17 changes: 0 additions & 17 deletions libcontainer/cgroups/fs/blkio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ func TestBlkioSetWeight(t *testing.T) {
for _, legacyIOScheduler := range []bool{false, true} {
// Populate cgroup
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
weightFilename := "blkio.bfq.weight"
if legacyIOScheduler {
weightFilename = "blkio.weight"
Expand Down Expand Up @@ -215,7 +214,6 @@ func TestBlkioSetWeightDevice(t *testing.T) {
for _, legacyIOScheduler := range []bool{false, true} {
// Populate cgroup
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
weightFilename := "blkio.bfq.weight"
weightDeviceFilename := "blkio.bfq.weight_device"
if legacyIOScheduler {
Expand Down Expand Up @@ -251,7 +249,6 @@ func TestBlkioSetWeightDevice(t *testing.T) {
// regression #274
func TestBlkioSetMultipleWeightDevice(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()

const (
weightDeviceBefore = "8:0 400"
Expand Down Expand Up @@ -290,7 +287,6 @@ func TestBlkioSetMultipleWeightDevice(t *testing.T) {

func TestBlkioBFQDebugStats(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(blkioBFQDebugStatsTestFiles)
blkio := &BlkioGroup{}
actualStats := *cgroups.NewStats()
Expand Down Expand Up @@ -345,7 +341,6 @@ func TestBlkioBFQDebugStats(t *testing.T) {

func TestBlkioMultipleStatsFiles(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(blkioBFQDebugStatsTestFiles)
helper.writeFileContents(blkioCFQStatsTestFiles)
blkio := &BlkioGroup{}
Expand Down Expand Up @@ -401,7 +396,6 @@ func TestBlkioMultipleStatsFiles(t *testing.T) {

func TestBlkioBFQStats(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(blkioBFQStatsTestFiles)
blkio := &BlkioGroup{}
actualStats := *cgroups.NewStats()
Expand Down Expand Up @@ -468,7 +462,6 @@ func TestBlkioStatsNoFilesBFQDebug(t *testing.T) {

for _, testCase := range testCases {
helper := NewCgroupTestUtil("cpuset", t)
defer helper.cleanup()

tempBlkioTestFiles := map[string]string{}
for i, v := range blkioBFQDebugStatsTestFiles {
Expand All @@ -488,7 +481,6 @@ func TestBlkioStatsNoFilesBFQDebug(t *testing.T) {

func TestBlkioCFQStats(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(blkioCFQStatsTestFiles)

blkio := &BlkioGroup{}
Expand Down Expand Up @@ -584,7 +576,6 @@ func TestBlkioStatsNoFilesCFQ(t *testing.T) {

for _, testCase := range testCases {
helper := NewCgroupTestUtil("cpuset", t)
defer helper.cleanup()

tempBlkioTestFiles := map[string]string{}
for i, v := range blkioCFQStatsTestFiles {
Expand All @@ -604,7 +595,6 @@ func TestBlkioStatsNoFilesCFQ(t *testing.T) {

func TestBlkioStatsUnexpectedNumberOfFields(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"blkio.io_service_bytes_recursive": "8:0 Read 100 100",
"blkio.io_serviced_recursive": servicedRecursiveContents,
Expand All @@ -626,7 +616,6 @@ func TestBlkioStatsUnexpectedNumberOfFields(t *testing.T) {

func TestBlkioStatsUnexpectedFieldType(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"blkio.io_service_bytes_recursive": "8:0 Read Write",
"blkio.io_serviced_recursive": servicedRecursiveContents,
Expand All @@ -648,7 +637,6 @@ func TestBlkioStatsUnexpectedFieldType(t *testing.T) {

func TestThrottleRecursiveBlkioStats(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"blkio.io_service_bytes_recursive": "",
"blkio.io_serviced_recursive": "",
Expand Down Expand Up @@ -699,7 +687,6 @@ func TestThrottleRecursiveBlkioStats(t *testing.T) {

func TestThrottleBlkioStats(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"blkio.io_service_bytes_recursive": "",
"blkio.io_serviced_recursive": "",
Expand Down Expand Up @@ -750,7 +737,6 @@ func TestThrottleBlkioStats(t *testing.T) {

func TestBlkioSetThrottleReadBpsDevice(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()

const (
throttleBefore = `8:0 1024`
Expand Down Expand Up @@ -780,7 +766,6 @@ func TestBlkioSetThrottleReadBpsDevice(t *testing.T) {

func TestBlkioSetThrottleWriteBpsDevice(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()

const (
throttleBefore = `8:0 1024`
Expand Down Expand Up @@ -810,7 +795,6 @@ func TestBlkioSetThrottleWriteBpsDevice(t *testing.T) {

func TestBlkioSetThrottleReadIOpsDevice(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()

const (
throttleBefore = `8:0 1024`
Expand Down Expand Up @@ -840,7 +824,6 @@ func TestBlkioSetThrottleReadIOpsDevice(t *testing.T) {

func TestBlkioSetThrottleWriteIOpsDevice(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()

const (
throttleBefore = `8:0 1024`
Expand Down
7 changes: 1 addition & 6 deletions libcontainer/cgroups/fs/cpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

func TestCpuSetShares(t *testing.T) {
helper := NewCgroupTestUtil("cpu", t)
defer helper.cleanup()

const (
sharesBefore = 1024
Expand Down Expand Up @@ -41,7 +40,6 @@ func TestCpuSetShares(t *testing.T) {

func TestCpuSetBandWidth(t *testing.T) {
helper := NewCgroupTestUtil("cpu", t)
defer helper.cleanup()

const (
quotaBefore = 8000
Expand Down Expand Up @@ -105,7 +103,6 @@ func TestCpuSetBandWidth(t *testing.T) {

func TestCpuStats(t *testing.T) {
helper := NewCgroupTestUtil("cpu", t)
defer helper.cleanup()

const (
nrPeriods = 2000
Expand Down Expand Up @@ -137,7 +134,6 @@ func TestCpuStats(t *testing.T) {

func TestNoCpuStatFile(t *testing.T) {
helper := NewCgroupTestUtil("cpu", t)
defer helper.cleanup()

cpu := &CpuGroup{}
actualStats := *cgroups.NewStats()
Expand All @@ -149,7 +145,7 @@ func TestNoCpuStatFile(t *testing.T) {

func TestInvalidCpuStat(t *testing.T) {
helper := NewCgroupTestUtil("cpu", t)
defer helper.cleanup()

cpuStatContent := `nr_periods 2000
nr_throttled 200
throttled_time fortytwo`
Expand All @@ -167,7 +163,6 @@ func TestInvalidCpuStat(t *testing.T) {

func TestCpuSetRtSchedAtApply(t *testing.T) {
helper := NewCgroupTestUtil("cpu", t)
defer helper.cleanup()

const (
rtRuntimeBefore = 0
Expand Down
2 changes: 0 additions & 2 deletions libcontainer/cgroups/fs/cpuacct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const (

func TestCpuacctStats(t *testing.T) {
helper := NewCgroupTestUtil("cpuacct.", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"cpuacct.usage": cpuAcctUsageContents,
"cpuacct.usage_percpu": cpuAcctUsagePerCPUContents,
Expand Down Expand Up @@ -68,7 +67,6 @@ func TestCpuacctStats(t *testing.T) {

func TestCpuacctStatsWithoutUsageAll(t *testing.T) {
helper := NewCgroupTestUtil("cpuacct.", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"cpuacct.usage": cpuAcctUsageContents,
"cpuacct.usage_percpu": cpuAcctUsagePerCPUContents,
Expand Down
4 changes: 0 additions & 4 deletions libcontainer/cgroups/fs/cpuset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ var cpusetTestFiles = map[string]string{

func TestCPUSetSetCpus(t *testing.T) {
helper := NewCgroupTestUtil("cpuset", t)
defer helper.cleanup()

const (
cpusBefore = "0"
Expand Down Expand Up @@ -68,7 +67,6 @@ func TestCPUSetSetCpus(t *testing.T) {

func TestCPUSetSetMems(t *testing.T) {
helper := NewCgroupTestUtil("cpuset", t)
defer helper.cleanup()

const (
memsBefore = "0"
Expand Down Expand Up @@ -96,7 +94,6 @@ func TestCPUSetSetMems(t *testing.T) {

func TestCPUSetStatsCorrect(t *testing.T) {
helper := NewCgroupTestUtil("cpuset", t)
defer helper.cleanup()
helper.writeFileContents(cpusetTestFiles)

cpuset := &CpusetGroup{}
Expand Down Expand Up @@ -211,7 +208,6 @@ func TestCPUSetStatsMissingFiles(t *testing.T) {
} {
t.Run(testCase.desc, func(t *testing.T) {
helper := NewCgroupTestUtil("cpuset", t)
defer helper.cleanup()

tempCpusetTestFiles := map[string]string{}
for i, v := range cpusetTestFiles {
Expand Down
1 change: 0 additions & 1 deletion libcontainer/cgroups/fs/devices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

func TestDevicesSetAllow(t *testing.T) {
helper := NewCgroupTestUtil("devices", t)
defer helper.cleanup()

helper.writeFileContents(map[string]string{
"devices.allow": "",
Expand Down
2 changes: 0 additions & 2 deletions libcontainer/cgroups/fs/freezer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

func TestFreezerSetState(t *testing.T) {
helper := NewCgroupTestUtil("freezer", t)
defer helper.cleanup()

helper.writeFileContents(map[string]string{
"freezer.state": string(configs.Frozen),
Expand All @@ -34,7 +33,6 @@ func TestFreezerSetState(t *testing.T) {

func TestFreezerSetInvalidState(t *testing.T) {
helper := NewCgroupTestUtil("freezer", t)
defer helper.cleanup()

const (
invalidArg configs.FreezerState = "Invalid"
Expand Down
6 changes: 0 additions & 6 deletions libcontainer/cgroups/fs/hugetlb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const (

func TestHugetlbSetHugetlb(t *testing.T) {
helper := NewCgroupTestUtil("hugetlb", t)
defer helper.cleanup()

const (
hugetlbBefore = 256
Expand Down Expand Up @@ -67,7 +66,6 @@ func TestHugetlbSetHugetlb(t *testing.T) {

func TestHugetlbStats(t *testing.T) {
helper := NewCgroupTestUtil("hugetlb", t)
defer helper.cleanup()
for _, pageSize := range HugePageSizes {
helper.writeFileContents(map[string]string{
fmt.Sprintf(usage, pageSize): hugetlbUsageContents,
Expand All @@ -90,7 +88,6 @@ func TestHugetlbStats(t *testing.T) {

func TestHugetlbStatsNoUsageFile(t *testing.T) {
helper := NewCgroupTestUtil("hugetlb", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
maxUsage: hugetlbMaxUsageContents,
})
Expand All @@ -105,7 +102,6 @@ func TestHugetlbStatsNoUsageFile(t *testing.T) {

func TestHugetlbStatsNoMaxUsageFile(t *testing.T) {
helper := NewCgroupTestUtil("hugetlb", t)
defer helper.cleanup()
for _, pageSize := range HugePageSizes {
helper.writeFileContents(map[string]string{
fmt.Sprintf(usage, pageSize): hugetlbUsageContents,
Expand All @@ -122,7 +118,6 @@ func TestHugetlbStatsNoMaxUsageFile(t *testing.T) {

func TestHugetlbStatsBadUsageFile(t *testing.T) {
helper := NewCgroupTestUtil("hugetlb", t)
defer helper.cleanup()
for _, pageSize := range HugePageSizes {
helper.writeFileContents(map[string]string{
fmt.Sprintf(usage, pageSize): "bad",
Expand All @@ -140,7 +135,6 @@ func TestHugetlbStatsBadUsageFile(t *testing.T) {

func TestHugetlbStatsBadMaxUsageFile(t *testing.T) {
helper := NewCgroupTestUtil("hugetlb", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
usage: hugetlbUsageContents,
maxUsage: "bad",
Expand Down
Loading

0 comments on commit 1f5f237

Please sign in to comment.