Skip to content

Commit

Permalink
clair: rewrite imports
Browse files Browse the repository at this point in the history
  • Loading branch information
hdonnay committed Nov 12, 2019
1 parent 1f2ceeb commit 00eff59
Show file tree
Hide file tree
Showing 106 changed files with 355 additions and 360 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

FROM golang:1.13-alpine AS build
RUN apk add --no-cache git build-base
ADD . /go/src/github.com/coreos/clair/
WORKDIR /go/src/github.com/coreos/clair/
ADD . /go/clair/
WORKDIR /go/clair/
RUN export CLAIR_VERSION=$(git describe --tag --always --dirty) && \
go build -ldflags "-X github.com/coreos/clair/pkg/version.Version=$CLAIR_VERSION" github.com/coreos/clair/cmd/clair
go build -ldflags "-X github.com/quay/clair/v3/pkg/version.Version=$CLAIR_VERSION" ./cmd/clair

FROM alpine:3.10
COPY --from=build /go/src/github.com/coreos/clair/clair /clair
COPY --from=build /go/clair/clair /clair
RUN apk add --no-cache git rpm xz ca-certificates dumb-init

# change ownership of ssl directory to allow custom cert in OpenShift
Expand Down
9 changes: 1 addition & 8 deletions Documentation/running-clair.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ $ docker run --net=host -d -p 6060-6061:6060-6061 -v $PWD/clair_config:/config q

#### Source

Clair currently uses glide as it's package management solution.
The vendor folder is checked into this repository and running 'glide up' should not be necessary.
Find more information on glide here: [Glide]

[Glide]: https://github.com/Masterminds/glide

To build Clair, you need the latest stable version of [Go] and a working [Go environment].
In addition, Clair requires some additional binaries be installed on the system [$PATH] as runtime dependencies:

Expand All @@ -77,8 +71,7 @@ In addition, Clair requires some additional binaries be installed on the system
[$PATH]: https://en.wikipedia.org/wiki/PATH_(variable)

```sh
$ go get github.com/coreos/clair
$ go install github.com/coreos/clair/cmd/clair
$ go get github.com/quay/clair/cmd/clair
$ $EDITOR config.yaml # Add the URI for your postgres database
$ ./$GOPATH/bin/clair -config=config.yaml
```
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ UNIT_TEST_PACKAGES = $(shell go list ./... | grep -v 'database/')
DB_TEST_PACKAGES = $(shell go list ./... | grep 'database/')

CLAIR_TEST_PGSQL ?= postgres@127.0.0.1:5432
GO111MODULE ?= on
export GO111MODULE

.PHONY: build
build:
go build -v -ldflags "-X github.com/coreos/clair/pkg/version.Version=$(COMMIT)" ./cmd/clair
go build -v -ldflags "-X github.com/quay/clair/v3/pkg/version.Version=$(COMMIT)" ./cmd/clair

.PHONY: unit-test
unit-test:
Expand Down
8 changes: 4 additions & 4 deletions analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (

log "github.com/sirupsen/logrus"

"github.com/coreos/clair/database"
"github.com/coreos/clair/ext/featurefmt"
"github.com/coreos/clair/ext/featurens"
"github.com/coreos/clair/ext/imagefmt"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/ext/featurefmt"
"github.com/quay/clair/v3/ext/featurens"
"github.com/quay/clair/v3/ext/imagefmt"
)

// AnalyzeError represents an failure when analyzing layer or constructing
Expand Down
2 changes: 1 addition & 1 deletion ancestry.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

log "github.com/sirupsen/logrus"

"github.com/coreos/clair/database"
"github.com/quay/clair/v3/database"
)

type layerIndexedFeature struct {
Expand Down
2 changes: 1 addition & 1 deletion ancestry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/coreos/clair/database"
"github.com/quay/clair/v3/database"
)

var (
Expand Down
8 changes: 4 additions & 4 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package api
package api // import "github.com/quay/clair/v3/api"

import (
"context"
Expand All @@ -21,9 +21,9 @@ import (

log "github.com/sirupsen/logrus"

"github.com/coreos/clair/api/v3"
"github.com/coreos/clair/database"
"github.com/coreos/clair/pkg/stopper"
v3 "github.com/quay/clair/v3/api/v3"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/pkg/stopper"
)

const timeoutResponse = `{"Error":{"Message":"Clair failed to respond within the configured timeout window.","Type":"Timeout"}}`
Expand Down
2 changes: 1 addition & 1 deletion api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/julienschmidt/httprouter"

"github.com/coreos/clair/database"
"github.com/quay/clair/v3/database"
)

// router is an HTTP router that forwards requests to the appropriate sub-router
Expand Down
4 changes: 2 additions & 2 deletions api/v3/clairpb/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"encoding/json"
"fmt"

"github.com/coreos/clair/database"
"github.com/coreos/clair/ext/versionfmt"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/ext/versionfmt"
)

