Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request #231 from docker/eol-docker-scan
Browse files Browse the repository at this point in the history
Docker scan command is being removed
  • Loading branch information
eunomie authored Apr 19, 2023
2 parents 284fb08 + 281a6b0 commit c7fa31d
Show file tree
Hide file tree
Showing 37 changed files with 54 additions and 3,486 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,12 @@ jobs:
cache: true
id: go

- name: Download binaries
run: make -f builder.Makefile download

- name: Build binary
run: make TAG_NAME=${{ github.event.inputs.tag }} -f builder.Makefile build

- name: Build Cross
run: make cross

- name: Unit Tests
run: make test-unit

- name: End-to-end Tests
run: make TAG_NAME=${{ github.event.inputs.tag }} -f builder.Makefile e2e

- name: Upload binary artifact
uses: actions/upload-artifact@v2
with:
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/release-weekly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ jobs:
cache: true
id: go

- name: Download binaries
run: make -f builder.Makefile download

- name: Build binary
env:
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
Expand All @@ -79,22 +76,6 @@ jobs:
E2E_HUB_TOKEN: ${{ secrets.E2E_HUB_TOKEN }}
run: make TAG_NAME=${{ github.event.inputs.tag }} -f builder.Makefile build

- name: E2E
env:
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
E2E_HUB_URL: ${{ secrets.E2E_HUB_URL }}
E2E_HUB_USERNAME: ${{ secrets.E2E_HUB_USERNAME }}
E2E_HUB_TOKEN: ${{ secrets.E2E_HUB_TOKEN }}
run: make TAG_NAME=${{ github.event.inputs.tag }} -f builder.Makefile e2e

- name: Unit test
env:
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
E2E_HUB_URL: ${{ secrets.E2E_HUB_URL }}
E2E_HUB_USERNAME: ${{ secrets.E2E_HUB_USERNAME }}
E2E_HUB_TOKEN: ${{ secrets.E2E_HUB_TOKEN }}
run: make TAG_NAME=${{ github.event.inputs.tag }} -f builder.Makefile test-unit

- name: Build Mac arm64 binary
if: ${{ matrix.os == 'macos-latest' }}
run: make TAG_NAME=${{ github.event.inputs.tag }} -f builder.Makefile build-mac-arm64
Expand Down
30 changes: 2 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,10 @@ BUILD_ARGS := --build-arg GO_VERSION=$(GO_VERSION)\
--build-arg CLI_VERSION=$(CLI_VERSION)\
--build-arg ALPINE_VERSION=$(ALPINE_VERSION)\
--build-arg GOLANGCI_LINT_VERSION=$(GOLANGCI_LINT_VERSION) \
--build-arg TAG_NAME=$(GIT_TAG_NAME) \
--build-arg GOTESTSUM_VERSION=$(GOTESTSUM_VERSION) \
--build-arg SNYK_IMAGE_DIGEST=$(SNYK_IMAGE_DIGEST)

E2E_ENV := --env E2E_TEST_AUTH_TOKEN \
--env E2E_HUB_URL \
--env E2E_HUB_USERNAME \
--env E2E_HUB_TOKEN \
--env E2E_TEST_NAME
--build-arg TAG_NAME=$(GIT_TAG_NAME)

.PHONY: all
all: lint validate build test
all: lint validate build

.PHONY: build
build: ## Build docker-scan in a container
Expand All @@ -49,24 +41,6 @@ install: build ## Install docker-scan to your local cli-plugins directory
mkdir -p $(HOME)/.docker/cli-plugins
cp bin/$(PLATFORM_BINARY) $(HOME)/.docker/cli-plugins/$(BINARY)

.PHONY: test ## Run unit tests then end-to-end tests
test: test-unit e2e

.PHONY: e2e-build
e2e-build:
docker build $(BUILD_ARGS) . --target e2e -t docker-scan:e2e

.PHONY: e2e
e2e: e2e-build ## Run the end-to-end tests
@docker run $(E2E_ENV) --rm -v /var/run/docker.sock:/var/run/docker.sock -v $(shell go env GOCACHE):/root/.cache/go-build docker-scan:e2e

test-unit-build:
docker build $(BUILD_ARGS) . --target test-unit -t docker-scan:test-unit

.PHONY: test-unit
test-unit: test-unit-build ## Run unit tests
docker run --rm -v $(shell go env GOCACHE):/root/.cache/go-build docker-scan:test-unit

.PHONY: lint
lint: ## Run the go linter
@docker build . --target lint
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

# Docker Scan

:warning:

The `docker scan` command has been removed.

To continue learning about the vulnerabilities of your images, and many other features, use the new `docker scout` command.

