Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

##@ Build

GO_ASMFLAGS = -asmflags "all=-trimpath=$(shell dirname $(PWD))"
GO_GCFLAGS = -gcflags "all=-trimpath=$(shell dirname $(PWD))"
LD_FLAGS=-ldflags " \
-X main.goos=$(shell go env GOOS) \
-X main.goarch=$(shell go env GOARCH) \
Expand All @@ -37,10 +38,13 @@ LD_FLAGS=-ldflags " \
"
.PHONY: build
build: ## Build the project locally
go build $(LD_FLAGS) -o bin/audit ./cmd
go build $(GO_GCFLAGS) $(GO_ASMFLAGS) $(LD_FLAGS) -o bin/audit-tool ./cmd
cp ./bin/audit-tool $(GOBIN)/audit-tool

install: build ## Build and install the binary with the current source code. Use it to test your changes locally.
cp ./bin/audit $(GOBIN)/audit
.PHONY: install
install: ## Build the project locally
make build
cp ./bin/audit-tool $(GOBIN)/audit-tool

##@ Development

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ NOTE that you can run the reports without SDK and the cluster running with by us
To get the project and install the binary:

```sh
$ git clone git@github.com:camilamacedo86/audit.git
$ git clone git@github.com:operator-framework/audit.git
$ cd audit
$ make install
```
Expand All @@ -50,19 +50,19 @@ docker login https://registry.redhat.io
Now, you can audit all operator bundles of an image catalog with:

```sh
./bin/audit bundles --index-image=registry.redhat.io/redhat/redhat--operator-index:v4.7 --head-only --output-path=testdata/xls
audit-tool bundles --index-image=registry.redhat.io/redhat/redhat--operator-index:v4.7 --head-only --output-path=testdata/xls
```

Now, you can audit all packages of an image catalog with:

```sh
./bin/audit packages --index-image=registry.redhat.io/redhat/redhat--operator-index:v4.7 --output-path=testdata/xls
audit-tool packages --index-image=registry.redhat.io/redhat/redhat--operator-index:v4.7 --output-path=testdata/xls
```

Note that you can also output the results in JSON format:

```sh
./bin/audit bundles index \
audit-tool bundles index \
--index-image=registry.redhat.io/redhat/redhat-operator-index:v4.7 \
--limit=3 \
--head-only \
Expand All @@ -75,15 +75,15 @@ Note that you can also output the results in JSON format:
Use the `--help` flag to check the options and the further information about its commands. Following an example:

```sh
$ ./bin/audit bundles --help
$ audit-tool bundles --help
Provides reports with the details of all bundles operators ship in the index image informed according to the criteria defined via the flags.

**When this report is useful?**

This report is useful when is required to check the operator bundles details.

Usage:
audit bundles [flags]
audit-tool bundles [flags]

Flags:
--disable-scorecard if set, will disable the scorecard tests
Expand Down
10 changes: 10 additions & 0 deletions cmd/bundles/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ func indexRun(cmd *cobra.Command, args []string) error {
command = exec.Command("rm", "-rf", "tmp")
_, _ = pkg.RunCommand(command)

// Cleanup
command = exec.Command("rm", "-rf", "output")
_, _ = pkg.RunCommand(command)

log.Infof("Start to generate the reportData")
if err := reportData.OutputReport(); err != nil {
return err
Expand All @@ -158,6 +162,12 @@ func extractIndexDB() error {
return fmt.Errorf("unable to create container image %s : %s", flags.IndexImage, err)
}

command = exec.Command("mkdir", "output")
_, err = pkg.RunCommand(command)
if err != nil {
return fmt.Errorf("unable to extract the image for index.db %s : %s", flags.IndexImage, err)
}

// Extract
command = exec.Command("docker", "cp", fmt.Sprintf("%s:/database/index.db", catalogIndex), "./output/")
_, err = pkg.RunCommand(command)
Expand Down
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
func main() {

rootCmd := &cobra.Command{
Use: "audit",
Use: "audit-tool",
Short: "An analytic tool to audit operator bundles and index catalogs",
Long: "The audit is an analytic tool which uses the Operator Framework solutions. " +
"More info: https://github.com/operator-framework/audit",
Expand Down