Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
Update upgrade.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
80017 authored Jun 25, 2018
1 parent e2b6ded commit 2833a8b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ then
RANCHER_ACCESSKEY="$RANCHER_ACCESSKEY_MASTER";
RANCHER_SECRETKEY="$RANCHER_SECRETKEY_MASTER";
RANCHER_URL="$RANCHER_URL_MASTER";
SERVICE_NAME="$SERVICE_NAME_MASTER";
STACK_SERVICE_NAME_FOR_FRONT="$STACK_SERVICE_NAME_FOR_FRONT_MASTER";
}
elif [ "$TRAVIS_BRANCH" = "develop" ]
then
Expand All @@ -32,6 +34,8 @@ then
RANCHER_ACCESSKEY="$RANCHER_ACCESSKEY_DEVELOP";
RANCHER_SECRETKEY="$RANCHER_SECRETKEY_DEVELOP";
RANCHER_URL="$RANCHER_URL_DEVELOP";
SERVICE_NAME="$SERVICE_NAME_DEVELOP";
STACK_SERVICE_NAME_FOR_FRONT="$STACK_SERVICE_NAME_FOR_FRONT_DEVELOP";
}
elif [ "$TRAVIS_BRANCH" = "staging" ]
then
Expand All @@ -45,28 +49,32 @@ then
RANCHER_ACCESSKEY="$RANCHER_ACCESSKEY_STAGING";
RANCHER_SECRETKEY="$RANCHER_SECRETKEY_STAGING";
RANCHER_URL="$RANCHER_URL_STAGING";
SERVICE_NAME="$SERVICE_NAME_STAGING";
STACK_SERVICE_NAME_FOR_FRONT="$STACK_SERVICE_NAME_FOR_FRONT_STAGING";
}
else
{
echo "call $TRAVIS_BRANCH branch"
ENV_ID=`curl -u ""$RANCHER_ACCESSKEY_QA":"$RANCHER_SECRETKEY_QA"" -X GET -H 'Accept: application/json' -H 'Content-Type: application/json' "$RANCHER_URL_QA/v2-beta/projects?name=QA" | jq '.data[].id' | tr -d '"'`
ENV_ID=`curl -u ""$RANCHER_ACCESSKEY_QA":"$RANCHER_SECRETKEY_QA"" -X GET -H 'Accept: application/json' -H 'Content-Type: application/json' "$RANCHER_URL_QA/v2-beta/projects?name=Develop" | jq '.data[].id' | tr -d '"'`
echo $ENV_ID
USERNAME="$DOCKER_USERNAME";
TAG="qa";
FRONT_HOST="$FRONT_HOST_QA";
RANCHER_ACCESSKEY="$RANCHER_ACCESSKEY_QA";
RANCHER_SECRETKEY="$RANCHER_SECRETKEY_QA";
RANCHER_URL="$RANCHER_URL_QA";
SERVICE_NAME="$SERVICE_NAME_QA";
STACK_SERVICE_NAME_FOR_FRONT="$STACK_SERVICE_NAME_FOR_FRONT_QA";
}
fi

SERVICE_ID=`curl -u ""$RANCHER_ACCESSKEY":"$RANCHER_SECRETKEY"" -X GET -H 'Accept: application/json' -H 'Content-Type: application/json' "$RANCHER_URL/v2-beta/projects/$ENV_ID/services?name=flowz-dashboard" | jq '.data[].id' | tr -d '"'`
SERVICE_ID=`curl -u ""$RANCHER_ACCESSKEY":"$RANCHER_SECRETKEY"" -X GET -H 'Accept: application/json' -H 'Content-Type: application/json' "$RANCHER_URL/v2-beta/projects/$ENV_ID/services?name=$SERVICE_NAME" | jq '.data[].id' | tr -d '"'`
echo $SERVICE_ID

curl -u ""$RANCHER_ACCESSKEY":"$RANCHER_SECRETKEY"" \
-X POST \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"inServiceStrategy":{"launchConfig": {"imageUuid":"docker:'$USERNAME'/flowz_dashboard_fronted_flowz:'$TAG'","kind": "container","labels":{"io.rancher.container.pull_image": "always","io.rancher.scheduler.affinity:host_label": "'"$FRONT_HOST"'","io.rancher.scheduler.affinity:container_label_soft_ne": "io.rancher.stack_service.name=front-flowz/flowz-dashboard"},"healthCheck": {"type": "instanceHealthCheck","healthyThreshold": 2,"initializingTimeout": 60000,"interval": 2000,"name": null,"port": 80,"recreateOnQuorumStrategyConfig": {"type": "recreateOnQuorumStrategyConfig","quorum": 1},"reinitializingTimeout": 60000,"requestLine": "GET \"http://localhost\" \"HTTP/1.0\"","responseTimeout": 60000,"strategy": "recreateOnQuorum","unhealthyThreshold": 3},"networkMode": "managed"}},"toServiceStrategy":null}' \
"inServiceStrategy":{"launchConfig": {"imageUuid":"docker:'$USERNAME'/flowz_dashboard_fronted_flowz:'$TAG'","kind": "container","labels":{"io.rancher.container.pull_image": "always","io.rancher.scheduler.affinity:host_label": "'"$FRONT_HOST"'","io.rancher.scheduler.affinity:container_label_soft_ne": "'"$STACK_SERVICE_NAME_FOR_FRONT"'"},"healthCheck": {"type": "instanceHealthCheck","healthyThreshold": 2,"initializingTimeout": 60000,"interval": 2000,"name": null,"port": 80,"recreateOnQuorumStrategyConfig": {"type": "recreateOnQuorumStrategyConfig","quorum": 1},"reinitializingTimeout": 60000,"requestLine": "GET \"http://localhost\" \"HTTP/1.0\"","responseTimeout": 60000,"strategy": "recreateOnQuorum","unhealthyThreshold": 3},"networkMode": "managed"}},"toServiceStrategy":null}' \
$RANCHER_URL/v2-beta/projects/$ENV_ID/services/$SERVICE_ID?action=upgrade

0 comments on commit 2833a8b

Please sign in to comment.