Run `docker scout --help`, or learn more at https://docs.docker.com/engine/reference/commandline/scout/

---

Docker Scan is a Command Line Interface to run vulnerability detection on your Dockerfiles and Docker images.


Expand Down
57 changes: 1 addition & 56 deletions builder.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,51 +14,13 @@ PKG_NAME=github.com/docker/scan-cli-plugin
STATIC_FLAGS= CGO_ENABLED=0
LDFLAGS := "-s -w \
-X $(PKG_NAME)/internal.GitCommit=$(COMMIT) \
-X $(PKG_NAME)/internal.Version=$(TAG_NAME) \
-X $(PKG_NAME)/internal/provider.ImageDigest=$(SNYK_IMAGE_DIGEST) \
-X $(PKG_NAME)/internal/provider.SnykDesktopVersion=$(SNYK_DESKTOP_VERSION)"
-X $(PKG_NAME)/internal.Version=$(TAG_NAME)"
GO_BUILD = $(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)

SNYK_DOWNLOAD_NAME:=snyk-linux
SNYK_BINARY:=snyk
PWD:=$(shell pwd)
ifeq ($(GOOS),windows)
SNYK_DOWNLOAD_NAME:=snyk-win.exe
SNYK_BINARY=snyk.exe
PWD=$(subst \,/,$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))))
endif
ifeq ($(GOOS),darwin)
SNYK_DOWNLOAD_NAME:=snyk-macos
endif

ifneq ($(strip $(E2E_TEST_NAME)),)
RUN_TEST=-test.run $(E2E_TEST_NAME)
endif

VARS:= SNYK_DESKTOP_VERSION=${SNYK_DESKTOP_VERSION}\
SNYK_USER_VERSION=${SNYK_USER_VERSION}\
SNYK_OLD_VERSION=${SNYK_OLD_VERSION}\
DOCKER_CONFIG=$(PWD)/docker-config\
SNYK_OLD_PATH=$(PWD)/docker-config/snyk-old\
SNYK_USER_PATH=$(PWD)/docker-config/snyk-user\
SNYK_DESKTOP_PATH=$(PWD)/docker-config/snyk-desktop

.PHONY: lint
lint:
golangci-lint run --timeout 10m0s ./...

.PHONY: e2e
e2e:
mkdir -p docker-config/scan
mkdir -p docker-config/cli-plugins
cp ./bin/${PLATFORM_BINARY} docker-config/cli-plugins/${BINARY}
# TODO: gotestsum doesn't forward ldflags to go test with golang 1.15.0, so moving back to go test temporarily
$(VARS) go test ./e2e $(RUN_TEST) -ldflags=$(LDFLAGS)

.PHONY: test-unit
test-unit:
gotestsum $(shell go list ./... | grep -vE '/e2e')

cross:
GOOS=linux GOARCH=amd64 $(GO_BUILD) -o dist/docker-scan_linux_amd64 ./cmd/docker-scan
GOOS=linux GOARCH=arm64 $(GO_BUILD) -o dist/docker-scan_linux_arm64 ./cmd/docker-scan
Expand All @@ -78,20 +40,3 @@ build-linux-arm64:
build:
mkdir -p bin
$(GO_BUILD) -o bin/$(PLATFORM_BINARY) ./cmd/docker-scan

# For multi-platform (windows,macos,linux) github actions
.PHONY: download
download:
mkdir -p docker-config/snyk-user
curl https://github.com/snyk/snyk/releases/download/v${SNYK_USER_VERSION}/${SNYK_DOWNLOAD_NAME} -L -s -S -o docker-config/snyk-user/${SNYK_BINARY}
chmod +x docker-config/snyk-user/${SNYK_BINARY}

mkdir -p docker-config/snyk-old
curl https://github.com/snyk/snyk/releases/download/v${SNYK_OLD_VERSION}/${SNYK_DOWNLOAD_NAME} -L -s -S -o docker-config/snyk-old/${SNYK_BINARY}
chmod +x docker-config/snyk-old/${SNYK_BINARY}

mkdir -p docker-config/snyk-desktop
curl https://github.com/snyk/snyk/releases/download/v${SNYK_DESKTOP_VERSION}/${SNYK_DOWNLOAD_NAME} -L -s -S -o docker-config/snyk-desktop/${SNYK_BINARY}
chmod +x docker-config/snyk-desktop/${SNYK_BINARY}

GO111MODULE=on go install gotest.tools/gotestsum@v${GOTESTSUM_VERSION}
122 changes: 0 additions & 122 deletions cmd/docker-scan/job_windows.go

This file was deleted.

Loading

0 comments on commit c7fa31d

Please sign in to comment.