Merge branch 'master' into doc

This commit is contained in:
Ramkumar Chinchani 2020-12-21 16:17:09 -08:00 committed by GitHub
commit 47197608ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 10 additions and 3299 deletions

View File

@ -13,13 +13,8 @@ matrix:
notifications:
email: false
cache:
directories:
- $HOME/.bzrepos
- $HOME/.cache/bazel
install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget -N https://github.com/bazelbuild/bazel/releases/download/3.0.0/bazel-3.0.0-installer-linux-x86_64.sh && chmod +x bazel-3.0.0-installer-linux-x86_64.sh && ./bazel-3.0.0-installer-linux-x86_64.sh --user; go get -u github.com/swaggo/swag/cmd/swag; go mod download; sudo apt-get update; sudo apt-get install rpm; sudo apt install snapd; sudo snap install skopeo --edge --devmode; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go get -u github.com/swaggo/swag/cmd/swag; go mod download; sudo apt-get update; sudo apt-get install rpm; sudo apt install snapd; sudo snap install skopeo --edge --devmode; fi
script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis_wait 60 make; fi

View File

@ -1,100 +0,0 @@
# Disable build files generation for these directories
# gazelle:exclude vendor/github.com/bazelbuild/buildtools/buildifier2
# gazelle:exclude vendor/golang.org/x/tools/cmd/fiximports/testdata
# gazelle:exclude vendor/golang.org/x/tools/go/gcimporter15/testdata
# gazelle:exclude vendor/golang.org/x/tools/go/internal/gccgoimporter/testdata
# gazelle:exclude vendor/golang.org/x/tools/go/loader/testdata
# gazelle:exclude vendor/golang.org/x/tools/go/internal/gcimporter/testdata
# gazelle:resolve proto go github.com/grpc-ecosystem/grpc-gateway/internal //internal:go_default_library
# gazelle:proto disable_global
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@com_github_atlassian_bazel_tools//buildozer:def.bzl", "buildozer")
load("@com_github_atlassian_bazel_tools//goimports:def.bzl", "goimports")
load("@com_github_atlassian_bazel_tools//golangcilint:def.bzl", "golangcilint")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "nogo")
gazelle(
name = "gazelle",
build_tags = ["jsoniter"],
external = "external",
extra_args = ["-exclude=vendor"],
gazelle = "@bazel_gazelle//cmd/gazelle:gazelle_pure",
prefix = "github.com/anuvu/zot",
)
gazelle(
name = "gazelle_fix",
build_tags = ["jsoniter"],
command = "fix",
external = "external",
extra_args = ["-exclude=vendor"],
gazelle = "@bazel_gazelle//cmd/gazelle:gazelle_pure",
prefix = "github.com/anuvu/zot",
)
buildifier(
name = "buildifier",
exclude_patterns = ["./vendor/*"],
)
buildifier(
name = "buildifier_check",
exclude_patterns = ["./vendor/*"],
mode = "check",
)
buildifier(
name = "buildifier_fix",
lint_mode = "fix",
)
buildozer(
name = "buildozer",
commands = ".bazel/buildozer_commands.txt",
)
goimports(
name = "goimports",
display_diffs = True,
exclude_files = [
"zz_generated.*",
],
exclude_paths = [
"./vendor/*",
],
prefix = "github.com/anuvu/zot",
write = True,
)
golangcilint(
name = "golangcilint",
config = ".bazel/golangcilint.yaml",
paths = [
"./...",
],
prefix = "github.com/anuvu/zot",
)
nogo(
name = "nogo",
config = ".bazel/nogo-config.json",
vet = True,
visibility = ["//visibility:public"],
)
go_library(
name = "go_default_library",
srcs = ["zot.go"],
importpath = "github.com/anuvu/zot",
visibility = ["//visibility:public"],
)
filegroup(
name = "exported_testdata",
srcs = glob([
"test/data/**",
]),
visibility = ["//visibility:public"],
)

View File

