diff --git a/.goreleaser.yml b/.goreleaser.yml index aac01b19..17073cfe 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -67,8 +67,9 @@ archives: - goos: windows format: zip files: + - src: addon-tools/README.md + dst: README.md - src: addon-tools/helm-convert/README.md dst: README_helm-convert.md - # TODO: No readme for report-creator yet - # - src: addon-tools/report-creator/README.md - # dst: README_report-creator.md + - src: addon-tools/report-creator/README.md + dst: README_report-creator.md diff --git a/Makefile b/Makefile index d49e5663..9a81e0ef 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ IMAGE_NAME=kube-compare PACKAGE_NAME := github.com/openshift/kube-compare -GOLANG_CROSS_VERSION ?= v1.22.3 +GOLANG_CROSS_VERSION ?= v1.22.7 # Default values for GOOS and GOARCH GOOS ?= linux @@ -60,7 +60,7 @@ test-report-creator: .PHONY: build-report-creator build-report-creator: - go build ./addon-tools/report-creator/create-report.go + go build ./addon-tools/report-creator/report-creator.go .PHONY: build-helm-convert build-helm-convert: diff --git a/addon-tools/README.md b/addon-tools/README.md new file mode 100644 index 00000000..7a89c339 --- /dev/null +++ b/addon-tools/README.md @@ -0,0 +1,14 @@ +# Addon-tools + +These tools were written as helpers to the main cluster-compare plugin, and are +not supported but are provided for convenience. + +## helm-convert + +This utility converts a cluster-compare metadata.yaml reference to a helm +chart, which can then be used to deploy the CRs or render the CRs locally. + +## report-creator + +This utilitiy consumes the output.json from cluster-compare and creates a +junit.xml that matches, for integration in pipelines that like junit.xml diff --git a/addon-tools/helm-convert/go.sum b/addon-tools/helm-convert/go.sum index a7679bc7..5d7288e6 100644 --- a/addon-tools/helm-convert/go.sum +++ b/addon-tools/helm-convert/go.sum @@ -161,8 +161,7 @@ github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk= -github.com/openshift/kube-compare v0.1.1 h1:jWTTtd2fBCuPnTkXcedRulcSIPGvZQv7Me8iLEmjaCw= -github.com/openshift/kube-compare v0.1.1/go.mod h1:4uykk9QkJVdW+bh+aoDhC3jpsbqhEJabnmeHYXGjvBg= +github.com/openshift/kube-compare v0.2.0 h1:c/OUdV4rS0GxZLXpDR3LfuCU/aAXNLtQeQjU9mlFyzc= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/addon-tools/report-creator/README.md b/addon-tools/report-creator/README.md new file mode 100644 index 00000000..1acefdcb --- /dev/null +++ b/addon-tools/report-creator/README.md @@ -0,0 +1,35 @@ +# report-creator add-on + +report-creator is a CLI tool that allows creating a JUnit test report from the +output of the 'kubectl cluster-compare' plugin. The command uses the JSON +format output of the 'kubectl cluster-compare' plugin. This tol can be handy in +automatic test environments. + +The tool divides the result of the cluster compare into 3 test suites: + +1. Diff test suite - Each test in the suite represents a CR that is matched and + diffed to a reference CR. The test will be reported as failed if there are + differences between the cluster cr and the expected CR. The full diff will + be included in the test case failure message. In case there are no + differences for the CR, the test will be marked as successful. +2. Missing CRs test suite - Each test in this suite represents a missing CR + from the cluster that appeared in the reference and was expected to appear + in the cluster but wasn't found/identified. If there are no missing CRs, + this test suite will contain one successful test indicating that the cluster + contains all the expected CRs. +3. Unmatched CRs test suite - This suite includes all the CRs in the cluster + that were not matched to any reference. Each unmatched CR will be + represented as a test case that failed. If there are no unmatched CRs, then + this suite will include one successful test case representing that there are + no unmatched CRs. + +## Usage + +```txt +report-creator -j [flags] + +Flags + -h, --help help for report-creator + -j, --json string Path to the file including the json output of the cluster-compare command + -o, --output string Path to save the report (default "report.xml") +``` diff --git a/addon-tools/report-creator/go.sum b/addon-tools/report-creator/go.sum index 6a0d0d64..25f9deaa 100644 --- a/addon-tools/report-creator/go.sum +++ b/addon-tools/report-creator/go.sum @@ -156,8 +156,7 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= -github.com/openshift/kube-compare v0.1.1 h1:jWTTtd2fBCuPnTkXcedRulcSIPGvZQv7Me8iLEmjaCw= -github.com/openshift/kube-compare v0.1.1/go.mod h1:4uykk9QkJVdW+bh+aoDhC3jpsbqhEJabnmeHYXGjvBg= +github.com/openshift/kube-compare v0.2.0 h1:c/OUdV4rS0GxZLXpDR3LfuCU/aAXNLtQeQjU9mlFyzc= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/addon-tools/report-creator/create-report.go b/addon-tools/report-creator/report-creator.go similarity index 100% rename from addon-tools/report-creator/create-report.go rename to addon-tools/report-creator/report-creator.go