0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

Merge pull request #113 from rchincha/s2

stacker: fix stacker build
This commit is contained in:
Ramkumar Chinchani 2020-07-14 20:08:18 -07:00 committed by GitHub
commit 728eb7f6fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 6 deletions

View file

@ -4,6 +4,7 @@ COMMIT_HASH=$(shell git describe --always --tags --long)
COMMIT=$(if $(shell git status --porcelain --untracked-files=no),$(COMMIT_HASH)-dirty,$(COMMIT_HASH))
CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
PATH := bin:$(PATH)
TMPDIR := $(shell mktemp -d)
.PHONY: all
all: doc binary debug test check
@ -53,7 +54,7 @@ binary-container:
.PHONY: binary-stacker
binary-stacker:
stacker build --substitute PWD=$$PWD --no-cache
stacker build --roots ${TMPDIR} --substitute PWD=$$PWD
.PHONY: image
image:

View file

@ -503,7 +503,9 @@ func TestNegativeCases(t *testing.T) {
os.RemoveAll(dir)
So(storage.NewImageStore(dir, true, true, log.Logger{Logger: zerolog.New(os.Stdout)}), ShouldNotBeNil)
So(storage.NewImageStore("/deadBEEF", true, true, log.Logger{Logger: zerolog.New(os.Stdout)}), ShouldBeNil)
if os.Geteuid() != 0 {
So(storage.NewImageStore("/deadBEEF", true, true, log.Logger{Logger: zerolog.New(os.Stdout)}), ShouldBeNil)
}
})
Convey("Invalid init repo", t, func(c C) {
@ -515,7 +517,9 @@ func TestNegativeCases(t *testing.T) {
il := storage.NewImageStore(dir, true, true, log.Logger{Logger: zerolog.New(os.Stdout)})
err = os.Chmod(dir, 0000) // remove all perms
So(err, ShouldBeNil)
So(func() { _ = il.InitRepo("test") }, ShouldPanic)
if os.Geteuid() != 0 {
So(func() { _ = il.InitRepo("test") }, ShouldPanic)
}
})
Convey("Invalid validate repo", t, func(c C) {
@ -539,7 +543,9 @@ func TestNegativeCases(t *testing.T) {
So(err, ShouldNotBeNil)
err = os.Chmod(dir, 0000) // remove all perms
So(err, ShouldBeNil)
So(func() { _, _ = il.ValidateRepo("test") }, ShouldPanic)
if os.Geteuid() != 0 {
So(func() { _, _ = il.ValidateRepo("test") }, ShouldPanic)
}
os.RemoveAll(dir)
_, err = il.GetRepositories()
So(err, ShouldNotBeNil)

View file

@ -1,7 +1,7 @@
build:
from:
type: docker
url: docker://golang:1.12.8
url: docker://golang:1.14.4
binds:
- ${{PWD}} -> /go/src/github.com/anuvu/zot
run: |
@ -11,6 +11,16 @@ build:
export PATH='/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
go get -u github.com/swaggo/swag/cmd/swag
cd /go/src/github.com/anuvu/zot
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.17.1
go get -u -v -d ./...
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.26.0
make
build_only: true
zot:
from:
type: docker
url: docker://centos:latest
import:
- ${{PWD}}/bin/zot
run: |
cp /stacker/zot /usr/bin/zot