You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e126d16
Browse filesBrowse the repository at this point in the historyBrowse files
Fix for failing export-openapi.sh on K8s 1.19 (agones-dev#2160)
Some new documentation in 1.19 meant that there was some extra work to
be done to escape certain strings properly.
This does that, and also provides the updated output for
`PodTemplateSpec` and `ObjectMeta`.
Work on agones-dev#2129Fixesagones-dev#2159
Co-authored-by: Robert Bailey <robertbailey@google.com>
# This has a \\ in a description field that is being extra tricky to resolve, so let's just escape it here.
69
+
sed -i 's/\\\\/\\\\\\\\/g' io.k8s.api.core.v1.PodSpec.json
64
70
65
71
# easier debugging if something goes wrong, still have the original
66
72
mkdir orig
@@ -74,7 +80,8 @@ for f in *.json; do
74
80
# any "foo\nbar" values need their \n escaped
75
81
# remove top and bottom line to get rid of first { and last } (we know all are formatted because jq)
76
82
# then format for multiline - replace real multilines breaks with \n
77
-
contents=$(cat "$f"| jq 'del(.description)'| sed 's/\\n/\\\\n/g'| sed '$d'| sed '1d'| sed ':a;N;$!ba;s/\n/\\n/g'| sed 's/\$/\\$/g'| sed 's@\"@\\"@g')
83
+
# and escape bash and sed special characters, such as $ and &.
84
+
contents=$(cat "$f"| jq 'del(.description)'| sed 's/\\n/\\\\n/g'| sed '$d'| sed '1d'| sed ':a;N;$!ba;s/\n/\\n/g'| sed 's/\$/\\$/g'| sed 's/\&/\\&/g'| sed 's@\"@\\"@g')
78
85
ref=$(basename "$f" .json)
79
86
80
87
find -maxdepth 1 -name '*.json'| xargs sed -i 's@"$ref": "#/definitions/'"$ref"'"@'"$contents"'@g'
0 commit comments