Skip to content

Commit 1c6f6f2

Browse files
committed
update unsupported yq to yq-go
1 parent aa6c283 commit 1c6f6f2

File tree

8 files changed

+13
-14
lines changed

8 files changed

+13
-14
lines changed

bin/sync-k8s-secret-to-wire-secrets.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ if command -v yq &> /dev/null; then
122122
echo "✓ Using yq for YAML manipulation"
123123
for yaml_path in "${YAML_PATHS[@]}"; do
124124
echo " Updating: $yaml_path"
125-
yq -y "$yaml_path = \"$SECRET_VALUE\"" "$YAML_FILE" > "$YAML_FILE.tmp" && mv "$YAML_FILE.tmp" "$YAML_FILE"
125+
yq eval "$yaml_path = \"$SECRET_VALUE\"" "$YAML_FILE" > "$YAML_FILE.tmp" && mv "$YAML_FILE.tmp" "$YAML_FILE"
126126
done
127127
else
128128
echo "❌ ERROR: yq is required for this script"
129-
echo " Install yq: https://github.com/kislyuk/yq"
129+
echo " Install yq-go: https://github.com/mikefarah/yq"
130130
rm "$YAML_FILE.bak"
131131
exit 1
132132
fi
@@ -138,7 +138,7 @@ SUCCESS=true
138138
for yaml_path in "${YAML_PATHS[@]}"; do
139139
# Use yq to extract the actual value at the specific path
140140
if command -v yq &> /dev/null; then
141-
EXTRACTED_VALUE=$(yq -r "$yaml_path" "$YAML_FILE" 2>/dev/null || echo "")
141+
EXTRACTED_VALUE=$(yq eval "$yaml_path" "$YAML_FILE" 2>/dev/null || echo "")
142142
if [ "$EXTRACTED_VALUE" = "$SECRET_VALUE" ]; then
143143
echo "$yaml_path: synced"
144144
else

bin/wiab-demo/offline_deploy_k8s.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ process_values() {
6565
"$BASE_DIR/values/wire-server/values.yaml" > "$TEMP_DIR/wire-server-values.yaml"
6666

6767
# fixing the turnStatic values
68-
yq -i -Y ".brig.turnStatic.v2 = [\"turn:$HOST_IP:3478\", \"turn:$HOST_IP:3478?transport=tcp\"]" "$TEMP_DIR/wire-server-values.yaml"
68+
yq eval -i ".brig.turnStatic.v2 = [\"turn:$HOST_IP:3478\", \"turn:$HOST_IP:3478?transport=tcp\"]" "$TEMP_DIR/wire-server-values.yaml"
6969

7070
# Fixing the hosts in webapp team-settings and account-pages charts
7171
for chart in webapp team-settings account-pages; do
@@ -92,7 +92,7 @@ process_values() {
9292
"$BASE_DIR/values/sftd/values.yaml" > "$TEMP_DIR/sftd-values.yaml"
9393

9494
# Creating coturn values and secrets
95-
ZREST_SECRET=$(yq '.brig.secrets.turn.secret' "$BASE_DIR/values/wire-server/secrets.yaml" | tr -d '"')
95+
ZREST_SECRET=$(yq eval '.brig.secrets.turn.secret' "$BASE_DIR/values/wire-server/secrets.yaml" | tr -d '"')
9696
cat >"$TEMP_DIR/coturn-secrets.yaml"<<EOF
9797
secrets:
9898
zrestSecrets:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed: Chart patching script broken pipe error caused by set -euo pipefail interaction with non-zero return codes
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Changed: Standardized all scripts to use yq-go (v4+) for YAML processing, replacing deprecated python-yq. Updated syntax in offline deployment scripts (cd.sh, cd-with-retry.sh), build scripts (build_adminhost_containers.sh), demo deployment (offline_deploy_k8s.sh), secret sync utilities, and chart image extraction. This fixes CI build errors with helm template YAML parsing and ensures consistent, reliable YAML manipulation across the codebase.

offline/cd-with-retry.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ eval "$(ssh-agent)"
136136
ssh-add - <<< "$ssh_private_key"
137137

138138
terraform output -json static-inventory > inventory.json
139-
yq -y '.' inventory.json > inventory.yml
139+
yq eval -o=yaml '.' inventory.json > inventory.yml
140140

141141
ssh -oStrictHostKeyChecking=accept-new -oConnectionAttempts=10 "root@$adminhost" tar xzv < "$ARTIFACTS_DIR/assets.tgz"
142142

offline/cd.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ eval `ssh-agent`
2424
ssh-add - <<< "$ssh_private_key"
2525

2626
terraform output -json static-inventory > inventory.json
27-
yq -y '.' inventory.json > inventory.yml
27+
yq eval -o=yaml '.' inventory.json > inventory.yml
2828

2929
ssh -oStrictHostKeyChecking=accept-new -oConnectionAttempts=10 "root@$adminhost" tar xzv < "$ARTIFACTS_DIR/assets.tgz"
3030

offline/tasks/build_adminhost_containers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ INDEX_FILE="${OUTPUT_DIR}/containers-adminhost/index.txt"
4040

4141
if [ "$ZAUTH" = true ]; then
4242
echo "Building zauth container image in ${OUTPUT_DIR} ..."
43-
wire_version=$(helm show chart "${OUTPUT_DIR}"/charts/wire-server | yq -r .version)
43+
wire_version=$(helm show chart "${OUTPUT_DIR}"/charts/wire-server | yq eval '.version' -)
4444
echo "quay.io/wire/zauth:$wire_version" | create-container-dump "${OUTPUT_DIR}"/containers-adminhost
4545
mv "${OUTPUT_DIR}/containers-adminhost/images.json" "${OUTPUT_DIR}"/versions/containers_adminhost_images.json
4646
fi

offline/tasks/patch-chart-images.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ echo "Scanning and patching files..."
113113
# Process values.yaml files
114114
while IFS= read -r -d '' file; do
115115
file_count=$((file_count + 1))
116-
patch_file "$file"
117-
rc=$?
116+
patch_file "$file" && rc=$? || rc=$?
118117
if [[ $rc -eq 0 ]]; then
119118
patched_count=$((patched_count + 1))
120119
elif [[ $rc -eq 2 ]]; then
@@ -125,8 +124,7 @@ done < <(find "$CHARTS_DIR" -name "values.yaml" -print0)
125124
# Process Chart.yaml files
126125
while IFS= read -r -d '' file; do
127126
file_count=$((file_count + 1))
128-
patch_file "$file"
129-
rc=$?
127+
patch_file "$file" && rc=$? || rc=$?
130128
if [[ $rc -eq 0 ]]; then
131129
patched_count=$((patched_count + 1))
132130
elif [[ $rc -eq 2 ]]; then
@@ -137,8 +135,7 @@ done < <(find "$CHARTS_DIR" -name "Chart.yaml" -print0)
137135
# Process template files (for direct image references)
138136
while IFS= read -r -d '' file; do
139137
file_count=$((file_count + 1))
140-
patch_file "$file"
141-
rc=$?
138+
patch_file "$file" && rc=$? || rc=$?
142139
if [[ $rc -eq 0 ]]; then
143140
patched_count=$((patched_count + 1))
144141
elif [[ $rc -eq 2 ]]; then

0 commit comments

Comments
 (0)