You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jm...@apache.org on 2020/04/27 13:06:28 UTC

[geode] branch develop updated: GEODE-8027: documentation script to attach swagger json (#5001)

This is an automated email from the ASF dual-hosted git repository.

jmelchior pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new be81285  GEODE-8027: documentation script to attach swagger json (#5001)
be81285 is described below

commit be8128512e88563f7a13449025e580c53a8160db
Author: Joris Melchior <jo...@gmail.com>
AuthorDate: Mon Apr 27 09:05:57 2020 -0400

    GEODE-8027: documentation script to attach swagger json (#5001)
    
    - Documentation page will now include the raw swagger json
    - This json file can be used to generate clients for the management API
---
 .../src/test/script/update-management-wiki.sh      | 32 ++++++++++++++++++----
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/geode-management/src/test/script/update-management-wiki.sh b/geode-management/src/test/script/update-management-wiki.sh
index 12ebd51..71b411f 100755
--- a/geode-management/src/test/script/update-management-wiki.sh
+++ b/geode-management/src/test/script/update-management-wiki.sh
@@ -58,10 +58,10 @@ echo "============================================================"
 echo "Building"
 echo "============================================================"
 set -x
-(cd ${0%/*}/../../../.. && ./gradlew build installDist -x test -x javadoc -x rat -x pmdMain -x pmdTest)
+(cd "${0%/*}"/../../../.. && ./gradlew build installDist -x test -x javadoc -x rat -x pmdMain -x pmdTest)
 set +x
 
-GEODE=$(cd ${0%/*}/../../../../geode-assembly/build/install/apache-geode; pwd)
+GEODE=$(cd "${0%/*}"/../../../../geode-assembly/build/install/apache-geode; pwd)
 
 if [ -x "$GEODE/bin/gfsh" ] ; then
     true
@@ -71,7 +71,7 @@ else
 fi
 
 
-GEODE_VERSION=$($GEODE/bin/gfsh version | sed 's/-SNAPSHOT//')
+GEODE_VERSION=$("$GEODE"/bin/gfsh version | sed 's/-SNAPSHOT//')
 [[ "${GEODE_VERSION%.*}" == "1.10" ]] && PAGE_ID=115511910
 [[ "${GEODE_VERSION%.*}" == "1.11" ]] && PAGE_ID=135861023
 [[ "${GEODE_VERSION%.*}" == "1.12" ]] && PAGE_ID=132322415
@@ -105,7 +105,26 @@ echo "Starting up a locator to access swagger"
 echo "============================================================"
 set -x
 ps -ef | grep swagger-locator | grep java | awk '{print $2}' | xargs kill -9
-$GEODE/bin/gfsh "start locator --name=swagger-locator"
+"$GEODE"/bin/gfsh "start locator --name=swagger-locator"
+set +x
+
+echo ""
+echo "============================================================"
+echo "Create static dir"
+echo "============================================================"
+set -x
+if [[ ! -d "static" ]]
+then
+  mkdir "static"
+fi
+set +x
+
+echo ""
+echo "============================================================"
+echo "Download swagger JSON"
+echo "============================================================"
+set -x
+curl http://localhost:7070/management${URI_VERSION}/api-docs | jq > static/swagger.json
 set +x
 
 echo ""
@@ -113,7 +132,7 @@ echo "============================================================"
 echo "Generating docs"
 echo "============================================================"
 set -x
-swagger-codegen generate -i http://localhost:7070/management${URI_VERSION}/api-docs -l html -o static
+swagger-codegen generate -i static/swagger.json -l html -o static
 set +x
 
 echo ""
@@ -247,7 +266,8 @@ cat << EOF > static/body.json
 EOF
 # upload
 set -x
-curl -u $APACHE_CREDS -X PUT -H 'Content-Type: application/json' -d @static/body.json https://cwiki.apache.org/confluence/rest/api/content/${PAGE_ID}
+curl -u "$APACHE_CREDS" -X PUT -H 'Content-Type: application/json' -d @static/body.json https://cwiki.apache.org/confluence/rest/api/content/${PAGE_ID}
+curl -v -S -u "$APACHE_CREDS" -X POST -H "X-Atlassian-Token: no-check" -F "file=@static/swagger.json" -F "comment=raw swagger json" "https://cwiki.apache.org/confluence/rest/api/content/${PAGE_ID}/child/attachment"
 set +x
 
 echo ""