Skip to content

Fix tests #768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 19, 2025
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
6 changes: 4 additions & 2 deletions .github/workflows/coherence-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,10 @@ jobs:
echo "COHERENCE_IMAGE=${COHERENCE_IMAGE}"
export BUILD_JAVA_VERSION=${{ matrix.javaVersion }}
echo "BUILD_JAVA_VERSION=${BUILD_JAVA_VERSION}"
export COHERENCE_TEST_BASE_IMAGE=${{ matrix.baseImage }}
echo "COHERENCE_TEST_BASE_IMAGE=${COHERENCE_TEST_BASE_IMAGE}"
export COHERENCE_TEST_BASE_IMAGE_17=${{ matrix.baseImage }}
echo "COHERENCE_TEST_BASE_IMAGE_17=${COHERENCE_TEST_BASE_IMAGE_17}"
export COHERENCE_TEST_BASE_IMAGE_21=${{ matrix.baseImage }}
echo "COHERENCE_TEST_BASE_IMAGE_21=${COHERENCE_TEST_BASE_IMAGE_17}"
export OPERATOR_COHERENCE_JAVA_8=${{ matrix.coherenceIsJava8 }}
make clean
echo "Building Operator Image"
Expand Down
23 changes: 9 additions & 14 deletions .github/workflows/compatibility-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,42 +45,37 @@ jobs:
- 3.3.5
- 3.3.4
- 3.3.3
- 3.3.2
include:
- compatibilityVersion: 3.5.0
coherence-image: "ghcr.io/oracle/coherence-ce:14.1.2-0-1"
coherence-image: "ghcr.io/oracle/coherence-ce:14.1.2-0-2"
compatibilitySelector: control-plane=coherence
k8s: kindest/node:v1.33.0@sha256:91e9ed777db80279c22d1d1068c091b899b2078506e4a0f797fbf6e397c0b0b2
k8s: kindest/node:v1.33.1@sha256:050072256b9a903bd914c0b2866828150cb229cea0efe5892e2b644d5dd3b34f
- compatibilityVersion: 3.4.3
coherence-image: "ghcr.io/oracle/coherence-ce:14.1.2-0-1"
coherence-image: "ghcr.io/oracle/coherence-ce:14.1.2-0-2"
compatibilitySelector: control-plane=coherence
k8s: kindest/node:v1.32.2@sha256:f226345927d7e348497136874b6d207e0b32cc52154ad8323129352923a3142f
- compatibilityVersion: 3.4.2
coherence-image: "ghcr.io/oracle/coherence-ce:14.1.2-0-1"
coherence-image: "ghcr.io/oracle/coherence-ce:14.1.2-0-2"
compatibilitySelector: control-plane=coherence
k8s: kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245
- compatibilityVersion: 3.4.1
coherence-image: "ghcr.io/oracle/coherence-ce:14.1.2-0-1"
coherence-image: "ghcr.io/oracle/coherence-ce:14.1.2-0-2"
compatibilitySelector: control-plane=coherence
k8s: kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245
- compatibilityVersion: 3.4.0
coherence-image: "ghcr.io/oracle/coherence-ce:22.06.10"
coherence-image: "ghcr.io/oracle/coherence-ce:22.06.12"
compatibilitySelector: control-plane=coherence
k8s: kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245
- compatibilityVersion: 3.3.5
coherence-image: "ghcr.io/oracle/coherence-ce:22.06.10"
coherence-image: "ghcr.io/oracle/coherence-ce:22.06.12"
compatibilitySelector: control-plane=coherence
k8s: kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245
- compatibilityVersion: 3.3.4
coherence-image: "ghcr.io/oracle/coherence-ce:22.06.10"
coherence-image: "ghcr.io/oracle/coherence-ce:22.06.12"
compatibilitySelector: control-plane=coherence
k8s: kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245
- compatibilityVersion: 3.3.3
coherence-image: "ghcr.io/oracle/coherence-ce:22.06.10"
compatibilitySelector: control-plane=coherence
k8s: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72
- compatibilityVersion: 3.3.2
coherence-image: "ghcr.io/oracle/coherence-ce:22.06.10"
coherence-image: "ghcr.io/oracle/coherence-ce:22.06.12"
compatibilitySelector: control-plane=coherence
k8s: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72

