Skip to content

Commit

Permalink
OPCT-216: Removing certification references from CLI (#71)
Browse files Browse the repository at this point in the history
- Removing references for "certification" from user facing messages on
CLI.
- Renaming binary to `opct`

Goal release: v0.5
  • Loading branch information
mtulio committed Sep 21, 2023
1 parent c3b7f72 commit 2c7e3b7
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 61 deletions.
51 changes: 50 additions & 1 deletion .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,53 @@ jobs:
with:
go-version: '1.19'
- name: Run go vet
run: make vet
run: make vet

build:
name: "build-artifact"
runs-on: ubuntu-latest
needs:
- go-test
- go-vet
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make git -y
- name: Build (OS=linux-amd64)
env:
OS_ARCH: linux-amd64
run: |
make clean
make linux-amd64-container
make build-${OS_ARCH}
- name: Save artifacts (OS=linux-amd64)
uses: actions/upload-artifact@v3
with:
name: opct-linux-amd64
path: |
build/opct-*
- name: Build (OS=darwin-arm64)
env:
OS_ARCH: darwin-arm64
run: |
make clean
make build-${OS_ARCH}
- name: Save artifacts (OS=darwin-arm64)
uses: actions/upload-artifact@v3
with:
name: opct-darwin-arm64
path: |
build/opct-*
10 changes: 7 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ jobs:
sudo apt-get install make git -y
- name: Build (all OS)
run: make all
run: |
make linux-amd64-container
make build-linux-amd64
make build-windows-amd64
make build-darwin-amd64
make build-darwin-arm64
- name: Build Container and Release to Quay
env:
Expand Down Expand Up @@ -64,8 +69,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
openshift-provider-cert-*
opct-*
build/opct-*
body: |
## Changelog
${{steps.github_release.outputs.changelog}}
Expand Down
76 changes: 43 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,65 @@ export GO111MODULE=on
# Disable CGO so that we always generate static binaries:
export CGO_ENABLED=0

BUILD_DIR ?= $(PWD)/build
IMG ?= quay.io/ocp-cert/opct
VERSION=$(shell git rev-parse --short HEAD)
RELEASE_TAG ?= 0.0.0
BIN_NAME ?= opct

GO_BUILD_FLAGS := -ldflags '-s -w -X github.com/redhat-openshift-ecosystem/provider-certification-tool/pkg/version.commit=$(VERSION) -X github.com/redhat-openshift-ecosystem/provider-certification-tool/pkg/version.version=$(RELEASE_TAG)'
GOOS ?= linux
GOARCH ?= amd64

# Unset GOFLAG for CI and ensure we've got nothing accidently set
unexport GOFLAGS

.PHONY: all
all: linux-amd64-container cross-build-windows-amd64 cross-build-darwin-amd64 cross-build-darwin-arm64
all: build-linux-amd64
all: build-windows-amd64
all: build-darwin-amd64
all: build-darwin-arm64

.PHONY: update-go
update-go:
go get -u
go mod tidy
.PHONY: build-dep
build-dep:
@mkdir -p $(BUILD_DIR)

.PHONY: build
build:
go build -o openshift-provider-cert $(GO_BUILD_FLAGS)

.PHONY: verify-codegen
verify-codegen:
./hack/verify-codegen.sh

.PHONY: linux-amd64
linux-amd64:
GOOS=linux GOARCH=amd64 go build -o openshift-provider-cert-linux-amd64 $(GO_BUILD_FLAGS)
cp openshift-provider-cert-linux-amd64 opct-linux-amd64

.PHONY: cross-build-windows-amd64
cross-build-windows-amd64:
GOOS=windows GOARCH=amd64 go build -o openshift-provider-cert-windows.exe $(GO_BUILD_FLAGS)
cp openshift-provider-cert-windows.exe opct-windows.exe

.PHONY: cross-build-darwin-amd64
cross-build-darwin-amd64:
GOOS=darwin GOARCH=amd64 go build -o openshift-provider-cert-darwin-amd64 $(GO_BUILD_FLAGS)
cp openshift-provider-cert-darwin-amd64 opct-darwin-amd64

.PHONY: cross-build-darwin-arm64
cross-build-darwin-arm64:
GOOS=darwin GOARCH=arm64 go build -o openshift-provider-cert-darwin-arm64 $(GO_BUILD_FLAGS)
cp openshift-provider-cert-darwin-arm64 opct-darwin-arm64
build: build-dep
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(BUILD_DIR)/opct-$(GOOS)-$(GOARCH)$(GOEXT) $(GO_BUILD_FLAGS)
@cd $(BUILD_DIR); md5sum $(BUILD_DIR)/opct-$(GOOS)-$(GOARCH)$(GOEXT) > $(BUILD_DIR)/opct-$(GOOS)-$(GOARCH)$(GOEXT).sum; cd -

.PHONY: build-linux-amd64
build-linux-amd64: GOOS = linux
build-linux-amd64: GOARCH = amd64
build-linux-amd64: build

.PHONY: build-windows-amd64
build-windows-amd64: GOOS = windows
build-windows-amd64: GOARCH = amd64
build-windows-amd64: GOEXT = .exe
build-windows-amd64: build

.PHONY: build-darwin-amd64
build-darwin-amd64: GOOS = darwin
build-darwin-amd64: GOARCH = amd64
build-darwin-amd64: build

.PHONY: build-darwin-arm64
build-darwin-arm64: GOOS = darwin
build-darwin-arm64: GOARCH = arm64
build-darwin-arm64: build

.PHONY: linux-amd64-container
linux-amd64-container: linux-amd64
linux-amd64-container: build-linux-amd64
podman build -t $(IMG):latest -f hack/Containerfile --build-arg=RELEASE_TAG=$(RELEASE_TAG) .

# Utils dev
.PHONY: update-go
update-go:
go get -u
go mod tidy

.PHONY: test
test:
go test ./...
Expand All @@ -63,4 +73,4 @@ vet:

.PHONY: clean
clean:
rm -rvf ./openshift-provider-cert-* ./opct-*
rm -rvf ./build/ ./openshift-provider-cert-* ./opct-*
6 changes: 3 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "openshift-provider-cert",
Short: "OpenShift Provider Certification Tool",
Long: `OpenShift Provider Certification Tool is used to evaluate an OpenShift installation on a provider or hardware is in conformance`,
Use: "opct",
Short: "OPCT",
Long: `OpenShift/OKD Provider Compatibility Tool is used to validate an OpenShift installation on a provider or hardware using standard conformance suites`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
6 changes: 3 additions & 3 deletions hack/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG RELEASE_TAG
RUN apk add --no-cache --update make git
WORKDIR /go/src/github.com/redhat-openshift-ecosystem/provider-certification-tool
COPY . .
RUN make linux-amd64 RELEASE_TAG=${RELEASE_TAG}
RUN make build-linux-amd64 RELEASE_TAG=${RELEASE_TAG}

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8-860
LABEL io.k8s.display-name="OPCT" \
Expand All @@ -13,7 +13,7 @@ LABEL io.k8s.display-name="OPCT" \
io.opct.os="linux" io.opct.arch="amd64"

COPY --from=builder \
/go/src/github.com/redhat-openshift-ecosystem/provider-certification-tool/openshift-provider-cert-linux-amd64 \
/go/src/github.com/redhat-openshift-ecosystem/provider-certification-tool/build/opct-linux-amd64 \
/usr/bin/

CMD ["/usr/bin/openshift-provider-cert-linux-amd64"]
CMD ["/usr/bin/opct-linux-amd64"]
2 changes: 1 addition & 1 deletion pkg/destroy/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewCmdDestroy() *cobra.Command {
cmd := &cobra.Command{
Use: "destroy",
Aliases: []string{"delete"},
Short: "Destroy current Certification Environment",
Short: "Destroy current validation environment",
Long: `Destroys resources used for conformance testing inside of the target OpenShift cluster. This will not destroy OpenShift cluster.`,
Run: func(cmd *cobra.Command, args []string) {
log.Info("Starting the destroy flow...")
Expand Down
2 changes: 1 addition & 1 deletion pkg/report/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func processResult(input *Input) error {
}

func showAggregatedSummary(cs *summary.ConsolidatedSummary) error {
fmt.Printf("\n> OpenShift Provider Certification Summary <\n\n")
fmt.Printf("\n> OPCT Summary <\n\n")

// vars starting with p* represents the 'partner' artifact
// vars starting with b* represents 'baseline' artifact
Expand Down
8 changes: 4 additions & 4 deletions pkg/retrieve/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func NewCmdRetrieve() *cobra.Command {
return &cobra.Command{
Use: "retrieve",
Args: cobra.MaximumNArgs(1),
Short: "Collect results from certification environment",
Long: `Downloads the results archive from the certification environment`,
Short: "Collect results from validation environment",
Long: `Downloads the results archive from the validation environment`,
Run: func(cmd *cobra.Command, args []string) {
destinationDirectory, err := os.Getwd()
if err != nil {
Expand Down Expand Up @@ -62,7 +62,7 @@ func NewCmdRetrieve() *cobra.Command {
return
}

log.Info("Use the results command to check the certification test summary or share the results archive with your Red Hat partner.")
log.Info("Use the results command to check the validation test summary or share the results archive with your Red Hat partner.")
},
}
}
Expand Down Expand Up @@ -102,7 +102,7 @@ func retrieveResults(sclient sonobuoyclient.Interface, destinationDirectory stri
// Download results into target directory
results, err := writeResultsToDirectory(destinationDirectory, reader, ec)
if err != nil {
return errors.Wrap(err, "error retrieving certification results from sonobyuoy")
return errors.Wrap(err, "error retrieving results from sonobyuoy")
}

// Log the new files to stdout
Expand Down
14 changes: 7 additions & 7 deletions pkg/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ func NewCmdRun() *cobra.Command {

cmd := &cobra.Command{
Use: "run",
Short: "Run the suite of tests for provider certification",
Long: `Launches the provider certification environment inside of an already running OpenShift cluster`,
Short: "Run the suite of tests for provider validation",
Long: `Launches the provider validation environment inside of an already running OpenShift cluster`,
PreRun: func(cmd *cobra.Command, args []string) {
// Client setup
kclient, sclient, err = client.CreateClients()
Expand All @@ -93,7 +93,7 @@ func NewCmdRun() *cobra.Command {
}
},
Run: func(cmd *cobra.Command, args []string) {
log.Info("Running OpenShift Provider Certification Tool...")
log.Info("Running OPCT...")

// Fire off sonobuoy
err := o.Run(kclient, sclient)
Expand Down Expand Up @@ -174,7 +174,7 @@ func (r *RunOptions) PreRunCheck(kclient kubernetes.Interface) error {
for _, err := range errs {
log.Warn(err)
}
return errors.New("All Cluster Operators must be available, not progressing, and not degraded before certification can run")
return errors.New("All Cluster Operators must be available, not progressing, and not degraded before validation can run")
}

// Get ConfigV1 client for Cluster Operators
Expand All @@ -189,7 +189,7 @@ func (r *RunOptions) PreRunCheck(kclient kubernetes.Interface) error {
return err
}
if !managed {
return errors.New("OpenShift Image Registry must deployed before certification can run")
return errors.New("OpenShift Image Registry must deployed before validation can run")
}

// TODO: checkOrCreate MachineConfigPool with:
Expand Down Expand Up @@ -416,7 +416,7 @@ func (r *RunOptions) Run(kclient kubernetes.Interface, sclient sonobuoyclient.In

if r.plugins == nil || len(*r.plugins) == 0 {
// Use default built-in plugins
log.Debugf("Loading default certification plugins")
log.Debugf("Loading default plugins")
var err error
manifests, err = loadPluginManifests(r)
if err != nil {
Expand All @@ -435,7 +435,7 @@ func (r *RunOptions) Run(kclient kubernetes.Interface, sclient sonobuoyclient.In
}

if len(manifests) == 0 {
return errors.New("No certification plugins to run")
return errors.New("No validation plugins to run")
}

// Fill out the aggregator and worker configs
Expand Down
4 changes: 2 additions & 2 deletions pkg/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewCmdStatus() *cobra.Command {

cmd := &cobra.Command{
Use: "status",
Short: "Show the current status of the certification tool",
Short: "Show the current status of the validation tool",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
// Client setup
Expand Down Expand Up @@ -91,7 +91,7 @@ func (s *StatusOptions) PreRunCheck(kclient kubernetes.Interface) error {
if err != nil {
// If error is due to namespace not being found, return guidance.
if kerrors.IsNotFound(err) {
return errors.New("looks like there is no Certification environment running. use run command to start Certification process")
return errors.New("looks like there is no validation environment running. use run command to start the validation process")
}
}

Expand Down
13 changes: 10 additions & 3 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package version
import (
"fmt"

"github.com/redhat-openshift-ecosystem/provider-certification-tool/pkg"
"github.com/spf13/cobra"
"github.com/vmware-tanzu/sonobuoy/pkg/buildinfo"
)
Expand All @@ -28,15 +29,21 @@ type VersionContext struct {
}

func (vc *VersionContext) String() string {
return fmt.Sprintf("OpenShift Provider Certification Tool: %s+%s", vc.Version, vc.Commit)
return fmt.Sprintf("OPCT CLI: %s+%s", vc.Version, vc.Commit)
}

func (vc *VersionContext) StringPlugins() string {
return fmt.Sprintf("OPCT Plugins: %s", pkg.PluginsImage)
}

func NewCmdVersion() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Print provider certification tool version",
Short: "Print provider validation tool version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(Version.String())
fmt.Printf("Sonobuoy Version: %s\n", buildinfo.Version)
fmt.Println(Version.StringPlugins())
fmt.Printf("Sonobuoy: %s\n", buildinfo.Version)
},
}
}

0 comments on commit 2c7e3b7

Please sign in to comment.