whatever
This commit is contained in:
parent
3223d51bdc
commit
298215f832
5 changed files with 1 additions and 318 deletions
|
|
@ -1,99 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
. /nail/workflow/pushlib.sh
|
|
||||||
|
|
||||||
main() {
|
|
||||||
PUSHBRANCH=$1
|
|
||||||
|
|
||||||
if [ -z "$STAGE" ]; then
|
|
||||||
echo "You must specify the \$STAGE variable."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
git fetch
|
|
||||||
git checkout "$PUSHBRANCH"
|
|
||||||
git reset --hard "origin/$PUSHBRANCH"
|
|
||||||
|
|
||||||
separator
|
|
||||||
MASTER_SHA=`git rev-parse --short origin/master`
|
|
||||||
git log --graph --oneline --color origin/master^..HEAD | sed "/$MASTER_SHA/q"
|
|
||||||
separator
|
|
||||||
|
|
||||||
echo -e "${AQUA}*** push this deploy branch into master? ***${NORMAL}"
|
|
||||||
if yesno; then
|
|
||||||
push-to-master $PUSHBRANCH
|
|
||||||
DEPLOY_TAG=""
|
|
||||||
get-deploy-tag $DEPLOY_TAG
|
|
||||||
echo "Using $DEPLOY_TAG as the deploy tag"
|
|
||||||
|
|
||||||
deploy-to-testopia $DEPLOY_TAG
|
|
||||||
deploy-to-devc $DEPLOY_TAG
|
|
||||||
deploy-to-devb $DEPLOY_TAG
|
|
||||||
|
|
||||||
cleanup-deploy-branch $PUSHBRANCH
|
|
||||||
|
|
||||||
reminder
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
yesno() {
|
|
||||||
local answer
|
|
||||||
read -p 'y/n? ' answer
|
|
||||||
if [[ "$answer" == "y" ]]; then
|
|
||||||
return 0
|
|
||||||
elif [[ "$answer" == "n" ]]; then
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
yesno
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
push-to-master() {
|
|
||||||
PUSHBRANCH=$1
|
|
||||||
colorize git checkout master
|
|
||||||
git pull origin master
|
|
||||||
colorize git merge --no-ff "$PUSHBRANCH"
|
|
||||||
git push origin master
|
|
||||||
}
|
|
||||||
|
|
||||||
get-deploy-tag() {
|
|
||||||
DEPLOY_TAG=$1
|
|
||||||
DEPLOY_TAG=`deploy-srv-testopia -l --source="$STAGE" checkout_fulfillment | tail -1`
|
|
||||||
echo -e "${AQUA}*** Confirm this is the correct deploy-tag ***${NORMAL}"
|
|
||||||
echo -e "${RED}$DEPLOY_TAG${NORMAL}"
|
|
||||||
|
|
||||||
if yesno; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
deploy-to-testopia() {
|
|
||||||
DEPLOY_TAG=$1
|
|
||||||
colorize deploy-srv-testopia --no-prompt --source=$STAGE checkout_fulfillment $DEPLOY_TAG
|
|
||||||
}
|
|
||||||
|
|
||||||
deploy-to-devc() {
|
|
||||||
DEPLOY_TAG=$1
|
|
||||||
colorize deploy-srv-devc --no-prompt --source=$STAGE checkout_fulfillment $DEPLOY_TAG
|
|
||||||
}
|
|
||||||
|
|
||||||
deploy-to-devb() {
|
|
||||||
DEPLOY_TAG=$1
|
|
||||||
colorize deploy-srv-devb --no-prompt --source=$STAGE checkout_fulfillment $DEPLOY_TAG
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup-deploy-branch() {
|
|
||||||
PUSHBRANCH=$1
|
|
||||||
# colorize git push origin :"$PUSHBRANCH"
|
|
||||||
colorize git branch -D $PUSHBRANCH
|
|
||||||
}
|
|
||||||
|
|
||||||
reminder() {
|
|
||||||
figlet "Don't forget..."
|
|
||||||
echo "run the pushplans on the stage you didn't use!"
|
|
||||||
}
|
|
||||||
|
|
||||||
main $@
|
|
||||||
|
|
@ -1,122 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
import optparse
|
|
||||||
|
|
||||||
|
|
||||||
CREDENTIALS = {
|
|
||||||
1: {'user': "yelp_test_user",
|
|
||||||
'password': "P5WSAhRHLnZ6IEHMDk9O/Q"},
|
|
||||||
2: {'user': "yelpv2",
|
|
||||||
'password': "password"},
|
|
||||||
}
|
|
||||||
|
|
||||||
HOSTS = {
|
|
||||||
'devc': "srv2-devc",
|
|
||||||
'devb': "srv2-devb",
|
|
||||||
'stagea': "stageaservices3",
|
|
||||||
'stageb': "stagebservices2",
|
|
||||||
}
|
|
||||||
|
|
||||||
CURL = {
|
|
||||||
2: "curl -X {method}{headers}{data} -u {user}:{password} http://{host}:13742/checkout/v2/orders/{order_id}/{action}\n",
|
|
||||||
1: "curl -X {method}{headers}{data} -u {user}:{password} http://{host}:13742/v1/checkout/order/{order_id}/{action}\n"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def show_curl_strings(options, args):
|
|
||||||
if options.update:
|
|
||||||
if len(args) == 2:
|
|
||||||
partner_business_id = None
|
|
||||||
stage, order_id = args
|
|
||||||
|
|
||||||
else:
|
|
||||||
stage, order_id, partner_business_id = args
|
|
||||||
else:
|
|
||||||
stage, order_id = args
|
|
||||||
partner_business_id = None
|
|
||||||
|
|
||||||
UPDATE_DATA_STRING = " -d \"{0}\"".format({
|
|
||||||
'notification_url': 'null',
|
|
||||||
'order': {
|
|
||||||
'delivery_address': {
|
|
||||||
'city': 'SF', 'state': 'CA', 'address1': '1234 test', 'zipcode': '12345', 'country': 'US'},
|
|
||||||
'delivery_type': 'DELIVERY_TYPE_DELIVERY',
|
|
||||||
'partner_business_id': partner_business_id,
|
|
||||||
'partner_order_id': 'partner_order_id',
|
|
||||||
'yelp_order_id': order_id,
|
|
||||||
'order_lines': [{'description': 'order line description',
|
|
||||||
'price': {'amount':
|
|
||||||
'1.70',
|
|
||||||
'currency_code':
|
|
||||||
'USD'},
|
|
||||||
'name': 'order line name',
|
|
||||||
'quantity': 5,
|
|
||||||
'type': 'ORDER_LINE_TYPE_ITEM',
|
|
||||||
'partner_item_id': 'partner_item_id'},
|
|
||||||
{'description': 'tax',
|
|
||||||
'price': {'amount':
|
|
||||||
'0.07',
|
|
||||||
'currency_code':
|
|
||||||
'USD'},
|
|
||||||
'name': 'tax',
|
|
||||||
'quantity': 1,
|
|
||||||
'type': 'ORDER_LINE_TYPE_TAX',
|
|
||||||
'partner_item_id': 'null'}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}).replace("'null'", "null")
|
|
||||||
|
|
||||||
if options.capture:
|
|
||||||
print "charge\n\t", CURL[options.api].format(
|
|
||||||
method="POST",
|
|
||||||
headers=" -H ".join(["", "'Accept: application/json'"]),
|
|
||||||
data="",
|
|
||||||
user=CREDENTIALS[options.api]['user'],
|
|
||||||
password=CREDENTIALS[options.api]['password'],
|
|
||||||
host=HOSTS[stage],
|
|
||||||
order_id=order_id,
|
|
||||||
action="charge",
|
|
||||||
)
|
|
||||||
|
|
||||||
elif options.complete:
|
|
||||||
print "complete:\n\t", CURL[options.api].format(
|
|
||||||
method="POST",
|
|
||||||
headers=" -H ".join(["", "'Accept: application/json'"]),
|
|
||||||
data="",
|
|
||||||
user=CREDENTIALS[options.api]['user'],
|
|
||||||
password=CREDENTIALS[options.api]['password'],
|
|
||||||
host=HOSTS[stage],
|
|
||||||
order_id=order_id,
|
|
||||||
action="complete",
|
|
||||||
)
|
|
||||||
|
|
||||||
if options.update:
|
|
||||||
print "update:\n\t", CURL[options.api].format(
|
|
||||||
method="POST",
|
|
||||||
headers=" -H ".join(["", "'Accept: application/json'"]),
|
|
||||||
data=" -d ".join(["", '"' + str(options.data) + '"']) if options.data else UPDATE_DATA_STRING,
|
|
||||||
user=CREDENTIALS[options.api]['user'],
|
|
||||||
password=CREDENTIALS[options.api]['password'],
|
|
||||||
host=HOSTS[stage],
|
|
||||||
order_id=order_id,
|
|
||||||
action="update" if options.api == 1 else "updates",
|
|
||||||
)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
parser = optparse.OptionParser()
|
|
||||||
parser.add_option('--capture', dest='capture', action='store_true', default=False)
|
|
||||||
parser.add_option('--complete', dest='complete', action='store_true', default=False)
|
|
||||||
parser.add_option('--update', dest='update', action='store_true', default=False)
|
|
||||||
|
|
||||||
parser.add_option('--api', dest='api', action='store', default=2, type="int")
|
|
||||||
|
|
||||||
parser.add_option('--data', dest='data', action='store', default=None)
|
|
||||||
|
|
||||||
options, args = parser.parse_args()
|
|
||||||
if options.capture and options.api == 2:
|
|
||||||
print "WARNING: forcing API to 1 because --capture was specified\n"
|
|
||||||
options.api = 1
|
|
||||||
|
|
||||||
if options.capture and options.complete:
|
|
||||||
raise ValueError("cannot have both capture and complete")
|
|
||||||
|
|
||||||
show_curl_strings(options, args)
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
. /nail/workflow/pushlib.sh
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
echo "$0 <branch1> <branch2> ..."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
BRANCH_NAMES=${@:1}
|
|
||||||
BRANCH_BASE="origin/master"
|
|
||||||
TARGET="$(git-branch-name)"
|
|
||||||
|
|
||||||
colorize git fetch origin
|
|
||||||
colorize git reset --hard $BRANCH_BASE
|
|
||||||
merge-branches $TARGET $BRANCH_NAMES
|
|
||||||
separator
|
|
||||||
list-pushplans $TARGET $BRANCH_BASE
|
|
||||||
}
|
|
||||||
|
|
||||||
merge-branches() {
|
|
||||||
DEPLOY=$1
|
|
||||||
BRANCH_NAMES=${@:2}
|
|
||||||
|
|
||||||
for BRANCH_NAME in $BRANCH_NAMES
|
|
||||||
do
|
|
||||||
separator
|
|
||||||
if ! colorize git merge --no-ff --no-commit "origin/$BRANCH_NAME"; then
|
|
||||||
echo -e "${RED}Unable to merge $BRANCH_NAME.${NORMAL}"
|
|
||||||
git diff
|
|
||||||
reset_branch_and_abort $DEPLOY
|
|
||||||
fi
|
|
||||||
git merge --abort
|
|
||||||
|
|
||||||
colorize git merge --no-ff "origin/$BRANCH_NAME"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
list-pushplans() {
|
|
||||||
TARGET=$1
|
|
||||||
BASE=$2
|
|
||||||
|
|
||||||
echo -e "${PURPLE}Pushplans present in this deploy:${NORMAL}"
|
|
||||||
git diff --name-only "$(git merge-base "$TARGET" "$BASE")..$TARGET" -- pushplans
|
|
||||||
}
|
|
||||||
|
|
||||||
reset-branch-and-abort() {
|
|
||||||
RESET_TARGET=$1
|
|
||||||
RESET_SHA="$(git rev-parse "$RESET_TARGET")"
|
|
||||||
|
|
||||||
separator
|
|
||||||
git reset --hard "$RESET_SHA"
|
|
||||||
make clean
|
|
||||||
separator
|
|
||||||
echo -e "Aborted."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
main $@
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
echo "$0 <deploy-branch-name>"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
if [ -z "$TESTING" ]; then
|
|
||||||
CHANNEL="platform"
|
|
||||||
else
|
|
||||||
CHANNEL="haaktest"
|
|
||||||
fi
|
|
||||||
|
|
||||||
USERNAME=$USER
|
|
||||||
DEPLOY_BRANCH="$1"
|
|
||||||
|
|
||||||
if [ -z $DEPLOY_BRANCH ]; then
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
nodebot $CHANNEL "push starting; ping $USERNAME with branch name if you want in."
|
|
||||||
setup_deploy_branch "$DEPLOY_BRANCH"
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_deploy_branch() {
|
|
||||||
DEPLOY_BRANCH_NAME=$1
|
|
||||||
|
|
||||||
git fetch origin
|
|
||||||
git checkout -b $DEPLOY_BRANCH_NAME origin/master
|
|
||||||
}
|
|
||||||
|
|
||||||
main $@
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9c755511f0c8e96eb893226ee43947bb3eef6666
|
Subproject commit ab18795f3cd9bd45aec60a4a4bd8ecf820eb86c4
|
||||||
Loading…
Add table
Add a link
Reference in a new issue