@ -24,7 +24,7 @@ debug: doc
.PHONY: test
test:
$(shell mkdir -p test/data; cd test/data; ../scripts/gen_certs.sh; cd ${TOP_LEVEL}; sudo skopeo --insecure-policy copy -q docker://centos:latest oci:${TOP_LEVEL}/test/data/zot-test:0.0.1;sudo skopeo --insecure-policy copy -q docker://centos:8 oci:${TOP_LEVEL}/test/data/zot-cve-test:0.0.1)
$(shell mkdir -p test/data; cd test/data; ../scripts/gen_certs.sh; cd ${TOP_LEVEL}; sudo skopeo --insecure-policy copy -q docker://public.ecr.aws/t0x7q1g8/centos:7 oci:${TOP_LEVEL}/test/data/zot-test:0.0.1;sudo skopeo --insecure-policy copy -q docker://public.ecr.aws/t0x7q1g8/centos:8 oci:${TOP_LEVEL}/test/data/zot-cve-test:0.0.1)
go test -tags extended -v -race -cover -coverpkg ./... -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: covhtml

View File

@ -3,6 +3,9 @@
**zot** is a vendor-neutral OCI image repository server purely based on
[OCI Distribution Specification](https://github.com/opencontainers/distribution-spec).
https://anuvu.github.io/zot/
# Features
* Conforms to [OCI distribution spec](https://github.com/opencontainers/distribution-spec) APIs [![zot](https://github.com/opencontainers/oci-conformance/workflows/zot-1/badge.svg)](https://github.com/opencontainers/oci-conformance/tree/master/distribution-spec#anuvu/zot)
* Uses [OCI image layout](https://github.com/opencontainers/image-spec/blob/master/image-layout.md) for image storage
* Supports [helm charts](https://helm.sh/docs/topics/registries/)

2849
WORKSPACE

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/anuvu/zot/cmd/zot",
visibility = ["//visibility:private"],
deps = ["//pkg/cli:go_default_library"],
)
go_binary(
name = "zot",
embed = [":go_default_library"],
gotags = ["extended"],
visibility = ["//visibility:public"],
)
go_test(
name = "go_default_test",
timeout = "short",
srcs = ["main_test.go"],
embed = [":go_default_library"],
race = "on",
deps = [
"//pkg/api:go_default_library",
"//pkg/cli:go_default_library",
"@com_github_smartystreets_goconvey//convey:go_default_library",
],
)

View File

@ -1,12 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["docs.go"],
importpath = "github.com/anuvu/zot/docs",
visibility = ["//visibility:public"],
deps = [
"@com_github_alecthomas_template//:go_default_library",
"@com_github_swaggo_swag//:go_default_library",
],
)

View File

@ -1,8 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["errors.go"],
importpath = "github.com/anuvu/zot/errors",
visibility = ["//visibility:public"],
)

View File

@ -1,57 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = [
"auth.go",
"config.go",
"controller.go",
"errors.go",
"ldap.go",
"regexp.go",
"routes.go",
],
importpath = "github.com/anuvu/zot/pkg/api",
visibility = ["//visibility:public"],
deps = [
"//docs:go_default_library",
"//errors:go_default_library",
"//pkg/extensions:go_default_library",
"//pkg/log:go_default_library",
"//pkg/storage:go_default_library",
"@com_github_chartmuseum_auth//:go_default_library",
"@com_github_getlantern_deepcopy//:go_default_library",
"@com_github_go_ldap_ldap_v3//:go_default_library",
"@com_github_gorilla_handlers//:go_default_library",
"@com_github_gorilla_mux//:go_default_library",
"@com_github_json_iterator_go//:go_default_library",
"@com_github_opencontainers_distribution_spec//:go_default_library",
"@com_github_opencontainers_image_spec//specs-go/v1:go_default_library",
"@com_github_swaggo_http_swagger//:go_default_library",
"@org_golang_x_crypto//bcrypt:go_default_library",
],
)
go_test(
name = "go_default_test",
timeout = "long",
srcs = ["controller_test.go"],
data = [
"//:exported_testdata",
],
embed = [":go_default_library"],
gotags = ["extended"],
race = "on",
deps = [
"//errors:go_default_library",
"@com_github_chartmuseum_auth//:go_default_library",
"@com_github_mitchellh_mapstructure//:go_default_library",
"@com_github_nmcclain_ldap//:go_default_library",
"@com_github_opencontainers_go_digest//:go_default_library",
"@com_github_opencontainers_image_spec//specs-go/v1:go_default_library",
"@com_github_smartystreets_goconvey//convey:go_default_library",
"@com_github_stretchr_testify//assert:go_default_library",
"@in_gopkg_resty_v1//:go_default_library",
"@org_golang_x_crypto//bcrypt:go_default_library",
],
)

View File

@ -1,60 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = [
"cli.go",
"client.go",
"config_cmd.go",
"cve_cmd.go",
"image_cmd.go",
"minimal.go",
"root.go",
"searcher.go",
"service.go",
],
importpath = "github.com/anuvu/zot/pkg/cli",
visibility = ["//visibility:public"],
deps = [
"//errors:go_default_library",
"//pkg/api:go_default_library",
"//pkg/storage:go_default_library",
"@com_github_briandowns_spinner//:go_default_library",
"@com_github_dustin_go_humanize//:go_default_library",
"@com_github_json_iterator_go//:go_default_library",
"@com_github_mitchellh_mapstructure//:go_default_library",
"@com_github_olekukonko_tablewriter//:go_default_library",
"@com_github_opencontainers_distribution_spec//:go_default_library",
"@com_github_rs_zerolog//log:go_default_library",
"@com_github_spf13_cobra//:go_default_library",
"@com_github_spf13_viper//:go_default_library",
"@in_gopkg_yaml_v2//:go_default_library",
],
)
go_test(
name = "go_default_test",
timeout = "moderate",
srcs = [
"config_cmd_test.go",
"cve_cmd_test.go",
"image_cmd_test.go",
"root_test.go",
],
data = [
"//:exported_testdata",
],
embed = [":go_default_library"],
gotags = ["extended"],
race = "on",
deps = [
"//errors:go_default_library",
"//pkg/api:go_default_library",
"//pkg/compliance/v1_0_0:go_default_library",
"//pkg/extensions:go_default_library",
"@com_github_opencontainers_go_digest//:go_default_library",
"@com_github_opencontainers_image_spec//specs-go/v1:go_default_library",
"@com_github_smartystreets_goconvey//convey:go_default_library",
"@in_gopkg_resty_v1//:go_default_library",
],
)

View File

@ -367,7 +367,7 @@ func TestServerCVEResponse(t *testing.T) {
})
Convey("Test images by CVE ID", t, func() {
args := []string{"cvetest", "--cve-id", "CVE-2019-20807"}
args := []string{"cvetest", "--cve-id", "CVE-2019-9923"}
configPath := makeConfigFile(fmt.Sprintf(`{"configs":[{"_name":"cvetest","url":"%s","showspinner":false}]}`, url))
defer os.Remove(configPath)
cveCmd := NewCveCommand(new(searchService))
@ -380,7 +380,7 @@ func TestServerCVEResponse(t *testing.T) {
str := space.ReplaceAllString(buff.String(), " ")
str = strings.TrimSpace(str)
So(err, ShouldBeNil)
So(str, ShouldEqual, "IMAGE NAME TAG DIGEST SIZE zot-cve-test 0.0.1 da0186c7 75MB")
So(str, ShouldEqual, "IMAGE NAME TAG DIGEST SIZE zot-cve-test 0.0.1 63a795ca 75MB")
Convey("invalid CVE ID", func() {
args := []string{"cvetest", "--cve-id", "invalid"}
configPath := makeConfigFile(fmt.Sprintf(`{"configs":[{"_name":"cvetest","url":"%s","showspinner":false}]}`, url))
@ -400,7 +400,7 @@ func TestServerCVEResponse(t *testing.T) {
})
Convey("Test fixed tags by and image name CVE ID", t, func() {
args := []string{"cvetest", "--cve-id", "CVE-2019-20807", "--image", "zot-cve-test", "--fixed"}
args := []string{"cvetest", "--cve-id", "CVE-2019-9923", "--image", "zot-cve-test", "--fixed"}
configPath := makeConfigFile(fmt.Sprintf(`{"configs":[{"_name":"cvetest","url":"%s","showspinner":false}]}`, url))
defer os.Remove(configPath)
cveCmd := NewCveCommand(new(searchService))
@ -450,7 +450,7 @@ func TestServerCVEResponse(t *testing.T) {
})
Convey("Test CVE by name and CVE ID", t, func() {
args := []string{"cvetest", "--image", "zot-cve-test", "--cve-id", "CVE-2019-20807"}
args := []string{"cvetest", "--image", "zot-cve-test", "--cve-id", "CVE-2019-9923"}
configPath := makeConfigFile(fmt.Sprintf(`{"configs":[{"_name":"cvetest","url":"%s","showspinner":false}]}`, url))
defer os.Remove(configPath)
cveCmd := NewCveCommand(new(searchService))
@ -462,7 +462,7 @@ func TestServerCVEResponse(t *testing.T) {
space := regexp.MustCompile(`\s+`)
str := space.ReplaceAllString(buff.String(), " ")
So(err, ShouldBeNil)
So(strings.TrimSpace(str), ShouldEqual, "IMAGE NAME TAG DIGEST SIZE zot-cve-test 0.0.1 da0186c7 75MB")
So(strings.TrimSpace(str), ShouldEqual, "IMAGE NAME TAG DIGEST SIZE zot-cve-test 0.0.1 63a795ca 75MB")
Convey("invalidname and CVE ID", func() {
args := []string{"cvetest", "--image", "test", "--cve-id", "CVE-20807"}
configPath := makeConfigFile(fmt.Sprintf(`{"configs":[{"_name":"cvetest","url":"%s","showspinner":false}]}`, url))

View File

@ -1,8 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["config.go"],
importpath = "github.com/anuvu/zot/pkg/compliance",
visibility = ["//visibility:public"],
)

View File

@ -1,30 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["check.go"],
importpath = "github.com/anuvu/zot/pkg/compliance/v1_0_0",
visibility = ["//visibility:public"],
deps = [
"//pkg/api:go_default_library",
"//pkg/compliance:go_default_library",
"@com_github_opencontainers_go_digest//:go_default_library",
"@com_github_opencontainers_image_spec//specs-go/v1:go_default_library",
"@com_github_smartystreets_goconvey//convey:go_default_library",
"@com_github_smartystreets_goconvey//convey/reporting:go_default_library",
"@in_gopkg_resty_v1//:go_default_library",
],
)
go_test(
name = "go_default_test",
timeout = "short",
srcs = ["check_test.go"],
embed = [":go_default_library"],
deps = [
"//pkg/api:go_default_library",
"//pkg/compliance:go_default_library",
"@com_github_phayes_freeport//:go_default_library",
"@in_gopkg_resty_v1//:go_default_library",
],
)

View File

@ -1,20 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"config.go",
"extensions.go",
"minimal.go",
],
importpath = "github.com/anuvu/zot/pkg/extensions",
visibility = ["//visibility:public"],
deps = [
"//pkg/extensions/search:go_default_library",
"//pkg/extensions/search/cve:go_default_library",
"//pkg/log:go_default_library",
"//pkg/storage:go_default_library",
"@com_github_99designs_gqlgen//graphql/handler:go_default_library",
"@com_github_gorilla_mux//:go_default_library",
],
)

View File

@ -1,21 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"generated.go",
"models_gen.go",
"resolver.go",
],
importpath = "github.com/anuvu/zot/pkg/extensions/search",
visibility = ["//visibility:public"],
deps = [
"//pkg/extensions/search/cve:go_default_library",
"//pkg/log:go_default_library",
"//pkg/storage:go_default_library",
"@com_github_99designs_gqlgen//graphql:go_default_library",
"@com_github_99designs_gqlgen//graphql/introspection:go_default_library",
"@com_github_vektah_gqlparser_v2//:go_default_library",
"@com_github_vektah_gqlparser_v2//ast:go_default_library",
],
)

View File

@ -1,39 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = [
"cve.go",
"models.go",
],
importpath = "github.com/anuvu/zot/pkg/extensions/search/cve",
visibility = ["//visibility:public"],
deps = [
"//errors:go_default_library",
"//pkg/log:go_default_library",
"@com_github_aquasecurity_trivy//integration:go_default_library",
"@com_github_aquasecurity_trivy//integration/config:go_default_library",
"@com_github_aquasecurity_trivy//pkg/report:go_default_library",
"@com_github_google_go_containerregistry//pkg/v1:go_default_library",
"@com_github_google_go_containerregistry//pkg/v1/types:go_default_library",
"@com_github_opencontainers_go_digest//:go_default_library",
"@com_github_opencontainers_image_spec//specs-go/v1:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = ["cve_test.go"],
data = [
"//:exported_testdata",
],
embed = [":go_default_library"],
deps = [
"//pkg/api:go_default_library",
"//pkg/extensions:go_default_library",
"//pkg/log:go_default_library",
"@com_github_opencontainers_image_spec//specs-go/v1:go_default_library",
"@com_github_smartystreets_goconvey//convey:go_default_library",
"@in_gopkg_resty_v1//:go_default_library",
],
)

View File

@ -1,12 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["log.go"],
importpath = "github.com/anuvu/zot/pkg/log",
visibility = ["//visibility:public"],
deps = [
"@com_github_gorilla_mux//:go_default_library",
"@com_github_rs_zerolog//:go_default_library",
],
)

View File

@ -1,42 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = [
"cache.go",
"storage.go",
],
importpath = "github.com/anuvu/zot/pkg/storage",
visibility = ["//visibility:public"],
deps = [
"//errors:go_default_library",
"//pkg/log:go_default_library",
"@com_github_apex_log//:go_default_library",
"@com_github_gofrs_uuid//:go_default_library",
"@com_github_opencontainers_go_digest//:go_default_library",
"@com_github_opencontainers_image_spec//specs-go/v1:go_default_library",
"@com_github_opencontainers_umoci//:go_default_library",
"@com_github_opencontainers_umoci//oci/casext:go_default_library",
"@com_github_rs_zerolog//:go_default_library",
"@io_etcd_go_bbolt//:go_default_library",
],
)
go_test(
name = "go_default_test",
timeout = "short",
srcs = [
"cache_test.go",
"storage_test.go",
],
embed = [":go_default_library"],
race = "on",
deps = [
"//errors:go_default_library",
"//pkg/log:go_default_library",
"@com_github_opencontainers_go_digest//:go_default_library",
"@com_github_opencontainers_image_spec//specs-go/v1:go_default_library",
"@com_github_rs_zerolog//:go_default_library",
"@com_github_smartystreets_goconvey//convey:go_default_library",
],
)