Skip to content

Commit e5f6dbb

Browse files
authored
Refine CLI format and output options + repo rename (#6)
1 parent 093a2b5 commit e5f6dbb

27 files changed

Lines changed: 233 additions & 211 deletions

.github/workflows/validations.yaml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -133,39 +133,39 @@ jobs:
133133
runs-on: ubuntu-20.04
134134
steps:
135135
- uses: actions/checkout@v2
136-
137-
- uses: actions/download-artifact@v2
138-
with:
139-
name: artifacts
140-
path: snapshot
141-
142-
- name: Build key for image cache
143-
run: make install-fingerprint
144-
145-
- name: Restore install.sh test image cache
146-
id: install-test-image-cache
147-
uses: actions/cache@v2.1.3
148-
with:
149-
path: ${{ github.workspace }}/test/install/cache
150-
key: ${{ runner.os }}-install-test-image-cache-${{ hashFiles('test/install/cache.fingerprint') }}
151-
152-
- name: Restore tool cache
153-
id: tool-cache
154-
uses: actions/cache@v2.1.3
155-
with:
156-
path: ${{ github.workspace }}/.tmp
157-
key: ${{ runner.os }}-tool-${{ hashFiles('Makefile') }}
158-
159-
- name: Load test image cache
160-
if: steps.install-test-image-cache.outputs.cache-hit == 'true'
161-
run: make install-test-cache-load
162-
163-
- name: Run install.sh tests (Linux)
164-
run: make install-test
165-
166-
- name: (cache-miss) Create test image cache
167-
if: steps.install-test-image-cache.outputs.cache-hit != 'true'
168-
run: make install-test-cache-save
136+
# TODO: this can be re-enabled after the first release in the docker org
137+
# - uses: actions/download-artifact@v2
138+
# with:
139+
# name: artifacts
140+
# path: snapshot
141+
#
142+
# - name: Build key for image cache
143+
# run: make install-fingerprint
144+
#
145+
# - name: Restore install.sh test image cache
146+
# id: install-test-image-cache
147+
# uses: actions/cache@v2.1.3
148+
# with:
149+
# path: ${{ github.workspace }}/test/install/cache
150+
# key: ${{ runner.os }}-install-test-image-cache-${{ hashFiles('test/install/cache.fingerprint') }}
151+
#
152+
# - name: Restore tool cache
153+
# id: tool-cache
154+
# uses: actions/cache@v2.1.3
155+
# with:
156+
# path: ${{ github.workspace }}/.tmp
157+
# key: ${{ runner.os }}-tool-${{ hashFiles('Makefile') }}
158+
#
159+
# - name: Load test image cache
160+
# if: steps.install-test-image-cache.outputs.cache-hit == 'true'
161+
# run: make install-test-cache-load
162+
#
163+
# - name: Run install.sh tests (Linux)
164+
# run: make install-test
165+
#
166+
# - name: (cache-miss) Create test image cache
167+
# if: steps.install-test-image-cache.outputs.cache-hit != 'true'
168+
# run: make install-test-cache-save
169169

170170
Acceptance-Mac:
171171
# Note: changing this job name requires making the same update in the .github/workflows/release.yaml pipeline

.goreleaser.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ builds:
1919
-w
2020
-s
2121
-extldflags '-static'
22-
-X github.com/anchore/docker-sbom-cli-plugin/internal/version.version={{.Version}}
23-
-X github.com/anchore/docker-sbom-cli-plugin/internal/version.gitCommit={{.Commit}}
24-
-X github.com/anchore/docker-sbom-cli-plugin/internal/version.buildDate={{.Date}}
25-
-X github.com/anchore/docker-sbom-cli-plugin/internal/version.gitDescription={{.Summary}}
22+
-X github.com/docker/sbom-cli-plugin/internal/version.version={{.Version}}
23+
-X github.com/docker/sbom-cli-plugin/internal/version.gitCommit={{.Commit}}
24+
-X github.com/docker/sbom-cli-plugin/internal/version.gitDescription={{.Summary}}
2625

2726
archives:
2827
- format: tar.gz

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
BIN = docker-sbom
2-
REPO = docker-sbom-cli-plugin
2+
REPO = sbom-cli-plugin
33

44
TEMP_DIR = ./.tmp
55
DIST_DIR=./dist
@@ -119,7 +119,7 @@ check-go-mod-tidy:
119119
.PHONY: unit
120120
unit: $(RESULTS_DIR) ## Run unit tests
121121
$(call title,Running unit tests)
122-
go test -coverprofile $(COVER_REPORT) $(shell go list ./... | grep -v anchore/docker-sbom-cli-plugin/test)
122+
go test -coverprofile $(COVER_REPORT) $(shell go list ./... | grep -v docker/sbom-cli-plugin/test)
123123
@go tool cover -func $(COVER_REPORT) | grep total | awk '{print substr($$3, 1, length($$3)-1)}' > $(COVER_TOTAL)
124124
@echo "Coverage: $$(cat $(COVER_TOTAL))"
125125

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Plugin for Docker CLI to support SBOM creation using Syft.
88

99
```
1010
# install the docker-sbom plugin
11-
curl -sSfL https://raw.githubusercontent.com/anchore/docker-sbom-cli-plugin/main/install.sh | sh -s --
11+
curl -sSfL https://raw.githubusercontent.com/docker/sbom-cli-plugin/main/install.sh | sh -s --
1212
1313
# use the sbom plugin
1414
docker sbom <my-image>

cmd/cmd.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ import (
88

99
"github.com/docker/cli/cli-plugins/manager"
1010
"github.com/docker/cli/cli-plugins/plugin"
11+
"github.com/docker/sbom-cli-plugin/internal"
12+
"github.com/docker/sbom-cli-plugin/internal/bus"
13+
"github.com/docker/sbom-cli-plugin/internal/config"
14+
"github.com/docker/sbom-cli-plugin/internal/log"
15+
"github.com/docker/sbom-cli-plugin/internal/logger"
16+
"github.com/docker/sbom-cli-plugin/internal/version"
1117
"github.com/gookit/color"
1218
"github.com/spf13/cobra"
1319
"github.com/spf13/viper"
1420
"github.com/wagoodman/go-partybus"
1521

16-
"github.com/anchore/docker-sbom-cli-plugin/internal"
17-
"github.com/anchore/docker-sbom-cli-plugin/internal/bus"
18-
"github.com/anchore/docker-sbom-cli-plugin/internal/config"
19-
"github.com/anchore/docker-sbom-cli-plugin/internal/log"
20-
"github.com/anchore/docker-sbom-cli-plugin/internal/logger"
21-
"github.com/anchore/docker-sbom-cli-plugin/internal/version"
2222
"github.com/anchore/stereoscope"
2323
"github.com/anchore/syft/syft"
2424
)
@@ -43,15 +43,17 @@ func Execute() {
4343
plugin.Run(
4444
cmd,
4545
manager.Metadata{
46-
SchemaVersion: internal.SchemaVersion,
47-
Vendor: "Anchore Inc.",
48-
Version: version.FromBuild().Version,
46+
SchemaVersion: internal.SchemaVersion,
47+
Vendor: "Anchore Inc.",
48+
Version: version.FromBuild().Version,
49+
ShortDescription: shortDescription,
50+
URL: "https://github.com/docker/sbom-cli-plugin",
4951
},
5052
)
5153
}
5254

5355
func initAppConfig() {
54-
cfg, err := config.LoadApplicationConfig(viper.GetViper(), cliOnlyOpts)
56+
cfg, err := config.LoadApplicationConfig(viper.GetViper())
5557
if err != nil {
5658
fmt.Printf("failed to load application config: \n\t%+v\n", err)
5759
os.Exit(1)
@@ -62,7 +64,7 @@ func initAppConfig() {
6264

6365
func initLogging() {
6466
cfg := logger.LogrusConfig{
65-
EnableConsole: (appConfig.Log.FileLocation == "" || appConfig.CliOptions.Verbosity > 0) && !appConfig.Quiet,
67+
EnableConsole: (appConfig.Log.FileLocation == "" || appConfig.Debug) && !appConfig.Quiet,
6668
EnableFile: appConfig.Log.FileLocation != "",
6769
Level: appConfig.Log.LevelOpt,
6870
Structured: appConfig.Log.Structured,

cmd/event_loop.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import (
55
"fmt"
66
"os"
77

8+
"github.com/docker/sbom-cli-plugin/internal/log"
9+
"github.com/docker/sbom-cli-plugin/internal/ui"
810
"github.com/hashicorp/go-multierror"
911
"github.com/wagoodman/go-partybus"
10-
11-
"github.com/anchore/docker-sbom-cli-plugin/internal/log"
12-
"github.com/anchore/docker-sbom-cli-plugin/internal/ui"
1312
)
1413

1514
// eventLoop listens to worker errors (from execution path), worker events (from a partybus subscription), and

cmd/event_loop_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77
"testing"
88
"time"
99

10+
"github.com/docker/sbom-cli-plugin/internal/ui"
1011
"github.com/stretchr/testify/assert"
1112
"github.com/stretchr/testify/mock"
1213
"github.com/wagoodman/go-partybus"
1314

14-
"github.com/anchore/docker-sbom-cli-plugin/internal/ui"
1515
"github.com/anchore/syft/syft/event"
1616
)
1717

0 commit comments

Comments
 (0)