Skip to content

Commit

Permalink
[chore] add logs for uploading designs
Browse files Browse the repository at this point in the history
Signed-off-by: Aabid Sofi <[email protected]>
  • Loading branch information
aabidsofi19 committed Jan 4, 2025
1 parent 8981064 commit d80c0c5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions uploadApplicationFile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@
# UPLOAD_TYPE: can be "Kubernetes Manifest" | "Helm Chart" | "Docker Compose" | "Meshery Design"
# PROVIDER_TOKEN: MESHERY provider token

# # get Meshery pattern file as escaped yaml str
# Get Meshery pattern file as escaped YAML string
MESHERY_PATTERN_FILE=$(pattern_file=$(cat __intermediate_file.yml) node ./action/normalize-configuration-file/index.js)

# # convert to uri-encoded str
# Convert to URI-encoded string
UPLOAD_TYPE=$(printf %s "$UPLOAD_TYPE" | jq -sRr @uri)

# Step 1: Perform the curl request and save the response to a file
RESPONSE_FILE="upload_design_response.log"
curl "$MESHERY_SERVER_BASE_URL/api/pattern/$UPLOAD_TYPE" \
-H 'Accept: */*' \
-H 'Connection: close' \
-H 'Content-Type: text/plain;charset=UTF-8' \
-H "Cookie: meshery-provider=Meshery; token=$MESHERY_TOKEN;" \
--data-raw "{\"save\":true, \"pattern_data\": {\"pattern_file\":$MESHERY_PATTERN_FILE}}" \
--compressed | jq ".[0].id"
--compressed > "$RESPONSE_FILE"

# Step 2: Log the response to the console
echo "Raw response logged to $RESPONSE_FILE:"
cat "$RESPONSE_FILE"

# Step 3: Pass the response content to jq
echo "Processing response with jq..."
jq ".[0].id" < "$RESPONSE_FILE"

0 comments on commit d80c0c5

Please sign in to comment.