-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy
executable file
·50 lines (37 loc) · 1.42 KB
/
deploy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
# this will only work if you are me, and have your aws login set up etc.
set -e
set -x
me=$0
VERSION_NUMBER=19
export IMAGE_NAME=jessitron/hny-tricks
export IMAGE_TAG=hny-tricks-$VERSION_NUMBER
export IMAGE_REPO=414852377253.dkr.ecr.us-east-1.amazonaws.com
# just log in to ECR every time
aws ecr get-login-password --region $(aws configure get region) | docker login --username AWS --password-stdin $IMAGE_REPO
# because separately pushing ignores the other platform GOD I HATE HASHICORP SOMETIMES
docker build --platform linux/amd64 -t $IMAGE_REPO/$IMAGE_NAME:$IMAGE_TAG .
docker push $IMAGE_REPO/$IMAGE_NAME:$IMAGE_TAG
if [ "$?" -ne 0 ]; then
echo "Push failed. You probably need to 'awslogin'"
fi
cat deployment/k8s.yaml \
| sed 's/IMAGE_TAG/'$IMAGE_TAG'/g' \
| kubectl apply -f -
HONEYCOMB_API_KEY=$HONEYCOMB_API_KEY_PROD_MARKERS VERSION_NUMBER=$VERSION_NUMBER ./deployment/create-marker.sh $deploy_ONLY
## Now change this script to increment the version number, so next time it will be different.
function sed_in_place {
expr=$1
file=$2
backup=$file.bak
sed "$expr" $file > $file.bak
if [ $? -eq 0 ]; then
chmod `stat -f %A $file` $file.bak # this works on mac
mv $file.bak $file
else
echo "replacement didn't work on $file"
break
fi
}
echo "Deployed from $me with VERSION_NUMBER $VERSION_NUMBER"
sed_in_place "s/VERSION_NUMBER=$VERSION_NUMBER/VERSION_NUMBER=$(( VERSION_NUMBER + 1 ))/" $me