mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
@@ -3,3 +3,7 @@
|
||||
run:
|
||||
build-tags:
|
||||
- seccomp
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- gofmt
|
||||
|
||||
@@ -14,10 +14,6 @@ COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true)
|
||||
COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),"$(COMMIT_NO)-dirty","$(COMMIT_NO)")
|
||||
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)))
|
||||
@@ -25,9 +21,9 @@ ifeq ($(shell $(GO) env GOOS),linux)
|
||||
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
|
||||
@@ -54,8 +50,7 @@ dbuild: runcimage
|
||||
$(RUNC_IMAGE) make clean all
|
||||
|
||||
lint:
|
||||
$(GO) vet $(MOD_VENDOR) ./...
|
||||
$(GO) fmt $(MOD_VENDOR) ./...
|
||||
golangci-lint run ./...
|
||||
|
||||
man:
|
||||
man/md2man-all.sh
|
||||
@@ -75,7 +70,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) \
|
||||
@@ -120,9 +115,7 @@ clean:
|
||||
rm -rf man/man8
|
||||
|
||||
validate:
|
||||
script/validate-gofmt
|
||||
script/validate-c
|
||||
$(GO) vet $(MOD_VENDOR) ./...
|
||||
|
||||
shellcheck:
|
||||
shellcheck tests/integration/*.bats tests/integration/*.sh tests/*.sh
|
||||
@@ -132,8 +125,6 @@ shfmt:
|
||||
shfmt -ln bats -d -w tests/integration/*.bats
|
||||
shfmt -ln bash -d -w man/*.sh script/* tests/*.sh tests/integration/*.bash
|
||||
|
||||
ci: validate test release
|
||||
|
||||
vendor:
|
||||
$(GO) mod tidy
|
||||
$(GO) mod vendor
|
||||
@@ -159,5 +150,5 @@ localcross:
|
||||
.PHONY: runc all recvtty static release dbuild lint man runcimage \
|
||||
test localtest unittest localunittest integration localintegration \
|
||||
rootlessintegration localrootlessintegration shell install install-bash \
|
||||
install-man clean validate ci shfmt shellcheck \
|
||||
install-man clean validate shfmt shellcheck \
|
||||
vendor verify-dependencies cross localcross
|
||||
|
||||
@@ -28,7 +28,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.14 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
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.validate"
|
||||
|
||||
IFS=$'\n'
|
||||
files=($(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true))
|
||||
unset IFS
|
||||
|
||||
badFiles=()
|
||||
for f in "${files[@]}"; do
|
||||
# we use "git show" here to validate that what's committed is formatted
|
||||
if [ "$(git show "$VALIDATE_HEAD:$f" | gofmt -s -l)" ]; then
|
||||
badFiles+=("$f")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#badFiles[@]} -eq 0 ]; then
|
||||
echo 'Congratulations! All Go source files are properly formatted.'
|
||||
else
|
||||
{
|
||||
echo "These files are not properly gofmt'd:"
|
||||
for f in "${badFiles[@]}"; do
|
||||
echo " - $f"
|
||||
done
|
||||
echo
|
||||
echo 'Please reformat the above files using "gofmt -s -w" and commit the result.'
|
||||
echo
|
||||
} >&2
|
||||
false
|
||||
fi
|
||||
Reference in New Issue
Block a user