// DatabaseDetectorTypeMapping maps the database detector type to the integer
Expand Down
10 changes: 5 additions & 5 deletions api/v3/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/coreos/clair"
pb "github.com/coreos/clair/api/v3/clairpb"
"github.com/coreos/clair/database"
"github.com/coreos/clair/ext/imagefmt"
"github.com/coreos/clair/pkg/pagination"
"github.com/quay/clair/v3"
pb "github.com/quay/clair/v3/api/v3/clairpb"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/ext/imagefmt"
"github.com/quay/clair/v3/pkg/pagination"
)

func newRPCErrorWithClairError(code codes.Code, err error) error {
Expand Down
6 changes: 3 additions & 3 deletions api/v3/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"

pb "github.com/coreos/clair/api/v3/clairpb"
"github.com/coreos/clair/database"
"github.com/coreos/clair/pkg/grpcutil"
pb "github.com/quay/clair/v3/api/v3/clairpb"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/pkg/grpcutil"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions api/v3/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
package v3

import (
"github.com/coreos/clair"
pb "github.com/coreos/clair/api/v3/clairpb"
"github.com/coreos/clair/database"
"github.com/golang/protobuf/ptypes"
"github.com/quay/clair/v3"
pb "github.com/quay/clair/v3/api/v3/clairpb"
"github.com/quay/clair/v3/database"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
Expand Down
2 changes: 1 addition & 1 deletion bill-of-materials.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"project": "github.com/coreos/clair",
"project": "github.com/quay/clair",
"license": "Apache License 2.0",
"confidence": 1
},
Expand Down
2 changes: 1 addition & 1 deletion blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"os"
"strings"

"github.com/coreos/clair/pkg/httputil"
"github.com/quay/clair/v3/pkg/httputil"
)

