-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathgenerate.sh
More file actions
executable file
·54 lines (45 loc) · 1.35 KB
/
Copy pathgenerate.sh
File metadata and controls
executable file
·54 lines (45 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
set -eu
echo "DEPRECATED: use ./gen-client.sh instead."
if [ $# -eq 0 ]
then
echo "No arguments provided"
echo "Expected \$1=PROJECT (eg pulpcore, pulp_rpm, pulp_container) \$2=LANGUAGE (eg python, ruby) [\$3=API-VERSION] (v3, v4 (optional))"
exit 1
fi
# match the component name by removing the "pulp/pulp_" prefix
if [ "$1" = "pulpcore" ]
then
COMPONENT="core"
else
COMPONENT=${1#"pulp_"}
fi
# Skip downloading the api.json if `USE_LOCAL_API_JSON` is set.
if [[ -z "${USE_LOCAL_API_JSON:-}" ]]
then
API_VERSION="${3:-v3}"
PULP_URL="${PULP_URL:-http://localhost:24817}"
PULP_API_ROOT="${PULP_API_ROOT:-/pulp/}"
PULP_URL="${PULP_URL}${PULP_API_ROOT}api/${API_VERSION}/"
echo "retrieving api.json for version ${API_VERSION}"
# Download the schema
RETRY_COUNT=0
until curl --fail-with-body -k -o api.json "${PULP_URL}docs/api.json?bindings&component=${COMPONENT}"
do
if [ $RETRY_COUNT -eq 10 ]
then
break
fi
sleep 2
((RETRY_COUNT++))
done
# Get the version of the pulpcore or plugin as reported by status API
fi
echo ::group::BINDINGS
# COMPONENT is 'massaged' project-name, project-name is used as 'package' to gen-client
./gen-client.sh "${USE_LOCAL_API_JSON:-api.json}" "${COMPONENT}" "${2:-python}" "${1}"
echo ::endgroup::
if [[ -z "${USE_LOCAL_API_JSON:-}" ]]
then
rm api.json
fi