diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2017-11-02 19:35:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-02 19:35:33 -0400 |
commit | 7bb1d240281e95aeb5eb5f761823e766d2804683 (patch) | |
tree | c03a19ce82df57651218a0133d571c7887ce8b88 | |
parent | f0f5b51ff27d8eec790f2d5fc12c28c536149bb7 (diff) | |
parent | 6e37df18ef4e2750e954bf64f7dc46d57dcade3a (diff) | |
download | podman-7bb1d240281e95aeb5eb5f761823e766d2804683.tar.gz podman-7bb1d240281e95aeb5eb5f761823e766d2804683.tar.bz2 podman-7bb1d240281e95aeb5eb5f761823e766d2804683.zip |
Merge pull request #6 from rhatdan/papr
Add Papr support
50 files changed, 204 insertions, 128 deletions
diff --git a/.papr.sh b/.papr.sh new file mode 100755 index 000000000..fb837d661 --- /dev/null +++ b/.papr.sh @@ -0,0 +1,37 @@ +#!/bin/bash +set -xeuo pipefail + +export GOPATH=$HOME/gopath +export PATH=$HOME/gopath/bin:$PATH +export GOSRC=$HOME/gopath/src/github.com/projectatomic/libpod + +(mkdir -p $GOSRC && cd /code && cp -r . $GOSRC) + +dnf install -y \ + bats \ + btrfs-progs-devel \ + bzip2 \ + device-mapper-devel \ + findutils \ + git \ + glib2-devel \ + gnupg \ + golang \ + gpgme-devel \ + libassuan-devel \ + libseccomp-devel \ + libselinux-devel \ + skopeo-containers \ + runc \ + make \ + ostree-devel \ + python \ + which + +# PAPR adds a merge commit, for testing, which fails the +# short-commit-subject validation test, so tell git-validate.sh to only check +# up to, but not including, the merge commit. +export GITVALIDATE_TIP=$(cd $GOSRC; git log -2 --pretty='%H' | tail -n 1) +export TAGS="seccomp $($GOSRC/hack/btrfs_tag.sh) $($GOSRC/hack/libdm_tag.sh) $($GOSRC/hack/btrfs_installed_tag.sh) $($GOSRC/hack/ostree_tag.sh) $($GOSRC/hack/selinux_tag.sh)" +make -C $GOSRC binaries install.tools all gofmt localintegration testunit TAGS="${TAGS}" +#make -C $GOSRC lint diff --git a/.papr.yml b/.papr.yml new file mode 100644 index 000000000..d52219411 --- /dev/null +++ b/.papr.yml @@ -0,0 +1,18 @@ +branches: + - master + - auto + - try + +host: + distro: fedora/26/atomic + specs: + ram: 8192 + +required: true + +tests: + # mount yum repos to inherit injected mirrors from PAPR + - docker run --net=host --privileged -v /etc/yum.repos.d:/etc/yum.repos.d.host:ro + -v /tmp:/tmp -v /var/tmp:/var/tmp + -v $PWD:/code registry.fedoraproject.org/fedora:26 sh -c + "cp -fv /etc/yum.repos.d{.host/*.repo,} && /code/.papr.sh" diff --git a/.tool/lint b/.tool/lint new file mode 100755 index 000000000..a62044255 --- /dev/null +++ b/.tool/lint @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +# Create the linter path for use later +LINTER=${GOPATH}/bin/gometalinter + +# Make sure gometalinter is installed +if [ ! -f ${LINTER} ]; then + echo >&2 "gometalinter must be installed. Please run 'make install.tools' and try again" + exit 1 +fi + +PKGS=$(find . -type d -not -path . -a -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*' -a -not -iname 'hack' -a -not -iwholename '*.artifacts*' -a -not -iwholename '*contrib*' -a -not -iwholename '*test*' -a -not -iwholename '*logo*' -a -not -iwholename '*conmon*' -a -not -iwholename '*completions*' -a -not -iwholename '*docs*' -a -not -iwholename '*pause*') + +# Execute the linter +${LINTER} \ + --concurrency=4\ + --enable-gc\ + --vendored-linters\ + --deadline=600s --disable-all\ + --enable=deadcode\ + --enable=errcheck\ + --enable=goconst\ + --enable=gofmt\ + --enable=golint\ + --enable=ineffassign\ + --enable=interfacer\ + --enable=megacheck\ + --enable=misspell\ + --enable=structcheck\ + --enable=varcheck\ + --enable=vet\ + --enable=vetshadow\ + --exclude='error return value not checked.*\(errcheck\)$'\ + --exclude='declaration of.*err.*shadows declaration.*\(vetshadow\)$'\ + --exclude='.*_test\.go:.*error return value not checked.*\(errcheck\)$'\ + --exclude='duplicate of.*_test.go.*\(dupl\)$'\ + --exclude='cmd\/client\/.*\.go.*\(dupl\)$'\ + --exclude='vendor\/.*'\ + --exclude='server\/seccomp\/.*\.go.*$'\ + ${PKGS[@]} diff --git a/.travis.yml b/.travis.yml index be326c1ae..185cdbece 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,16 +45,9 @@ jobs: - make docs - make go: 1.9.x - - script: - - make .gitvalidation - - make gofmt - - make lint - - make testunit - - make docs - - make - go: tip - stage: Integration Test script: + - make all - make integration go: 1.8.x @@ -3,14 +3,14 @@ EPOCH_TEST_COMMIT ?= 1cc5a27 PROJECT := github.com/projectatomic/libpod GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g") -CRIO_IMAGE := crio_dev$(if $(GIT_BRANCH_CLEAN),:$(GIT_BRANCH_CLEAN)) -CRIO_INSTANCE := crio_dev +LIBPOD_IMAGE := libpod_dev$(if $(GIT_BRANCH_CLEAN),:$(GIT_BRANCH_CLEAN)) +LIBPOD_INSTANCE := libpod_dev PREFIX ?= ${DESTDIR}/usr/local BINDIR ?= ${PREFIX}/bin LIBEXECDIR ?= ${PREFIX}/libexec MANDIR ?= ${PREFIX}/share/man ETCDIR ?= ${DESTDIR}/etc -ETCDIR_CRIO ?= ${ETCDIR}/crio +ETCDIR_LIBPOD ?= ${ETCDIR}/crio BUILDTAGS ?= seccomp $(shell hack/btrfs_tag.sh) $(shell hack/libdm_tag.sh) $(shell hack/btrfs_installed_tag.sh) $(shell hack/ostree_tag.sh) $(shell hack/selinux_tag.sh) BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions @@ -89,7 +89,7 @@ ifneq ($(GOPATH),) rm -f "$(GOPATH)/.gopathok" endif rm -rf _output - rm -f docs/*.1 docs/*.5 docs/*.8 + rm -f docs/*.1 rm -fr test/testdata/redis-image find . -name \*~ -delete find . -name \#\* -delete @@ -99,22 +99,23 @@ endif rm -f test/copyimg/copyimg rm -f test/checkseccomp/checkseccomp -crioimage: - docker build -t ${CRIO_IMAGE} . +libpodimage: + docker build -t ${LIBPOD_IMAGE} . -dbuild: crioimage - docker run --name=${CRIO_INSTANCE} --privileged ${CRIO_IMAGE} -v ${PWD}:/go/src/${PROJECT} --rm make binaries +dbuild: libpodimage + docker run --name=${LIBPOD_INSTANCE} --privileged ${LIBPOD_IMAGE} -v ${PWD}:/go/src/${PROJECT} --rm make binaries -integration: crioimage - docker run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${CRIO_IMAGE} make localintegration +integration: libpodimage + docker run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} make localintegration testunit: $(GO) test -tags "$(BUILDTAGS)" -cover $(PACKAGES) -localintegration: clean binaries test-binaries +localintegration: test-binaries ./test/test_runner.sh ${TESTFLAGS} binaries: conmon kpod + test-binaries: test/bin2img/bin2img test/copyimg/copyimg test/checkseccomp/checkseccomp MANPAGES_MD := $(wildcard docs/*.md) @@ -123,12 +124,6 @@ MANPAGES := $(MANPAGES_MD:%.md=%) docs/%.1: docs/%.1.md .gopathok (go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@) || ($(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@) -docs/%.5: docs/%.5.md .gopathok - (go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@) || ($(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@) - -docs/%.8: docs/%.8.md .gopathok - (go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@) || ($(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@) - docs: $(MANPAGES) install: .gopathok install.bin install.man @@ -139,14 +134,10 @@ install.bin: install.man: install ${SELINUXOPT} -d -m 755 $(MANDIR)/man1 - install ${SELINUXOPT} -d -m 755 $(MANDIR)/man5 - install ${SELINUXOPT} -d -m 755 $(MANDIR)/man8 install ${SELINUXOPT} -m 644 $(filter %.1,$(MANPAGES)) -t $(MANDIR)/man1 - install ${SELINUXOPT} -m 644 $(filter %.5,$(MANPAGES)) -t $(MANDIR)/man5 - install ${SELINUXOPT} -m 644 $(filter %.8,$(MANPAGES)) -t $(MANDIR)/man8 install.config: - install ${SELINUXOPT} -D -m 644 seccomp.json $(ETCDIR_CRIO)/seccomp.json + install ${SELINUXOPT} -D -m 644 seccomp.json $(ETCDIR_LIBPOD)/seccomp.json install ${SELINUXOPT} -D -m 644 crio-umount.conf $(OCIUMOUNTINSTALLDIR)/crio-umount.conf install.completions: @@ -156,13 +147,7 @@ install.completions: uninstall: rm -f $(LIBEXECDIR)/crio/conmon for i in $(filter %.1,$(MANPAGES)); do \ - rm -f $(MANDIR)/man8/$$(basename $${i}); \ - done - for i in $(filter %.5,$(MANPAGES)); do \ - rm -f $(MANDIR)/man5/$$(basename $${i}); \ - done - for i in $(filter %.8,$(MANPAGES)); do \ - rm -f $(MANDIR)/man8/$$(basename $${i}); \ + rm -f $(MANDIR)/man1/$$(basename $${i}); \ done .PHONY: .gitvalidation diff --git a/cmd/kpod/common.go b/cmd/kpod/common.go index 24f20f7ed..d924f17a3 100644 --- a/cmd/kpod/common.go +++ b/cmd/kpod/common.go @@ -9,9 +9,9 @@ import ( is "github.com/containers/image/storage" "github.com/containers/storage" "github.com/fatih/camelcase" + "github.com/pkg/errors" "github.com/projectatomic/libpod/libkpod" "github.com/projectatomic/libpod/libpod" - "github.com/pkg/errors" "github.com/urfave/cli" ) @@ -19,7 +19,7 @@ var ( stores = make(map[storage.Store]struct{}) ) -const CrioConfigPath = "/etc/crio/crio.conf" +const crioConfigPath = "/etc/crio/crio.conf" func getStore(c *libkpod.Config) (storage.Store, error) { options := storage.DefaultStoreOptions @@ -66,8 +66,8 @@ func getConfig(c *cli.Context) (*libkpod.Config, error) { var configFile string if c.GlobalIsSet("config") { configFile = c.GlobalString("config") - } else if _, err := os.Stat(CrioConfigPath); err == nil { - configFile = CrioConfigPath + } else if _, err := os.Stat(crioConfigPath); err == nil { + configFile = crioConfigPath } // load and merge the configfile from the commandline or use // the default crio config file diff --git a/cmd/kpod/create.go b/cmd/kpod/create.go index 2e79c883e..ddfe9e5ed 100644 --- a/cmd/kpod/create.go +++ b/cmd/kpod/create.go @@ -5,8 +5,8 @@ import ( "strconv" "github.com/docker/go-units" - "github.com/projectatomic/libpod/libpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" ) diff --git a/cmd/kpod/diff.go b/cmd/kpod/diff.go index fc2dc8ef8..3a3b82e15 100644 --- a/cmd/kpod/diff.go +++ b/cmd/kpod/diff.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/containers/storage/pkg/archive" - "github.com/projectatomic/libpod/cmd/kpod/formats" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/kpod/formats" "github.com/urfave/cli" ) diff --git a/cmd/kpod/history.go b/cmd/kpod/history.go index ea91904ad..ab2115aed 100644 --- a/cmd/kpod/history.go +++ b/cmd/kpod/history.go @@ -8,9 +8,9 @@ import ( "github.com/containers/image/types" units "github.com/docker/go-units" - "github.com/projectatomic/libpod/cmd/kpod/formats" "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/kpod/formats" "github.com/urfave/cli" ) diff --git a/cmd/kpod/images.go b/cmd/kpod/images.go index 36727a897..0eac22864 100644 --- a/cmd/kpod/images.go +++ b/cmd/kpod/images.go @@ -9,11 +9,11 @@ import ( "github.com/containers/image/types" "github.com/containers/storage" "github.com/docker/go-units" + digest "github.com/opencontainers/go-digest" + "github.com/pkg/errors" "github.com/projectatomic/libpod/cmd/kpod/formats" "github.com/projectatomic/libpod/libpod" "github.com/projectatomic/libpod/libpod/common" - digest "github.com/opencontainers/go-digest" - "github.com/pkg/errors" "github.com/urfave/cli" ) diff --git a/cmd/kpod/info.go b/cmd/kpod/info.go index 3c634ac9c..0b8ae75b4 100644 --- a/cmd/kpod/info.go +++ b/cmd/kpod/info.go @@ -8,8 +8,8 @@ import ( "runtime" "github.com/docker/docker/pkg/system" - "github.com/projectatomic/libpod/cmd/kpod/formats" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/kpod/formats" "github.com/urfave/cli" ) diff --git a/cmd/kpod/inspect.go b/cmd/kpod/inspect.go index 78439ed89..a70e285ac 100644 --- a/cmd/kpod/inspect.go +++ b/cmd/kpod/inspect.go @@ -1,10 +1,10 @@ package main import ( + "github.com/pkg/errors" "github.com/projectatomic/libpod/cmd/kpod/formats" "github.com/projectatomic/libpod/libkpod" "github.com/projectatomic/libpod/libpod/images" - "github.com/pkg/errors" "github.com/urfave/cli" ) diff --git a/cmd/kpod/kill.go b/cmd/kpod/kill.go index 686305781..9fab7cc88 100644 --- a/cmd/kpod/kill.go +++ b/cmd/kpod/kill.go @@ -5,8 +5,8 @@ import ( "os" "github.com/docker/docker/pkg/signal" - "github.com/projectatomic/libpod/libkpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libkpod" "github.com/urfave/cli" ) diff --git a/cmd/kpod/load.go b/cmd/kpod/load.go index 392ce08ac..31975fc76 100644 --- a/cmd/kpod/load.go +++ b/cmd/kpod/load.go @@ -5,8 +5,8 @@ import ( "io/ioutil" "os" - "github.com/projectatomic/libpod/libpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/kpod/login.go b/cmd/kpod/login.go index 956de6d14..df74a2fdf 100644 --- a/cmd/kpod/login.go +++ b/cmd/kpod/login.go @@ -9,8 +9,8 @@ import ( "github.com/containers/image/docker" "github.com/containers/image/pkg/docker/config" - "github.com/projectatomic/libpod/libpod/common" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod/common" "github.com/urfave/cli" "golang.org/x/crypto/ssh/terminal" ) diff --git a/cmd/kpod/logout.go b/cmd/kpod/logout.go index 0b07f1a63..9d1d52e32 100644 --- a/cmd/kpod/logout.go +++ b/cmd/kpod/logout.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/containers/image/pkg/docker/config" - "github.com/projectatomic/libpod/libpod/common" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod/common" "github.com/urfave/cli" ) diff --git a/cmd/kpod/logs.go b/cmd/kpod/logs.go index 23c78688d..1d0cea996 100644 --- a/cmd/kpod/logs.go +++ b/cmd/kpod/logs.go @@ -4,8 +4,8 @@ import ( "fmt" "time" - "github.com/projectatomic/libpod/libkpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libkpod" "github.com/urfave/cli" ) diff --git a/cmd/kpod/mount.go b/cmd/kpod/mount.go index 4a68621ac..d9df7ffa5 100644 --- a/cmd/kpod/mount.go +++ b/cmd/kpod/mount.go @@ -4,8 +4,8 @@ import ( js "encoding/json" "fmt" - of "github.com/projectatomic/libpod/cmd/kpod/formats" "github.com/pkg/errors" + of "github.com/projectatomic/libpod/cmd/kpod/formats" "github.com/urfave/cli" ) diff --git a/cmd/kpod/pause.go b/cmd/kpod/pause.go index 510aba424..094013e6d 100644 --- a/cmd/kpod/pause.go +++ b/cmd/kpod/pause.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/projectatomic/libpod/libkpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libkpod" "github.com/urfave/cli" "os" ) diff --git a/cmd/kpod/ps.go b/cmd/kpod/ps.go index 2e981bfaa..a5f64ed11 100644 --- a/cmd/kpod/ps.go +++ b/cmd/kpod/ps.go @@ -15,10 +15,10 @@ import ( "k8s.io/apimachinery/pkg/fields" + "github.com/pkg/errors" "github.com/projectatomic/libpod/cmd/kpod/formats" "github.com/projectatomic/libpod/libkpod" "github.com/projectatomic/libpod/oci" - "github.com/pkg/errors" "github.com/urfave/cli" ) diff --git a/cmd/kpod/pull.go b/cmd/kpod/pull.go index 662bb2faa..399e8c1b4 100644 --- a/cmd/kpod/pull.go +++ b/cmd/kpod/pull.go @@ -8,9 +8,9 @@ import ( "golang.org/x/crypto/ssh/terminal" "github.com/containers/image/types" + "github.com/pkg/errors" "github.com/projectatomic/libpod/libpod" "github.com/projectatomic/libpod/libpod/common" - "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/kpod/push.go b/cmd/kpod/push.go index 518c1d8dc..4f1218a08 100644 --- a/cmd/kpod/push.go +++ b/cmd/kpod/push.go @@ -7,9 +7,9 @@ import ( "github.com/containers/image/types" "github.com/containers/storage/pkg/archive" + "github.com/pkg/errors" "github.com/projectatomic/libpod/libpod" "github.com/projectatomic/libpod/libpod/common" - "github.com/pkg/errors" "github.com/urfave/cli" "golang.org/x/crypto/ssh/terminal" ) diff --git a/cmd/kpod/rename.go b/cmd/kpod/rename.go index 68b9a6108..749dd756d 100644 --- a/cmd/kpod/rename.go +++ b/cmd/kpod/rename.go @@ -1,8 +1,8 @@ package main import ( - "github.com/projectatomic/libpod/libkpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libkpod" "github.com/urfave/cli" ) diff --git a/cmd/kpod/rm.go b/cmd/kpod/rm.go index 8f51befc9..0d3027abd 100644 --- a/cmd/kpod/rm.go +++ b/cmd/kpod/rm.go @@ -3,8 +3,8 @@ package main import ( "fmt" - "github.com/projectatomic/libpod/libkpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libkpod" "github.com/urfave/cli" "golang.org/x/net/context" ) diff --git a/cmd/kpod/run.go b/cmd/kpod/run.go index bf9375d95..f1563edc3 100644 --- a/cmd/kpod/run.go +++ b/cmd/kpod/run.go @@ -3,8 +3,8 @@ package main import ( "fmt" - "github.com/projectatomic/libpod/libpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/kpod/save.go b/cmd/kpod/save.go index 55998fe4d..287821f0a 100644 --- a/cmd/kpod/save.go +++ b/cmd/kpod/save.go @@ -4,8 +4,8 @@ import ( "io" "os" - "github.com/projectatomic/libpod/libpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/kpod/spec.go b/cmd/kpod/spec.go index 4b05005bd..b6fb8b128 100644 --- a/cmd/kpod/spec.go +++ b/cmd/kpod/spec.go @@ -4,10 +4,10 @@ import ( "fmt" "strings" - "github.com/projectatomic/libpod/libpod" - ann "github.com/projectatomic/libpod/pkg/annotations" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod" + ann "github.com/projectatomic/libpod/pkg/annotations" "github.com/sirupsen/logrus" "github.com/urfave/cli" "golang.org/x/sys/unix" @@ -15,84 +15,84 @@ import ( // Parses information needed to create a container into an OCI runtime spec func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { - spec := config.GetDefaultLinuxSpec() - spec.Process.Cwd = config.workDir - spec.Process.Args = config.command + configSpec := config.GetDefaultLinuxSpec() + configSpec.Process.Cwd = config.workDir + configSpec.Process.Args = config.command - spec.Process.Terminal = config.tty + configSpec.Process.Terminal = config.tty // User and Group must go together - spec.Process.User.UID = config.user - spec.Process.User.GID = config.group - spec.Process.User.AdditionalGids = config.groupAdd + configSpec.Process.User.UID = config.user + configSpec.Process.User.GID = config.group + configSpec.Process.User.AdditionalGids = config.groupAdd - spec.Process.Env = config.env + configSpec.Process.Env = config.env //TODO // Need examples of capacity additions so I can load that properly - spec.Root.Readonly = config.readOnlyRootfs - spec.Hostname = config.hostname + configSpec.Root.Readonly = config.readOnlyRootfs + configSpec.Hostname = config.hostname // BIND MOUNTS - spec.Mounts = append(spec.Mounts, config.GetVolumeMounts()...) + configSpec.Mounts = append(configSpec.Mounts, config.GetVolumeMounts()...) // TMPFS MOUNTS - spec.Mounts = append(spec.Mounts, config.GetTmpfsMounts()...) + configSpec.Mounts = append(configSpec.Mounts, config.GetTmpfsMounts()...) // RESOURCES - MEMORY - spec.Linux.Sysctl = config.sysctl + configSpec.Linux.Sysctl = config.sysctl if config.resources.memory != 0 { - spec.Linux.Resources.Memory.Limit = &config.resources.memory + configSpec.Linux.Resources.Memory.Limit = &config.resources.memory } if config.resources.memoryReservation != 0 { - spec.Linux.Resources.Memory.Reservation = &config.resources.memoryReservation + configSpec.Linux.Resources.Memory.Reservation = &config.resources.memoryReservation } if config.resources.memorySwap != 0 { - spec.Linux.Resources.Memory.Swap = &config.resources.memorySwap + configSpec.Linux.Resources.Memory.Swap = &config.resources.memorySwap } if config.resources.kernelMemory != 0 { - spec.Linux.Resources.Memory.Kernel = &config.resources.kernelMemory + configSpec.Linux.Resources.Memory.Kernel = &config.resources.kernelMemory } if config.resources.memorySwapiness != 0 { - spec.Linux.Resources.Memory.Swappiness = &config.resources.memorySwapiness + configSpec.Linux.Resources.Memory.Swappiness = &config.resources.memorySwapiness } if config.resources.disableOomKiller { - spec.Linux.Resources.Memory.DisableOOMKiller = &config.resources.disableOomKiller + configSpec.Linux.Resources.Memory.DisableOOMKiller = &config.resources.disableOomKiller } // RESOURCES - CPU if config.resources.cpuShares != 0 { - spec.Linux.Resources.CPU.Shares = &config.resources.cpuShares + configSpec.Linux.Resources.CPU.Shares = &config.resources.cpuShares } if config.resources.cpuQuota != 0 { - spec.Linux.Resources.CPU.Quota = &config.resources.cpuQuota + configSpec.Linux.Resources.CPU.Quota = &config.resources.cpuQuota } if config.resources.cpuPeriod != 0 { - spec.Linux.Resources.CPU.Period = &config.resources.cpuPeriod + configSpec.Linux.Resources.CPU.Period = &config.resources.cpuPeriod } if config.resources.cpuRtRuntime != 0 { - spec.Linux.Resources.CPU.RealtimeRuntime = &config.resources.cpuRtRuntime + configSpec.Linux.Resources.CPU.RealtimeRuntime = &config.resources.cpuRtRuntime } if config.resources.cpuRtPeriod != 0 { - spec.Linux.Resources.CPU.RealtimePeriod = &config.resources.cpuRtPeriod + configSpec.Linux.Resources.CPU.RealtimePeriod = &config.resources.cpuRtPeriod } if config.resources.cpus != "" { - spec.Linux.Resources.CPU.Cpus = config.resources.cpus + configSpec.Linux.Resources.CPU.Cpus = config.resources.cpus } if config.resources.cpusetMems != "" { - spec.Linux.Resources.CPU.Mems = config.resources.cpusetMems + configSpec.Linux.Resources.CPU.Mems = config.resources.cpusetMems } // RESOURCES - PIDS if config.resources.pidsLimit != 0 { - spec.Linux.Resources.Pids.Limit = config.resources.pidsLimit + configSpec.Linux.Resources.Pids.Limit = config.resources.pidsLimit } /* - Capabilities: &spec.LinuxCapabilities{ + Capabilities: &configSpec.LinuxCapabilities{ // Rlimits []PosixRlimit // Where does this come from // Type string // Hard uint64 @@ -102,13 +102,13 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { OOMScoreAdj: &config.resources.oomScoreAdj, // Selinuxlabel }, - Hooks: &spec.Hooks{}, + Hooks: &configSpec.Hooks{}, //Annotations - Resources: &spec.LinuxResources{ + Resources: &configSpec.LinuxResources{ Devices: config.GetDefaultDevices(), BlockIO: &blkio, //HugepageLimits: - Network: &spec.LinuxNetwork{ + Network: &configSpec.LinuxNetwork{ // ClassID *uint32 // Priorites []LinuxInterfacePriority }, @@ -116,7 +116,7 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { //CgroupsPath: //Namespaces: []LinuxNamespace //Devices - Seccomp: &spec.LinuxSeccomp{ + Seccomp: &configSpec.LinuxSeccomp{ // DefaultAction: // Architectures // Syscalls: @@ -129,7 +129,7 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { }, } */ - return &spec, nil + return &configSpec, nil } func (c *createConfig) CreateBlockIO() (spec.LinuxBlockIO, error) { diff --git a/cmd/kpod/stats.go b/cmd/kpod/stats.go index 8548354a9..37cd9090b 100644 --- a/cmd/kpod/stats.go +++ b/cmd/kpod/stats.go @@ -11,9 +11,9 @@ import ( "github.com/docker/go-units" tm "github.com/buger/goterm" + "github.com/pkg/errors" "github.com/projectatomic/libpod/libkpod" "github.com/projectatomic/libpod/oci" - "github.com/pkg/errors" "github.com/urfave/cli" ) diff --git a/cmd/kpod/stop.go b/cmd/kpod/stop.go index 68e4be472..79325da5f 100644 --- a/cmd/kpod/stop.go +++ b/cmd/kpod/stop.go @@ -4,8 +4,8 @@ import ( "fmt" "os" - "github.com/projectatomic/libpod/libkpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libkpod" "github.com/urfave/cli" "golang.org/x/net/context" ) diff --git a/cmd/kpod/tag.go b/cmd/kpod/tag.go index b5853ec14..f29c8c182 100644 --- a/cmd/kpod/tag.go +++ b/cmd/kpod/tag.go @@ -3,8 +3,8 @@ package main import ( "github.com/containers/image/docker/reference" "github.com/containers/storage" - "github.com/projectatomic/libpod/libpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/kpod/unpause.go b/cmd/kpod/unpause.go index a17e70753..47a2e3778 100644 --- a/cmd/kpod/unpause.go +++ b/cmd/kpod/unpause.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/projectatomic/libpod/libkpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libkpod" "github.com/urfave/cli" "os" ) diff --git a/cmd/kpod/wait.go b/cmd/kpod/wait.go index 7557bea49..5e8a50e13 100644 --- a/cmd/kpod/wait.go +++ b/cmd/kpod/wait.go @@ -4,8 +4,8 @@ import ( "fmt" "os" - "github.com/projectatomic/libpod/libkpod" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libkpod" "github.com/urfave/cli" ) diff --git a/libkpod/config.go b/libkpod/config.go index 09bd3f5b9..84d3ce897 100644 --- a/libkpod/config.go +++ b/libkpod/config.go @@ -5,8 +5,8 @@ import ( "io/ioutil" "github.com/BurntSushi/toml" - "github.com/projectatomic/libpod/oci" "github.com/opencontainers/selinux/go-selinux" + "github.com/projectatomic/libpod/oci" ) // Default paths if none are specified diff --git a/libkpod/container.go b/libkpod/container.go index 7afcfa009..e0ff348d0 100644 --- a/libkpod/container.go +++ b/libkpod/container.go @@ -4,10 +4,10 @@ import ( "fmt" cstorage "github.com/containers/storage" + "github.com/pkg/errors" "github.com/projectatomic/libpod/libkpod/sandbox" "github.com/projectatomic/libpod/oci" "github.com/projectatomic/libpod/pkg/registrar" - "github.com/pkg/errors" ) // GetStorageContainer searches for a container with the given name or ID in the given store diff --git a/libkpod/container_data.go b/libkpod/container_data.go index 2c5913589..eb84aa42d 100644 --- a/libkpod/container_data.go +++ b/libkpod/container_data.go @@ -8,12 +8,12 @@ import ( "k8s.io/apimachinery/pkg/fields" pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" - "github.com/projectatomic/libpod/libpod/driver" - "github.com/projectatomic/libpod/libpod/images" - "github.com/projectatomic/libpod/oci" "github.com/opencontainers/image-spec/specs-go/v1" specs "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod/driver" + "github.com/projectatomic/libpod/libpod/images" + "github.com/projectatomic/libpod/oci" ) // ContainerData handles the data used when inspecting a container diff --git a/libkpod/container_server.go b/libkpod/container_server.go index 067b5a906..8e0e09978 100644 --- a/libkpod/container_server.go +++ b/libkpod/container_server.go @@ -12,16 +12,16 @@ import ( cstorage "github.com/containers/storage" "github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/truncindex" - "github.com/projectatomic/libpod/libkpod/sandbox" - "github.com/projectatomic/libpod/oci" - "github.com/projectatomic/libpod/pkg/annotations" - "github.com/projectatomic/libpod/pkg/registrar" - "github.com/projectatomic/libpod/pkg/storage" "github.com/opencontainers/runc/libcontainer" rspec "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/selinux/go-selinux" "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libkpod/sandbox" + "github.com/projectatomic/libpod/oci" + "github.com/projectatomic/libpod/pkg/annotations" + "github.com/projectatomic/libpod/pkg/registrar" + "github.com/projectatomic/libpod/pkg/storage" "github.com/sirupsen/logrus" pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" ) diff --git a/libkpod/kill.go b/libkpod/kill.go index fe7fbc2ba..74c525818 100644 --- a/libkpod/kill.go +++ b/libkpod/kill.go @@ -2,9 +2,9 @@ package libkpod import ( "github.com/docker/docker/pkg/signal" + "github.com/pkg/errors" "github.com/projectatomic/libpod/oci" "github.com/projectatomic/libpod/utils" - "github.com/pkg/errors" "os" "syscall" ) diff --git a/libkpod/pause.go b/libkpod/pause.go index 221c2591f..e2e844b58 100644 --- a/libkpod/pause.go +++ b/libkpod/pause.go @@ -1,8 +1,8 @@ package libkpod import ( - "github.com/projectatomic/libpod/oci" "github.com/pkg/errors" + "github.com/projectatomic/libpod/oci" ) // ContainerPause pauses a running container. diff --git a/libkpod/remove.go b/libkpod/remove.go index 9f6ba2a49..529348840 100644 --- a/libkpod/remove.go +++ b/libkpod/remove.go @@ -4,8 +4,8 @@ import ( "os" "path/filepath" - "github.com/projectatomic/libpod/oci" "github.com/pkg/errors" + "github.com/projectatomic/libpod/oci" "golang.org/x/net/context" ) diff --git a/libkpod/rename.go b/libkpod/rename.go index 49f7f18c4..cdb2bfc04 100644 --- a/libkpod/rename.go +++ b/libkpod/rename.go @@ -7,9 +7,9 @@ import ( "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" "github.com/docker/docker/pkg/ioutils" + "github.com/opencontainers/runtime-tools/generate" "github.com/projectatomic/libpod/oci" "github.com/projectatomic/libpod/pkg/annotations" - "github.com/opencontainers/runtime-tools/generate" ) const configFile = "config.json" diff --git a/libkpod/stats.go b/libkpod/stats.go index bf49a80ab..8e74577d4 100644 --- a/libkpod/stats.go +++ b/libkpod/stats.go @@ -7,8 +7,8 @@ import ( "strings" - "github.com/projectatomic/libpod/oci" "github.com/opencontainers/runc/libcontainer" + "github.com/projectatomic/libpod/oci" ) // ContainerStats contains the statistics information for a running container diff --git a/libkpod/stop.go b/libkpod/stop.go index 5ab974634..4ce7db740 100644 --- a/libkpod/stop.go +++ b/libkpod/stop.go @@ -1,8 +1,8 @@ package libkpod import ( - "github.com/projectatomic/libpod/oci" "github.com/pkg/errors" + "github.com/projectatomic/libpod/oci" "golang.org/x/net/context" ) diff --git a/libkpod/wait.go b/libkpod/wait.go index a2e3669c7..e972a0ba0 100644 --- a/libkpod/wait.go +++ b/libkpod/wait.go @@ -1,8 +1,8 @@ package libkpod import ( - "github.com/projectatomic/libpod/oci" "github.com/pkg/errors" + "github.com/projectatomic/libpod/oci" "k8s.io/apimachinery/pkg/util/wait" ) diff --git a/libpod/container.go b/libpod/container.go index 50fe18939..9f9d4ef3e 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -10,14 +10,13 @@ import ( "github.com/containers/storage" "github.com/docker/docker/pkg/stringid" - crioAnnotations "github.com/projectatomic/libpod/pkg/annotations" + "github.com/docker/docker/pkg/term" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" + crioAnnotations "github.com/projectatomic/libpod/pkg/annotations" "github.com/sirupsen/logrus" "github.com/ulule/deepcopier" - "github.com/docker/docker/pkg/term" "k8s.io/client-go/tools/remotecommand" - ) // ContainerState represents the current state of a container diff --git a/libpod/container_attach.go b/libpod/container_attach.go index 0063058a2..e308df4a4 100644 --- a/libpod/container_attach.go +++ b/libpod/container_attach.go @@ -9,8 +9,8 @@ import ( "strconv" "github.com/docker/docker/pkg/term" - "github.com/projectatomic/libpod/utils" "github.com/pkg/errors" + "github.com/projectatomic/libpod/utils" "github.com/sirupsen/logrus" "golang.org/x/sys/unix" "k8s.io/client-go/tools/remotecommand" diff --git a/libpod/diff.go b/libpod/diff.go index 571c58de8..cd64520a8 100644 --- a/libpod/diff.go +++ b/libpod/diff.go @@ -2,8 +2,8 @@ package libpod import ( "github.com/containers/storage/pkg/archive" - "github.com/projectatomic/libpod/libpod/layers" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod/layers" ) // GetDiff returns the differences between the two images, layers, or containers diff --git a/libpod/images/image_data.go b/libpod/images/image_data.go index 0295578c5..b64ac557f 100644 --- a/libpod/images/image_data.go +++ b/libpod/images/image_data.go @@ -9,10 +9,10 @@ import ( "github.com/containers/image/transports" "github.com/containers/image/types" "github.com/containers/storage" - "github.com/projectatomic/libpod/libpod/driver" digest "github.com/opencontainers/go-digest" ociv1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod/driver" ) // Data handles the data used when inspecting a container diff --git a/libpod/in_memory_state.go b/libpod/in_memory_state.go index e815dce3c..dd193f57b 100644 --- a/libpod/in_memory_state.go +++ b/libpod/in_memory_state.go @@ -2,8 +2,8 @@ package libpod import ( "github.com/docker/docker/pkg/truncindex" - "github.com/projectatomic/libpod/pkg/registrar" "github.com/pkg/errors" + "github.com/projectatomic/libpod/pkg/registrar" ) // An InMemoryState is a purely in-memory state store diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go index a058380a1..d291840e9 100644 --- a/libpod/runtime_img.go +++ b/libpod/runtime_img.go @@ -23,10 +23,10 @@ import ( "github.com/containers/image/types" "github.com/containers/storage" "github.com/containers/storage/pkg/archive" - "github.com/projectatomic/libpod/libpod/common" digest "github.com/opencontainers/go-digest" ociv1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod/common" ) // Runtime API diff --git a/oci/oci.go b/oci/oci.go index 2ad66f69f..2e7e44b84 100644 --- a/oci/oci.go +++ b/oci/oci.go @@ -14,8 +14,8 @@ import ( "time" "github.com/containerd/cgroups" - "github.com/projectatomic/libpod/utils" rspec "github.com/opencontainers/runtime-spec/specs-go" + "github.com/projectatomic/libpod/utils" "github.com/sirupsen/logrus" "golang.org/x/net/context" "golang.org/x/sys/unix" |