func retrieveLayerBlob(ctx context.Context, path string, headers map[string]string) (io.ReadCloser, error) {
Expand Down
12 changes: 6 additions & 6 deletions cmd/clair/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import (
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"

"github.com/coreos/clair"
"github.com/coreos/clair/api"
"github.com/coreos/clair/database"
"github.com/coreos/clair/ext/notification"
"github.com/coreos/clair/ext/vulnsrc"
"github.com/coreos/clair/pkg/pagination"
"github.com/quay/clair/v3"
"github.com/quay/clair/v3/api"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/ext/notification"
"github.com/quay/clair/v3/ext/vulnsrc"
"github.com/quay/clair/v3/pkg/pagination"
)

// ErrDatasourceNotLoaded is returned when the datasource variable in the
Expand Down
54 changes: 27 additions & 27 deletions cmd/clair/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,37 @@ import (

log "github.com/sirupsen/logrus"

"github.com/coreos/clair"
"github.com/coreos/clair/api"
"github.com/coreos/clair/database"
"github.com/coreos/clair/ext/vulnsrc"
"github.com/coreos/clair/pkg/formatter"
"github.com/coreos/clair/pkg/stopper"
"github.com/coreos/clair/pkg/strutil"
"github.com/quay/clair/v3"
"github.com/quay/clair/v3/api"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/ext/vulnsrc"
"github.com/quay/clair/v3/pkg/formatter"
"github.com/quay/clair/v3/pkg/stopper"
"github.com/quay/clair/v3/pkg/strutil"

// Register database driver.
_ "github.com/coreos/clair/database/pgsql"
_ "github.com/quay/clair/v3/database/pgsql"

// Register extensions.
_ "github.com/coreos/clair/ext/featurefmt/apk"
_ "github.com/coreos/clair/ext/featurefmt/dpkg"
_ "github.com/coreos/clair/ext/featurefmt/rpm"
_ "github.com/coreos/clair/ext/featurens/alpinerelease"
_ "github.com/coreos/clair/ext/featurens/aptsources"
_ "github.com/coreos/clair/ext/featurens/lsbrelease"
_ "github.com/coreos/clair/ext/featurens/osrelease"
_ "github.com/coreos/clair/ext/featurens/redhatrelease"
_ "github.com/coreos/clair/ext/imagefmt/aci"
_ "github.com/coreos/clair/ext/imagefmt/docker"
_ "github.com/coreos/clair/ext/notification/webhook"
_ "github.com/coreos/clair/ext/vulnmdsrc/nvd"
_ "github.com/coreos/clair/ext/vulnsrc/alpine"
_ "github.com/coreos/clair/ext/vulnsrc/amzn"
_ "github.com/coreos/clair/ext/vulnsrc/debian"
_ "github.com/coreos/clair/ext/vulnsrc/oracle"
_ "github.com/coreos/clair/ext/vulnsrc/rhel"
_ "github.com/coreos/clair/ext/vulnsrc/suse"
_ "github.com/coreos/clair/ext/vulnsrc/ubuntu"
_ "github.com/quay/clair/v3/ext/featurefmt/apk"
_ "github.com/quay/clair/v3/ext/featurefmt/dpkg"
_ "github.com/quay/clair/v3/ext/featurefmt/rpm"
_ "github.com/quay/clair/v3/ext/featurens/alpinerelease"
_ "github.com/quay/clair/v3/ext/featurens/aptsources"
_ "github.com/quay/clair/v3/ext/featurens/lsbrelease"
_ "github.com/quay/clair/v3/ext/featurens/osrelease"
_ "github.com/quay/clair/v3/ext/featurens/redhatrelease"
_ "github.com/quay/clair/v3/ext/imagefmt/aci"
_ "github.com/quay/clair/v3/ext/imagefmt/docker"
_ "github.com/quay/clair/v3/ext/notification/webhook"
_ "github.com/quay/clair/v3/ext/vulnmdsrc/nvd"
_ "github.com/quay/clair/v3/ext/vulnsrc/alpine"
_ "github.com/quay/clair/v3/ext/vulnsrc/amzn"
_ "github.com/quay/clair/v3/ext/vulnsrc/debian"
_ "github.com/quay/clair/v3/ext/vulnsrc/oracle"
_ "github.com/quay/clair/v3/ext/vulnsrc/rhel"
_ "github.com/quay/clair/v3/ext/vulnsrc/suse"
_ "github.com/quay/clair/v3/ext/vulnsrc/ubuntu"
)

// MaxDBConnectionAttempts is the total number of tries that Clair will use to
Expand Down
2 changes: 1 addition & 1 deletion database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"time"

"github.com/coreos/clair/pkg/pagination"
"github.com/quay/clair/v3/pkg/pagination"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions database/dbutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (

log "github.com/sirupsen/logrus"

"github.com/coreos/clair/pkg/commonerr"
"github.com/coreos/clair/pkg/pagination"
"github.com/quay/clair/v3/pkg/commonerr"
"github.com/quay/clair/v3/pkg/pagination"
"github.com/deckarep/golang-set"
)

Expand Down
2 changes: 1 addition & 1 deletion database/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package database
import (
"time"

"github.com/coreos/clair/pkg/pagination"
"github.com/quay/clair/v3/pkg/pagination"
)

// MockSession implements Session and enables overriding each available method.
Expand Down
2 changes: 1 addition & 1 deletion database/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package database
import (
"time"

"github.com/coreos/clair/pkg/pagination"
"github.com/quay/clair/v3/pkg/pagination"
)

// NotificationHook is a message sent to another service to inform of a change
Expand Down
8 changes: 4 additions & 4 deletions database/pgsql/ancestry/ancestry.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (

log "github.com/sirupsen/logrus"

"github.com/coreos/clair/database"
"github.com/coreos/clair/database/pgsql/detector"
"github.com/coreos/clair/database/pgsql/layer"
"github.com/coreos/clair/database/pgsql/util"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/database/pgsql/detector"
"github.com/quay/clair/v3/database/pgsql/layer"
"github.com/quay/clair/v3/database/pgsql/util"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions database/pgsql/ancestry/ancestry_detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package ancestry
import (
"database/sql"

"github.com/coreos/clair/database"
"github.com/coreos/clair/database/pgsql/detector"
"github.com/coreos/clair/database/pgsql/util"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/database/pgsql/detector"
"github.com/quay/clair/v3/database/pgsql/util"
)

var selectAncestryDetectors = `
Expand Down
10 changes: 5 additions & 5 deletions database/pgsql/ancestry/ancestry_feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ package ancestry
import (
"database/sql"

"github.com/coreos/clair/database"
"github.com/coreos/clair/database/pgsql/detector"
"github.com/coreos/clair/database/pgsql/feature"
"github.com/coreos/clair/database/pgsql/util"
"github.com/coreos/clair/pkg/commonerr"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/database/pgsql/detector"
"github.com/quay/clair/v3/database/pgsql/feature"
"github.com/quay/clair/v3/database/pgsql/util"
"github.com/quay/clair/v3/pkg/commonerr"
)

const findAncestryFeatures = `
Expand Down
8 changes: 4 additions & 4 deletions database/pgsql/ancestry/ancestry_layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ package ancestry
import (
"database/sql"

"github.com/coreos/clair/database"
"github.com/coreos/clair/database/pgsql/detector"
"github.com/coreos/clair/database/pgsql/util"
"github.com/coreos/clair/pkg/commonerr"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/database/pgsql/detector"
"github.com/quay/clair/v3/database/pgsql/util"
"github.com/quay/clair/v3/pkg/commonerr"
log "github.com/sirupsen/logrus"
)

Expand Down
4 changes: 2 additions & 2 deletions database/pgsql/ancestry/ancestry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (

"github.com/stretchr/testify/assert"

"github.com/coreos/clair/database"
"github.com/coreos/clair/database/pgsql/testutil"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/database/pgsql/testutil"
)

var upsertAncestryTests = []struct {
Expand Down
4 changes: 2 additions & 2 deletions database/pgsql/detector/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (

log "github.com/sirupsen/logrus"

"github.com/coreos/clair/database"
"github.com/coreos/clair/database/pgsql/util"
"github.com/quay/clair/v3/database"
"github.com/quay/clair/v3/database/pgsql/util"
)

const (
Expand Down
Loading

0 comments on commit 00eff59

Please sign in to comment.