build: remove bazel

The idea initially was to use bazel to do our builds, however golang
build system is now good enough and our code base is entirely go.
It is also slowing down our travis ci/cd pipeline.
This commit is contained in:
Ramkumar Chinchani 2020-12-16 14:32:04 -08:00 committed by Shivam Mishra
parent 8787142d2c
commit affdd85986
15 changed files with 1 additions and 3293 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"],
)

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

@ -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",
],
)