diff --git a/references/cloud-logging-shared-flow/pipeline.sh b/references/cloud-logging-shared-flow/pipeline.sh index 5c0a96513..5d7a5607e 100755 --- a/references/cloud-logging-shared-flow/pipeline.sh +++ b/references/cloud-logging-shared-flow/pipeline.sh @@ -31,8 +31,6 @@ if [ "$EXISTING_EMAIL" != "$SA_EMAIL" ]; then --role="roles/logging.logWriter" fi - - sackmesser deploy --googleapi -d "$SCRIPTPATH" -t "$APIGEE_TOKEN" --deployment-sa "$SA_EMAIL" sackmesser deploy --googleapi -d "$SCRIPTPATH/test/logging-example" -t "$APIGEE_TOKEN" diff --git a/tools/apigee-sackmesser/cmd/deploy/deploy.sh b/tools/apigee-sackmesser/cmd/deploy/deploy.sh index e58089e4b..bb6d3ba3e 100755 --- a/tools/apigee-sackmesser/cmd/deploy/deploy.sh +++ b/tools/apigee-sackmesser/cmd/deploy/deploy.sh @@ -122,7 +122,7 @@ skip_deployment=true #skip maven deploy unless bundle contains proxy or shared f if [ -d "$temp_folder/apiproxy" ]; then loginfo "Configuring API Proxy" - if [ ! -f "$temp_folder/apiproxy/*.xml" ]; then + if [ -z "$(find "$temp_folder/apiproxy" -type f -name "*.xml" -maxdepth 1 -mindepth 1)" ]; then if [ -z "$bundle_name" ]; then bundle_name=$(basename "$source_dir") fi @@ -155,7 +155,7 @@ elif [ -d "$temp_folder/sharedflowbundle" ]; then skip_deployment=false - if [ ! -f "$temp_folder/sharedflowbundle/*.xml" ]; then + if [ -z "$(find "$temp_folder/sharedflowbundle" -type f -name "*.xml" -maxdepth 1 -mindepth 1)" ]; then if [ -z "$bundle_name" ]; then bundle_name=$(basename "$source_dir") fi diff --git a/tools/apigee-sackmesser/cmd/export/export.sh b/tools/apigee-sackmesser/cmd/export/export.sh index 28ff20efd..e73ad65ea 100755 --- a/tools/apigee-sackmesser/cmd/export/export.sh +++ b/tools/apigee-sackmesser/cmd/export/export.sh @@ -41,7 +41,7 @@ fi loginfo "exporting to $export_folder" mkdir -p "$export_folder" -sackmesser list "organizations/$organization/sharedflows" | jq -r -c '.[]|.'| while read -r sharedflow; do +sackmesser list "organizations/$organization/sharedflows" | jq -r -c '.[]|. | select((. | length) > 1)' | while read -r sharedflow; do loginfo "download shared flow: $sharedflow" mkdir -p "$export_folder/sharedflows/$sharedflow" latest="$(sackmesser list "organizations/$organization/sharedflows/$sharedflow" | jq '.revision | map(tonumber) | max')" diff --git a/tools/apigee-sackmesser/cmd/report/report.sh b/tools/apigee-sackmesser/cmd/report/report.sh index 70c74ae68..5892b9dca 100755 --- a/tools/apigee-sackmesser/cmd/report/report.sh +++ b/tools/apigee-sackmesser/cmd/report/report.sh @@ -93,7 +93,7 @@ performancequery="organizations/$organization/environments/$environment/stats/ap performancequery+="?limit=14400&offset=0" performancequery+="&select=sum(message_count)/3600.0,sum(is_error),avg(target_response_time),avg(total_response_time)" performancequery+="&timeUnit=day" -PERFORMANCE_Q_START=$(date -u -v1d '+%m/%d/%Y%%2000:00:00' 2&>/dev/null || date -u -d "1 day ago" '+%m/%d/%Y%%2000:00:00' || date -u -d "@$(( $(date +%s ) - 86400 ))" '+%m/%d/%Y%%2000:00:00') +PERFORMANCE_Q_START=$(date -u -v1d '+%m/%d/%Y%%2000:00:00' 2&>/dev/null || date -u -d "1 day ago" '+%m/%d/%Y%%2000:00:00' || date -u -d "@$(( $(date +%s ) - 86400 ))" '+%m/%d/%Y%%2000:00:00' || echo '') performancequery+="&timeRange=$PERFORMANCE_Q_START~$(date -u '+%m/%d/%Y%%2000:00:00')" sackmesser list "$performancequery" > "$export_folder/performance-$environment.json" @@ -182,7 +182,6 @@ do echo "$linkrevision" > "$export_folder/scratch/proxyrevisions/$proxyname" - if [ -d "$proxyexportpath/apiproxy/policies" ];then policycount=$(find "$proxyexportpath"/apiproxy/policies/*.xml | wc -l) else @@ -224,7 +223,11 @@ echo "" >> "$report_html" while IFS= read -r -d '' policyusage do proxyname=$(basename "${policyusage%%-indexed.*}") - linkrevision=$(cat "$export_folder/scratch/proxyrevisions/$proxyname") + if [ -f "$export_folder/scratch/proxyrevisions/$proxyname" ]; then + linkrevision=$(cat "$export_folder/scratch/proxyrevisions/$proxyname") + else + linkrevision="unknown" + fi echo "" >> "$report_html" echo "$proxyname" >> "$report_html"