Expand Down
14 changes: 8 additions & 6 deletions controllers/coherence_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (in *CoherenceReconciler) Reconcile(ctx context.Context, request ctrl.Reque
// request for the same resource is already in progress so requeue this one.
if ok := in.Lock(request); !ok {
log.Info("Coherence resource " + request.Namespace + "/" + request.Name + " is already locked, requeue request")
return reconcile.Result{Requeue: true, RequeueAfter: 0}, nil
return reconcile.Result{RequeueAfter: time.Minute}, nil
}
// Make sure that the request is unlocked when this method exits
defer in.Unlock(request)
Expand Down Expand Up @@ -134,7 +134,7 @@ func (in *CoherenceReconciler) Reconcile(ctx context.Context, request ctrl.Reque
msg := fmt.Sprintf("failed to finalize Coherence resource, %s", err.Error())
in.GetEventRecorder().Event(deployment, coreV1.EventTypeWarning, reconciler.EventReasonDeleted, msg)
log.Error(err, "Failed to remove finalizer")
return ctrl.Result{Requeue: true}, nil
return ctrl.Result{RequeueAfter: time.Minute}, nil
}
// Remove the finalizer. Once all finalizers have been
// removed, the object will be deleted.
Expand Down Expand Up @@ -164,7 +164,7 @@ func (in *CoherenceReconciler) Reconcile(ctx context.Context, request ctrl.Reque
if controllerutil.ContainsFinalizer(deployment, coh.CoherenceFinalizer) {
err := in.finalizerManager.EnsureFinalizerRemoved(ctx, deployment)
if err != nil && !apierrors.IsNotFound(err) {
return ctrl.Result{Requeue: true}, errorhandling.NewOperationError("remove_finalizer", err).
return ctrl.Result{}, errorhandling.NewOperationError("remove_finalizer", err).
WithContext("resource", deployment.GetName()).
WithContext("namespace", deployment.GetNamespace()).
WithContext("reason", "allow_unsafe_delete")
Expand Down Expand Up @@ -238,7 +238,7 @@ func (in *CoherenceReconciler) Reconcile(ctx context.Context, request ctrl.Reque
}

// create the result
result := ctrl.Result{Requeue: false}
result := ctrl.Result{}

hash := deployment.GetGenerationString()
storeHash, _ := storage.GetHash()
Expand All @@ -253,6 +253,7 @@ func (in *CoherenceReconciler) Reconcile(ctx context.Context, request ctrl.Reque
if err = in.statusManager.UpdateDeploymentStatusHash(ctx, request.NamespacedName, hashNew); err != nil {
return result, errors.Wrap(err, "error updating deployment status hash")
}
log.Info("Updated pre-3.5.0 Coherence resource status hash", "From", hash, "To", hashNew)
return result, nil
}

Expand Down Expand Up @@ -369,8 +370,9 @@ func (in *CoherenceReconciler) SetupWithManager(mgr ctrl.Manager, cs clients.Cli
}

in.statusManager = &status.StatusManager{
Client: mgr.GetClient(),
Log: in.Log.WithName("status"),
Client: mgr.GetClient(),
Log: in.Log.WithName("status"),
Patcher: in.GetPatcher(),
}

in.resourcesManager = &resources.OperatorSecretManager{
Expand Down
2 changes: 1 addition & 1 deletion controllers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func checkHash(deployment coh.CoherenceResource, phase coh.ConditionType, storag
if hashFound {
// The "storeHash" is not "", so it must have been previously processed by the Operator (could have been a previous version).
// The operator now uses the Coherence resource's generation instead of calculating a hash, so if the version is
// 3.4.3 or earlier and hash difference is ignored.
// 3.4.3 or earlier the hash difference is ignored.
if deployment.IsBeforeOrSameVersion("3.4.3") {
// There is an edge case where the Coherence resource could have legitimately been updated whilst
// the Operator and web-hooks were uninstalled. In that case we would ignore the update until another
Expand Down
30 changes: 19 additions & 11 deletions controllers/status/status_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ import (
"github.com/go-logr/logr"
coh "github.com/oracle/coherence-operator/api/v1"
"github.com/oracle/coherence-operator/pkg/operator"
"github.com/oracle/coherence-operator/pkg/patching"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
)

// StatusManager manages the status of Coherence resources
type StatusManager struct {
Client client.Client
Log logr.Logger
Client client.Client
Log logr.Logger
Patcher patching.ResourcePatcher
}

// UpdateCoherenceStatusPhase updates the phase of a Coherence resource
Expand All @@ -36,12 +38,7 @@ func (sm *StatusManager) UpdateCoherenceStatusPhase(ctx context.Context, namespa
updated.Status.Phase = phase

// Update the resource
err = sm.Client.Status().Patch(ctx, deployment, client.MergeFrom(updated))
if err != nil {
return errors.Wrapf(err, "updating status phase for Coherence resource %s/%s", namespacedName.Namespace, namespacedName.Name)
}

return nil
return sm.patchStatus(ctx, deployment, updated)
}

// UpdateDeploymentStatusHash updates the hash in the status of a Coherence resource
Expand All @@ -59,10 +56,21 @@ func (sm *StatusManager) UpdateDeploymentStatusHash(ctx context.Context, namespa
updated.Status.SetVersion(operator.GetVersion())

// Update the resource
err = sm.Client.Status().Patch(ctx, deployment, client.MergeFrom(updated))
return sm.patchStatus(ctx, deployment, updated)
}

func (sm *StatusManager) patchStatus(ctx context.Context, original, updated *coh.Coherence) error {
patch, err := sm.Patcher.CreateTwoWayPatchOfType(types.MergePatchType, original.Name, updated, original)
if err != nil {
return errors.Wrapf(err, "updating status hash for Coherence resource %s/%s", namespacedName.Namespace, namespacedName.Name)
return errors.Wrapf(err, "creating status patch for Coherence resource %s/%s", original.Namespace, original.Name)
}
if patch != nil {
sm.Log.Info("Patching status", "Namespace", original.Namespace, "Name", original.Name, "Patch", patch)
err = sm.Client.Status().Patch(ctx, original, patch)
if err != nil {
return errors.Wrapf(err, "updating status for Coherence resource %s/%s", original.Namespace, original.Name)
}
sm.Log.Info("Patched status", "Namespace", original.Namespace, "Name", original.Name, "Patch", patch)
}

return nil
}
16 changes: 5 additions & 11 deletions hack/github/github-pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fi

if [ "${OPERATOR_VERSION}" == "" ]
then
OPERATOR_VERSION=$(cat "${BUILD_OUTPUT}/OPERATOR_VERSION.txt")
OPERATOR_VERSION=$(make version)
fi

GITHUB_REPO=https://github.com/oracle/coherence-operator.git
Expand All @@ -41,18 +41,12 @@ rm -rf ${BUILD_GH_PAGES}/dashboards/latest || true
cp -R ${BUILD_GH_PAGES}/dashboards/${OPERATOR_VERSION} ${BUILD_GH_PAGES}/dashboards/latest
git add -A dashboards/latest/*

mkdir ${BUILD_GH_PAGES}/docs/${OPERATOR_VERSION} || true
rm -rf ${BUILD_GH_PAGES}/docs/${OPERATOR_VERSION}/ || true
cp -R ${BUILD_OUTPUT}/docs ${BUILD_GH_PAGES}/docs/${OPERATOR_VERSION}/
rm -rf ${BUILD_GH_PAGES}/docs/latest
cp -R ${BUILD_GH_PAGES}/docs/${OPERATOR_VERSION} ${BUILD_GH_PAGES}/docs/latest
git add -A docs/*

mkdir -p ${BUILD_GH_PAGES}/charts || true
cp ${BUILD_OUTPUT}/helm-charts/coherence-operator-${OPERATOR_VERSION}.tgz ${BUILD_GH_PAGES}/charts/
helm repo index charts --url https://oracle.github.io/coherence-operator/charts
git add charts/coherence-operator-${OPERATOR_VERSION}.tgz
git add charts/index.yaml
ls -al ${BUILD_GH_PAGES}/charts
helm repo index ${BUILD_GH_PAGES}/charts --url https://oracle.github.io/coherence-operator/charts
git add ${BUILD_GH_PAGES}/charts/coherence-operator-${OPERATOR_VERSION}.tgz
git add ${BUILD_GH_PAGES}/charts/index.yaml

git clean -d -f

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates.
* Copyright (c) 2021, 2025, Oracle and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
Expand All @@ -10,6 +10,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.PosixFilePermissions;

/**
* Set-up class run by the compatibility image build.
Expand Down Expand Up @@ -44,6 +45,10 @@ private static void copy(Path source, Path targetDir) throws Exception {
if (source.toFile().exists()) {
Path target = targetDir.resolve(source.getFileName());
Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
Files.setPosixFilePermissions(target, PosixFilePermissions.fromString("rw-r--r--"));
}
else {
System.out.println("Nothing to copy, source does not exist: " + source);
}
}
}
6 changes: 3 additions & 3 deletions java/operator-compatibility/src/main/resources/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM ${coherence.compatibility.coherence.image}
FROM ${coherence.compatibility.coherence.image} AS builder

USER root
COPY target/classes/build.sh build.sh
COPY target/operator-compatibility-*.jar /app/libs/operator-compatibility.jar
COPY --chmod=544 target/operator-compatibility-*.jar /app/libs/operator-compatibility.jar
RUN ["java", "-cp", "/app/libs/operator-compatibility.jar", "com.oracle.coherence.k8s.testing.Setup"]

FROM ${coherence.test.base.image}

COPY --from=0 /app/ /app/
COPY --from=builder /app/ /app/

ENTRYPOINT ["java", "-XshowSettings:all", "-XX:+PrintCommandLineFlags", "-XX:+PrintFlagsFinal", "-Dcoherence.ttl=0", "-cp", "/coherence/ext/conf:/coherence/ext/lib/*:/app/resources:/app/classes:/app/libs/*", "com.oracle.coherence.k8s.testing.RestServer"]
Loading