8000 Avoid SIGPIPE failures from echo piped into grep -q by ahus1 · Pull Request #54805 · keycloak/keycloak · GitHub
[go: up one dir, main page]

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
2 changes: 1 addition & 1 deletion .github/actions/conditional/conditional.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ for C in "${CONDITIONS[@]}"; do
fi

# Check if changed files matches regex
if ( echo "$CHANGED_FILES" | grep -q -E "^$REGEX$"); then
if grep -q -E "^$REGEX$" <<<"$CHANGED_FILES"; then
RUN_JOB=true
echo "* $REGEX"
else
Expand Down
8 changes: 4 additions & 4 deletions .github/check-area-labels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ BUG_VALID=true

echo "Checking: $TEAMS"
for AREA in "${GH_AREAS[@]}"; do
if ! ( echo "${LOCAL_AREAS[@]}" | grep -q -F -w "$AREA" ); then
if ! grep -q -F -w "$AREA" <<<"${LOCAL_AREAS[@]}"; then
echo "[$AREA] missing in $TEAMS"
TEAMS_VALID=false
fi
done

for AREA in "${LOCAL_AREAS[@]}"; do
if ! ( echo "${GH_AREAS[@]}" | grep -q -F -w "$AREA" ); then
if ! grep -q -F -w "$AREA" <<<"${GH_AREAS[@]}"; then
echo "[$AREA] missing in GitHub"
TEAMS_VALID=false
fi
Expand All @@ -35,15 +35,15 @@ echo ""
echo "Checking: $BUG"
for AREA in "${GH_AREAS[@]}"; do
AREA_SHORT=$(echo $AREA | sed 's|area/||g')
if ! ( echo "${BUG_TEMPLATE_AREAS[@]}" | grep -q -F -w "$AREA_SHORT" ); then
if ! grep -q -F -w "$AREA_SHORT" <<<"${BUG_TEMPLATE_AREAS[@]}"; then
echo "[$AREA] missing in $BUG"
BUG_VALID=false
fi
done

for AREA in "${BUG_TEMPLATE_AREAS[@]}"; do
AREA_LONG="area/$AREA"
if ! ( echo "${GH_AREAS[@]}" | grep -q -F -w "$AREA_LONG" ); then
if ! grep -q -F -w "$AREA_LONG" <<<"${GH_AREAS[@]}"; then
echo "[$AREA_LONG] missing in GitHub"
BUG_VALID=false
fi
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/operator-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ jobs:
out=$(helm template kc-op operator/target/helm/kubernetes/keycloak-operator-helm)
# Default install ships one CRD per CR class (Keycloak, KeycloakRealmImport,
# KeycloakOIDCClient, KeycloakSAMLClient) plus the operator's Deployment.
crds=$(echo "$out" | grep -cE '^kind: "?CustomResourceDefinition"?$' || true)
crds=$(grep -cE '^kind: "?CustomResourceDefinition"?$' <<<"$out" || true)
if [ "$crds" -ne 4 ]; then echo "expected 4 CRDs, got $crds"; exit 1; fi
echo "$out" | grep -qE '^kind: Deployment$'
grep -qE '^kind: Deployment$' <<<"$out"
# Cluster-wide install binds the controllers via ClusterRoleBinding.
echo "$out" | grep -qE '^kind: ClusterRoleBinding$'
grep -qE '^kind: ClusterRoleBinding$' <<<"$out"
# No resource should be rendered twice (kind+name+namespace must be unique).
dupes=$(echo "$out" | awk '
/^kind:/{k=$2} /^ name:/{n=$2} /^ namespace:/{ns=$2}
Expand All @@ -195,19 +195,21 @@ jobs:
set -euo pipefail
out=$(helm template kc-op operator/target/helm/kubernetes/keycloak-operator-helm --set crds.enabled=false)
# CRDs are excluded; everything else still renders.
if echo "$out" | grep -qE '^kind: "?CustomResourceDefinition"?$'; then
if grep -qE '^kind: "?CustomResourceDefinition"?$' <<<"$out"; then
echo "expected no CRDs with crds.enabled=false"; exit 1
fi
echo "$out" | grep -cE '^kind: Deployment$' | grep -q '^1$'
deployments=$(grep -cE '^kind: Deployment$' <<<"$out" || true)
if [ "$deployments" -ne 1 ]; then echo "expected 1 Deployment, got $deployments"; exit 1; fi

- name: helm template — resource overrides
run: |
set -euo pipefail
out=$(helm template kc-op operator/target/helm/kubernetes/keycloak-operator-helm \
--set-string operator.resources.limits.cpu=1500m \
--set-string operator.resources.limits.memory=1Gi)
echo "$out" | grep -A4 'resources:' | grep -q 'cpu: 1500m'
echo "$out" | grep -A4 'resources:' | grep -q 'memory: 1Gi'
resources=$(grep -A4 'resources:' <<<"$out")
grep -q 'cpu: 1500m' <<<"$resources"
grep -q 'memory: 1Gi' <<<"$resources"

test-helm-install:
name: Helm chart install on Kubernetes
Expand Down
Loading
0