Skip to content

Commit

Permalink
Merge pull request openshift#4753 from cheesesashimi/zzlotnik/incorpo…
Browse files Browse the repository at this point in the history
…rate-changes-to-helpers

MCO-1470: Incorporates upstream devex helper changes for OCL testing
  • Loading branch information
openshift-merge-bot[bot] authored Dec 14, 2024
2 parents cd22882 + 2b3b340 commit 36e2d57
Show file tree
Hide file tree
Showing 69 changed files with 462 additions and 389 deletions.
28 changes: 0 additions & 28 deletions Containerfile.helpers

This file was deleted.

11 changes: 11 additions & 0 deletions Containerfile.helpers-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-builder-multi-openshift-4.18 AS builder
ENV GOCACHE="/go/.cache" \
GOMODCACHE="/go/pkg/mod"
WORKDIR /go/src/github.com/openshift/machine-config-operator
COPY . .
RUN --mount=type=cache,target=/go/.cache,z \
--mount=type=cache,target=/go/pkg/mod,z \
make install-helpers DESTDIR=/helpers

FROM registry.ci.openshift.org/ocp/builder:rhel-9-enterprise-base-multi-openshift-4.18 AS final
COPY --from=builder /helpers/usr/bin /usr/bin
43 changes: 35 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
E2E_ROOT_DIR = ./test
E2E_SUITES = $(notdir $(wildcard $(E2E_ROOT_DIR)/e2e*))

MCO_COMPONENTS = daemon controller server operator
EXTRA_COMPONENTS = apiserver-watcher machine-os-builder
ALL_COMPONENTS = $(patsubst %,machine-config-%,$(MCO_COMPONENTS)) $(EXTRA_COMPONENTS)
Expand Down Expand Up @@ -41,9 +44,13 @@ clean:
_build-component-%:
WHAT_PATH=cmd/$* WHAT=$(basename $*) hack/build-go.sh

# Build the helpers under hack/cmd.
# Build the helpers under devex/cmd.
_build-helper-%:
WHAT_PATH=hack/cmd/$* WHAT=$(basename $*) hack/build-go.sh
WHAT_PATH=devex/cmd/$* WHAT=$(basename $*) hack/build-go.sh

# Verify that an e2e test is valid Golang by doing a trial compilation.
_verify-e2e-%:
go test -c -tags=$(GOTAGS) -o _output/$* ./test/$*/...

# Use podman to build the image.
image:
Expand Down Expand Up @@ -103,16 +110,25 @@ endif

install-tools: install-golangci-lint install-go-junit-report install-setup-envtest

# Run verification steps
# Example:
# make verify
verify: install-tools
# Runs golangci-lint
lint: install-tools
./hack/golangci-lint.sh $(GOTAGS)

# Verifies templates.
verify-templates:
hack/verify-templates.sh

# Verifies devex helpers
verify-helpers:
# Conditionally tries to build the helper binaries in CI.
hack/verify-helpers.sh

HELPERS_DIR := hack/cmd
# Runs all verification steps
# Example:
# make verify
verify: install-tools verify-e2e lint verify-templates verify-helpers

