Skip to content
Open
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
8 changes: 8 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ All e2e resources (host operator, member operator, registration-service, CRDs, e

* `make dev-deploy-e2e-local` - deploys the same resources as `make test-e2e-local` in dev environment but doesn't run tests.

* `make dev-deploy-e2e-local-debug` - deploys the same resources as `make test-e2e-local` in the local OpenShift
instance, but builds the services and the operators without any code optimizations. It also ships Delve in the images,
and launches those services with it, which leaves the debugger listening on port `50000`. Then, you can simply `oc
port-forward ${POD} 50000:50000` and connect to them with your favorite IDE. The services that are built like that are:
** The registration service.
** The host operator controller manager.
** The member operator controller manager.

* `make dev-deploy-e2e` - deploys the same resources as `make test-e2e` in dev environment but doesn't run tests.

* `make deploy-single-member-e2e-latest` - deploys the same resources (using the latest and greatest images of Toolchain operators) as `make test-e2e` but with only one member and doesn't run tests.
Expand Down
30 changes: 30 additions & 0 deletions make/dev.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,36 @@ setup-dev-sso:
.PHONY: dev-deploy-e2e-local
dev-deploy-e2e-local: deploy-e2e-local-to-dev-namespaces print-reg-service-link

# Builds the services' and operators' images with the debugger in it, so that
# then an IDE can be connected to them. Since the targets down the line use
# the default namespaces, we can use them to patch the required CRs in order
# to launch the binaries with Delve.
.ONESHELL:
.PHONY: dev-deploy-e2e-local-debug
dev-deploy-e2e-local-debug: export DEBUG_MODE=true
dev-deploy-e2e-local-debug:
$(MAKE) dev-deploy-e2e-local

# Get the CSVs for the host and member operators, in order to be able to
# patch them.
HOST_CSV_NAME=$$(oc get --namespace "${DEFAULT_HOST_NS}" --output name ClusterServiceVersion)
MEMBER_CSV_NAME=$$(oc get --namespace ${DEFAULT_MEMBER_NS} --output name ClusterServiceVersion)

# Patch the host operator indicating which command the registration
# service should be run with. The command simply adds an environment
# variable to the operator which then makes sure that the registration
# service is run with Delve, in case the user wants to connect to it.
oc patch --namespace "${DEFAULT_HOST_NS}" "${HOST_CSV_NAME}" --type='json' --patch='[{"op": "add", "path": "/spec/install/spec/deployments/0/spec/template/spec/containers/1/env/-", "value": {"name": "REGISTRATION_SERVICE_COMMAND", "value": "[\"dlv\", \"--listen=:50000\", \"--headless\", \"--continue\", \"--api-version=2\", \"--accept-multiclient\", \"exec\", \"/usr/local/bin/registration-service\"]"}}]' || true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

The || true suppresses all errors, including legitimate failures.

While this may be intentional to handle cases where the env var already exists, it also hides real problems like malformed JSON patches or connectivity issues. Consider checking for the specific error condition or removing the fallback if this patch is required for debugging to work.


# Reduce the registration service's replicas to 1, in order to facilitate
# the port forwarding and debugging of the service.
oc patch --namespace "${DEFAULT_HOST_NS}" ToolchainConfig config --type='merge' --patch='{"spec":{"host":{"registrationService":{"replicas":1}}}}'

# Patch the host-operator and member-operator CSVs to make them run with
# Delve.
oc patch --namespace "${DEFAULT_HOST_NS}" "${HOST_CSV_NAME}" --type='json' --patch='[{"op": "replace", "path": "/spec/install/spec/deployments/0/spec/template/spec/containers/1/args", "value": []}, {"op": "replace", "path": "/spec/install/spec/deployments/0/spec/template/spec/containers/1/command", "value": ["dlv", "--listen=:50000", "--headless", "--continue", "--api-version=2", "--accept-multiclient", "exec", "/usr/local/bin/host-operator", "--", "--health-probe-bind-address=:8081", "--metrics-bind-address=127.0.0.1:8080", "--leader-elect"]}]'
oc patch --namespace "${DEFAULT_MEMBER_NS}" "${MEMBER_CSV_NAME}" --type='json' --patch='[{"op": "replace", "path": "/spec/install/spec/deployments/0/spec/template/spec/containers/0/args", "value": []}, {"op": "replace", "path": "/spec/install/spec/deployments/0/spec/template/spec/containers/0/command", "value": ["dlv", "--listen=:50000", "--headless", "--continue", "--api-version=2", "--accept-multiclient", "exec", "/usr/local/bin/member-operator", "--", "--health-probe-bind-address=:8081", "--metrics-bind-address=127.0.0.1:8080", "--leader-elect"]}]'

.PHONY: dev-deploy-e2e-local-two-members
dev-deploy-e2e-local-two-members: deploy-e2e-local-to-dev-namespaces-two-members print-reg-service-link

Expand Down
4 changes: 2 additions & 2 deletions scripts/ci/manage-host-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ if [[ -n "${CI}${REG_REPO_PATH}${HOST_REPO_PATH}" ]] && [[ $(echo ${REPO_NAME} |
set_tags

if [[ ${PUBLISH_OPERATOR} == "true" ]]; then
push_image
push_image "${DEBUG_MODE}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder whether this should be added as an option for consistency with other options or it's fine to treat it as a special environment variable.

@MatousJobanek and @rsoaresd may have thoughts on this

REG_SERV_IMAGE_LOC=${IMAGE_LOC}
REG_REPO_PATH=${REPOSITORY_PATH}
fi
Expand All @@ -108,7 +108,7 @@ if [[ -n "${CI}${REG_REPO_PATH}${HOST_REPO_PATH}" ]] && [[ $(echo ${REPO_NAME} |
set_tags

if [[ ${PUBLISH_OPERATOR} == "true" ]]; then
push_image
push_image "${DEBUG_MODE}"
OPERATOR_IMAGE_LOC=${IMAGE_LOC}
make -C ${REPOSITORY_PATH} publish-current-bundle INDEX_IMAGE_TAG=${BUNDLE_AND_INDEX_TAG} BUNDLE_TAG=${BUNDLE_AND_INDEX_TAG} QUAY_NAMESPACE=${QUAY_NAMESPACE} OTHER_REPO_PATH=${REG_REPO_PATH} OTHER_REPO_IMAGE_LOC=${REG_SERV_IMAGE_LOC} IMAGE=${OPERATOR_IMAGE_LOC}
fi
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/manage-member-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ if [[ -n "${CI}${MEMBER_REPO_PATH}" ]] && [[ $(echo ${REPO_NAME} | sed 's/"//g')
set_tags

if [[ ${PUBLISH_OPERATOR} == "true" ]]; then
push_image
push_image "${DEBUG_MODE}"

OPERATOR_IMAGE_LOC=${IMAGE_LOC}
make -C ${REPOSITORY_PATH} publish-current-bundle INDEX_IMAGE_TAG=${BUNDLE_AND_INDEX_TAG} BUNDLE_TAG=${BUNDLE_AND_INDEX_TAG} QUAY_NAMESPACE=${QUAY_NAMESPACE} IMAGE=${OPERATOR_IMAGE_LOC}
Expand Down
11 changes: 9 additions & 2 deletions scripts/ci/manage-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,18 @@ set_tags() {
}

push_image() {
# When the "${DEBUG_MODE}" argument is passed, we instruct Make to push
# the "debug" images with Delve on them.
if [[ $1 == "true" ]]; then
DEBUG_MODE_SUFFIX="-debug"
else
DEBUG_MODE_SUFFIX=""
fi

GIT_COMMIT_ID=$(git --git-dir=${REPOSITORY_PATH}/.git --work-tree=${REPOSITORY_PATH} rev-parse --short HEAD)
IMAGE_LOC=quay.io/codeready-toolchain/${REPOSITORY_NAME}:${GIT_COMMIT_ID}
if is_provided_or_paired; then
IMAGE_BUILDER=${IMAGE_BUILDER:-"podman"}
make -C ${REPOSITORY_PATH} ${IMAGE_BUILDER}-push QUAY_NAMESPACE=${QUAY_NAMESPACE} IMAGE_TAG=${TAGS}
make -C ${REPOSITORY_PATH} ${IMAGE_BUILDER}-push${DEBUG_MODE_SUFFIX} QUAY_NAMESPACE=${QUAY_NAMESPACE} IMAGE_TAG=${TAGS}
IMAGE_LOC=quay.io/${QUAY_NAMESPACE}/${REPOSITORY_NAME}:${TAGS}
fi
}
Comment on lines 47 to 62
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, understand the repo structure and the manage-operator.sh script
git ls-files | head -20

Repository: codeready-toolchain/toolchain-e2e

Length of output: 591


🏁 Script executed:

# Look at the manage-operator.sh script to understand what repos it references
cat -n scripts/ci/manage-operator.sh | head -100

Repository: codeready-toolchain/toolchain-e2e

Length of output: 4890


🏁 Script executed:

# Search for any Makefile targets related to "push-debug"
rg 'push-debug|push.*debug' --type=make -n

Repository: codeready-toolchain/toolchain-e2e

Length of output: 59


🏁 Script executed:

# Also check for any docker or podman push targets
rg 'docker-push|podman-push' --type=make -n

Repository: codeready-toolchain/toolchain-e2e

Length of output: 59


🏁 Script executed:

# Check if there are external repo references or documentation
rg 'host-operator|member-operator' -n | head -20

Repository: codeready-toolchain/toolchain-e2e

Length of output: 4535


🌐 Web query:

host-operator repository Makefile docker-push-debug target

💡 Result:

Do you mean the host-operator in the codeready-toolchain GitHub repo (github.com/codeready-toolchain/host-operator)? If so, do you want me to (a) show the Makefile section for the docker-push-debug target, (b) explain what that target does, or (c) locate a different host-operator repo?


🌐 Web query:

member-operator repository Makefile podman-push-debug target

💡 Result:

Which repository do you mean (link or org/name)? I can then fetch its Makefile and explain the podman-push-debug target or how to run it.


🌐 Web query:

codeready-toolchain host-operator Makefile push-debug target site:github.com

💡 Result:

Do you want me to find the exact Makefile "push-debug" target inside the codeready-toolchain/host-operator GitHub repo (and show its contents)? If so I’ll search GitHub and return the file location and snippet.


🌐 Web query:

site:github.com/codeready-toolchain/host-operator Makefile

💡 Result:

I found the repository and its Makefile in the codeready-toolchain/host-operator repo on GitHub: https://github.com/codeready-toolchain/host-operator (Makefile listed in the repo root). [1]

Would you like me to fetch and show the Makefile contents?


🌐 Web query:

site:github.com/codeready-toolchain/member-operator Makefile push

💡 Result:

The repo’s Makefile provides image-push targets — notably podman-push and push-to-quay-staging. The README instructs running:

  • make podman-push QUAY_NAMESPACE=codeready-toolchain
  • make push-to-quay-staging QUAY_NAMESPACE=codeready-toolchain. [1][2]

Sources:
[1] codeready-toolchain/member-operator README (Makefile push instructions).
[2] codeready-toolchain/member-operator Makefile (repository).


🌐 Web query:

"push-debug" OR "docker-push-debug" OR "podman-push-debug" site:github.com/codeready-toolchain/host-operator

💡 Result:

I searched the codeready-toolchain/host-operator repository for "push-debug", "docker-push-debug", and "podman-push-debug" and found no matches. Would you like me to (a) search all of GitHub for those terms, or (b) search the repository for similar/related build or push targets (e.g., Makefile, scripts, GitHub Actions)?


🌐 Web query:

"push-debug" OR "docker-push-debug" OR "podman-push-debug" site:github.com/codeready-toolchain/member-operator

💡 Result:

I searched the codeready-toolchain/member-operator repository and found no matches for "push-debug", "docker-push-debug", or "podman-push-debug". (github.com)

Citations:


The debug push targets do not exist in the operator repositories. This implementation will fail at runtime.

The docker-push-debug and podman-push-debug make targets referenced on line 59 do not exist in either the host-operator or member-operator repositories. When push_image() is called with the first argument set to "true", the make command will fail because the target ${IMAGE_BUILDER}-push-debug is undefined.

Either:

  1. Add the docker-push-debug and podman-push-debug targets to the operator Makefiles, or
  2. Remove the debug mode suffix logic from this function and handle debug builds separately
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 60-60: IMAGE_LOC appears unused. Verify use (or export if used externally).

(SC2034)

🤖 Prompt for AI Agents
In scripts/ci/manage-operator.sh around lines 47 to 62, the function push_image
builds a make target with a "-debug" suffix when the first arg is "true", but
those docker-push-debug/podman-push-debug targets do not exist causing runtime
failures; remove the DEBUG_MODE_SUFFIX logic so the make invocation always calls
the existing ${IMAGE_BUILDER}-push target (and leave debug-image handling to a
separate, explicit flow), or alternatively add a guard that only appends
"-debug" when the target actually exists; update the function to use a single
known target (or perform an explicit conditional to call a separate debug build
routine) and ensure IMAGE_LOC/IMAGE_TAG logic remains correct.

Expand Down
Loading