Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .papr.sh
Original file line number Diff line number Diff line change
@@ -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 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also https://github.com/ostreedev/ostree/blob/master/ci/libbuild.sh - once something is packaged then you can just do pkg_install_builddeps libpod.

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
18 changes: 18 additions & 0 deletions .papr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
branches:
- master
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still have auto and try here.

- 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"
44 changes: 44 additions & 0 deletions .tool/lint
Original file line number Diff line number Diff line change
@@ -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[@]}
9 changes: 1 addition & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
43 changes: 14 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions cmd/kpod/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ 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"
)

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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/kpod/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/inspect.go
Original file line number Diff line number Diff line change
@@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kpod/pause.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
Loading