Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c309c01
feat: add orchestrator RBAC tests to e2e test suite
chadcrum Oct 20, 2025
e90ca69
feat: implement orchestrator RBAC e2e tests
chadcrum Oct 23, 2025
40b3315
feat: add read-only RBAC tests for orchestrator plugin
chadcrum Oct 23, 2025
23dcde4
feat: add denied workflow RBAC tests for orchestrator plugin
chadcrum Oct 23, 2025
f67e70a
refactor: update test naming to include 'global' for workflow RBAC tests
chadcrum Oct 23, 2025
87e019f
feat: add individual workflow denied access RBAC tests for orchestrat…
chadcrum Oct 23, 2025
910c06f
feat: add individual workflow read-write access RBAC tests for orches…
chadcrum Oct 23, 2025
0139bfd
feat: add individual workflow read-only access RBAC tests for orchest…
chadcrum Oct 23, 2025
5f951c5
Fix Orchestrator RBAC E2E tests for workflow instance isolation
chadcrum Oct 23, 2025
a29224b
Fix role naming and user switching for admin tests
chadcrum Oct 23, 2025
2bcf634
Add pre-test cleanup and identify orchestrator RBAC integration issue
chadcrum Oct 23, 2025
b051b7c
Add orchestrator to pluginsWithPermission array in RBAC configuration
chadcrum Oct 23, 2025
962b7b5
Refactor Orchestrator RBAC tests to use fixed role names
chadcrum Oct 23, 2025
c2aee1b
Complete refactoring of Orchestrator RBAC tests with fixed role names
chadcrum Oct 23, 2025
d282d90
Add temp sleep for testing
chadcrum Oct 23, 2025
0945a78
fix: resolve linting errors in orchestrator RBAC e2e tests
chadcrum Oct 24, 2025
26e2c97
fix: apply Prettier formatting to e2e test files
chadcrum Oct 24, 2025
9328d89
fix: wait for backstage deployment readiness before orchestrator plug…
chadcrum Oct 24, 2025
e4e00c7
fix: apply prettier formatting to utils.sh
chadcrum Oct 24, 2025
44fae45
fix: disable tech-radar frontend plugin in RBAC operator deployments
chadcrum Oct 24, 2025
19ba6ad
chore: comment out sleep command used for testing
chadcrum Oct 24, 2025
e9f2fb3
chore: comment out sleep command used for testing
chadcrum Oct 24, 2025
221572c
fix: disable all tech-radar plugins (frontend and backend) in RBAC op…
chadcrum Oct 24, 2025
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
21 changes: 11 additions & 10 deletions .ibm/pipelines/jobs/ocp-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ initiate_operator_deployments() {

prepare_operator

configure_namespace "${NAME_SPACE}"
deploy_test_backstage_customization_provider "${NAME_SPACE}"
local rhdh_base_url="https://backstage-${RELEASE_NAME}-${NAME_SPACE}.${K8S_CLUSTER_ROUTER_BASE}"
apply_yaml_files "${DIR}" "${NAME_SPACE}" "${rhdh_base_url}"
create_dynamic_plugins_config "${DIR}/value_files/${HELM_CHART_VALUE_FILE_NAME}" "/tmp/configmap-dynamic-plugins.yaml"
oc apply -f /tmp/configmap-dynamic-plugins.yaml -n "${NAME_SPACE}"
deploy_redis_cache "${NAME_SPACE}"
deploy_rhdh_operator "${NAME_SPACE}" "${DIR}/resources/rhdh-operator/rhdh-start.yaml"
enable_orchestrator_plugins_op "${NAME_SPACE}"
deploy_orchestrator_workflows_operator "${NAME_SPACE}"
# configure_namespace "${NAME_SPACE}"
# deploy_test_backstage_customization_provider "${NAME_SPACE}"
# local rhdh_base_url="https://backstage-${RELEASE_NAME}-${NAME_SPACE}.${K8S_CLUSTER_ROUTER_BASE}"
# apply_yaml_files "${DIR}" "${NAME_SPACE}" "${rhdh_base_url}"
# create_dynamic_plugins_config "${DIR}/value_files/${HELM_CHART_VALUE_FILE_NAME}" "/tmp/configmap-dynamic-plugins.yaml"
# oc apply -f /tmp/configmap-dynamic-plugins.yaml -n "${NAME_SPACE}"
# deploy_redis_cache "${NAME_SPACE}"
# deploy_rhdh_operator "${NAME_SPACE}" "${DIR}/resources/rhdh-operator/rhdh-start.yaml"
# enable_orchestrator_plugins_op "${NAME_SPACE}"
# deploy_orchestrator_workflows_operator "${NAME_SPACE}"

configure_namespace "${NAME_SPACE_RBAC}"
create_conditional_policies_operator /tmp/conditional-policies.yaml
Expand All @@ -30,6 +30,7 @@ initiate_operator_deployments() {
oc apply -f /tmp/configmap-dynamic-plugins-rbac.yaml -n "${NAME_SPACE_RBAC}"
deploy_rhdh_operator "${NAME_SPACE_RBAC}" "${DIR}/resources/rhdh-operator/rhdh-start-rbac.yaml"
enable_orchestrator_plugins_op "${NAME_SPACE_RBAC}"
#sleep 7200
deploy_orchestrator_workflows_operator "${NAME_SPACE_RBAC}"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ permission:
- scaffolder
- kubernetes
- scorecard
- orchestrator
admin:
users:
- name: user:default/rhdh-qe
Expand Down
60 changes: 25 additions & 35 deletions .ibm/pipelines/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1290,28 +1290,6 @@ EOF
echo "All workflow pods are now running!"
}

# Helper function to wait for backstage resource to exist in namespace
wait_for_backstage_resource() {
local namespace=$1
local max_attempts=40 # 40 attempts * 15 seconds = 10 minutes

local sleep_interval=15

echo "Waiting for backstage resource to exist in namespace: $namespace"

for ((i = 1; i <= max_attempts; i++)); do
if [[ $(oc get backstage -n "$namespace" -o json | jq '.items | length') -gt 0 ]]; then
echo "Backstage resource found in namespace: $namespace"
return 0
fi
echo "Attempt $i/$max_attempts: No backstage resource found, waiting ${sleep_interval}s..."
sleep $sleep_interval
done

echo "Error: No backstage resource found after 10 minutes"
return 1
}

# Helper function to enable orchestrator plugins by merging default and custom dynamic plugins
enable_orchestrator_plugins_op() {
local namespace=$1
Expand All @@ -1325,9 +1303,19 @@ enable_orchestrator_plugins_op() {

echo "Enabling orchestrator plugins in namespace: $namespace"

# Wait for backstage resource to exist
wait_for_backstage_resource "$namespace"
sleep 5
# Construct backstage deployment name based on namespace
# Pattern: backstage-rhdh for non-RBAC, backstage-rhdh-rbac for RBAC
local backstage_deployment
if [[ "$namespace" == *"rbac"* ]]; then
backstage_deployment="backstage-rhdh-rbac"
else
backstage_deployment="backstage-rhdh"
fi

echo "Waiting for backstage deployment: $backstage_deployment in namespace: $namespace"
# Wait for backstage deployment to be ready (15 minutes timeout)
wait_for_deployment "$namespace" "$backstage_deployment" 15
# sleep 5 # Commented out for testing

# Setup working directory
local work_dir="/tmp/orchestrator-plugins-merge"
Expand Down Expand Up @@ -1368,6 +1356,17 @@ enable_orchestrator_plugins_op() {
return 1
fi

# For RBAC namespaces, disable all tech-radar plugins (frontend and backend) if they exist
# These plugins are mistakenly enabled in the RBAC values file and cause deployment issues
# Using global replacement to handle duplicate entries
if [[ "$namespace" == *"rbac"* ]]; then
echo "Disabling all tech-radar plugins (frontend and backend) for RBAC namespace..."
# Disable frontend plugin (all instances)
yq eval '(.plugins[] | select(.package == "./dynamic-plugins/dist/backstage-community-plugin-tech-radar") | .disabled) = true' -i "$work_dir/custom-plugins.yaml" || true
# Disable backend plugin (all instances)
yq eval '(.plugins[] | select(.package == "./dynamic-plugins/dist/backstage-community-plugin-tech-radar-backend-dynamic") | .disabled) = true' -i "$work_dir/custom-plugins.yaml" || true
fi

# Use the modified custom file as the final merged result
if ! cp "$work_dir/custom-plugins.yaml" "$work_dir/merged-plugins.yaml"; then
echo "Error: Failed to create merged plugins file"
Expand All @@ -1382,16 +1381,7 @@ enable_orchestrator_plugins_op() {
return 1
fi

# Find and restart backstage deployment
echo "Finding backstage deployment..."
local backstage_deployment
backstage_deployment=$(oc get deployment -n "$namespace" --no-headers | grep "^backstage-rhdh" | awk '{print $1}' | head -1)

if [[ -z "$backstage_deployment" ]]; then
echo "Error: No backstage deployment found matching pattern 'backstage-rhdh*'"
return 1
fi

# Restart backstage deployment (using the deployment name determined earlier)
echo "Restarting backstage deployment: $backstage_deployment"
if ! oc rollout restart deployment/"$backstage_deployment" -n "$namespace"; then
echo "Error: Failed to restart backstage deployment"
Expand Down
Loading
Loading