HELPERS_DIR := devex/cmd
HELPER_BINARIES := $(notdir $(wildcard $(HELPERS_DIR)/*))

.PHONY: helpers
Expand All @@ -135,14 +151,22 @@ endef
# Create a target for each component
$(foreach C, $(HELPER_BINARIES), $(eval $(call helper_target_template,$(C))))

define verify_e2e_target_template =
.PHONY: $(1)
$(1): _verify-e2e-$(1)
endef
# Create a target for each e2e suite
$(foreach C, $(E2E_SUITES), $(eval $(call verify_e2e_target_template,$(C))))


.PHONY: binaries helpers install

# Build all binaries:
# Example:
# make binaries
binaries: $(patsubst %,_build-component-%,$(ALL_COMPONENTS))

# Installs the helper binaries from hack/cmd.
# Installs the helper binaries from devex/cmd.
install-helpers: helpers
for helper in $(HELPER_BINARIES); do \
install -D -m 0755 _output/linux/$(GOARCH)/$${helper} $(DESTDIR)$(PREFIX)/bin/$${helper}; \
Expand All @@ -157,6 +181,9 @@ Dockerfile.rhel7: Dockerfile Makefile
(echo '# THIS FILE IS GENERATED FROM '$<' DO NOT EDIT' && \
sed -e s,org/openshift/release,org/ocp/builder, -e s,/openshift/origin-v4.0:base,/ocp/4.0:base, < $<) > $@.tmp && mv $@.tmp $@

# Validates that all of the e2e test suites are valid Golang by performing a test compilation.
verify-e2e: $(patsubst %,_verify-e2e-%,$(E2E_SUITES))

# This was copied from https://github.com/openshift/cluster-image-registry-operator
test-e2e: install-go-junit-report
set -o pipefail; go test -tags=$(GOTAGS) -failfast -timeout 170m -v$${WHAT:+ -run="$$WHAT"} ./test/e2e/ ./test/e2e-techpreview-shared/ | ./hack/test-with-junit.sh $(@)
Expand Down
18 changes: 18 additions & 0 deletions devex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# devex

## Background

This directory contains Golang programs which are most likely to be of use to
fellow OpenShift developers, especially members of the
[machine-config-operator](https://github.com/openshift/machine-config-operator)
team. The helpers found here may be of use to you. They may not. They may
completely break entirely.

It is worth mentioning that these helpers may get your cluster into a
difficult-to-recover-from state. So do not use these on a production OpenShift
cluster.

## Installation

From the repo root, run: `make install-helpers`. Note: You'll periodically have
to update the helpers based upon the current state of the MCO repository.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os/exec"
"strings"

"github.com/openshift/machine-config-operator/hack/internal/pkg/errors"
"github.com/openshift/machine-config-operator/devex/internal/pkg/errors"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/klog/v2"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"os/exec"

"github.com/openshift/machine-config-operator/hack/internal/pkg/errors"
"github.com/openshift/machine-config-operator/devex/internal/pkg/errors"
"k8s.io/klog/v2"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"path/filepath"
"runtime"

"github.com/openshift/machine-config-operator/hack/cmd/mco-builder/internal/builders"
"github.com/openshift/machine-config-operator/hack/internal/pkg/containers"
"github.com/openshift/machine-config-operator/hack/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/cmd/mco-builder/internal/builders"
"github.com/openshift/machine-config-operator/devex/internal/pkg/containers"
"github.com/openshift/machine-config-operator/devex/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/openshift/machine-config-operator/hack/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/devex/internal/pkg/rollout"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"fmt"

"github.com/openshift/machine-config-operator/hack/internal/pkg/containers"
"github.com/openshift/machine-config-operator/hack/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/devex/internal/pkg/containers"
"github.com/openshift/machine-config-operator/devex/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/openshift/machine-config-operator/hack/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/devex/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/openshift/machine-config-operator/hack/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/devex/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os/exec"
"path/filepath"

"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
"github.com/openshift/machine-config-operator/test/framework"
"golang.org/x/sync/errgroup"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"time"

"github.com/openshift/machine-config-operator/hack/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
"github.com/openshift/machine-config-operator/test/framework"
"golang.org/x/sync/errgroup"
apierrs "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -156,7 +156,9 @@ func waitForPoolsToComplete(cs *framework.ClientSet, pools []string) error {
pool := pool

eg.Go(func() error {
return rollout.WaitForMachineConfigPoolUpdateToComplete(cs, time.Minute*30, pool)
// TODO: Figure out why WaitForMachineConfigPoolToComplete() is not
// showing control-plane node status when nodes are considered.
return rollout.WaitForOnlyMachineConfigPoolToComplete(cs, pool, time.Minute*30)
})
}

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"strings"

"github.com/openshift/machine-config-operator/hack/cmd/onclustertesting/internal/legacycmds"
"github.com/openshift/machine-config-operator/devex/cmd/onclustertesting/internal/legacycmds"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/openshift/machine-config-operator/test/helpers"
"golang.org/x/sync/errgroup"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

mcfgv1 "github.com/openshift/api/machineconfiguration/v1"
"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"path/filepath"

"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"

"github.com/ghodss/yaml"
"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"

ign3types "github.com/coreos/ignition/v2/config/v3_4/types"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

mcfgv1 "github.com/openshift/api/machineconfiguration/v1"
"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

mcfgv1 "github.com/openshift/api/machineconfiguration/v1"
"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
"github.com/openshift/machine-config-operator/pkg/apihelpers"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"os"

"github.com/openshift/machine-config-operator/hack/cmd/onclustertesting/internal/legacycmds"
"github.com/openshift/machine-config-operator/devex/cmd/onclustertesting/internal/legacycmds"
"github.com/spf13/cobra"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
mcfgv1 "github.com/openshift/api/machineconfiguration/v1"
mcfgv1alpha1 "github.com/openshift/api/machineconfiguration/v1alpha1"
clientmachineconfigv1alpha1 "github.com/openshift/client-go/machineconfiguration/clientset/versioned/typed/machineconfiguration/v1alpha1"
"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
"github.com/openshift/machine-config-operator/test/framework"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/openshift/machine-config-operator/test/helpers"
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/openshift/machine-config-operator/test/helpers"
"github.com/spf13/cobra"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"

"github.com/ghodss/yaml"
"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/openshift/machine-config-operator/test/helpers"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"time"

"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"context"

"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
apierrs "k8s.io/apimachinery/pkg/api/errors"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

"golang.org/x/sync/errgroup"

"github.com/openshift/machine-config-operator/hack/internal/pkg/utils"
"github.com/openshift/machine-config-operator/devex/internal/pkg/utils"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
aggerrs "k8s.io/apimachinery/pkg/util/errors"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"time"

"github.com/openshift/machine-config-operator/hack/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/devex/internal/pkg/rollout"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/spf13/cobra"
"k8s.io/component-base/cli"
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 36e2d57

Please sign in to comment.