-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.sh
executable file
·31 lines (26 loc) · 1.11 KB
/
test.sh
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
#!/bin/bash
set -ex
declare ID_RSA_CONTENTS_BASE64
declare AWS_CREDENTIALS_CONTENTS_BASE64
# Change the location of these files based on where they are on your system
ID_RSA_CONTENTS_BASE64=$(base64 ~/.ssh/id_rsa | tr -d '\n') ;
AWS_CREDENTIALS_CONTENTS_BASE64=$(base64 ~/.aws/credentials | tr -d '\n') ;
[[ -n $ID_RSA_CONTENTS_BASE64 ]]
[[ -n $AWS_CREDENTIALS_CONTENTS_BASE64 ]]
read -r -d '\' JSON_BODY <<- EOM
{
"ID_RSA": "$ID_RSA_CONTENTS_BASE64",
"AWS_CREDENTIALS": "$AWS_CREDENTIALS_CONTENTS_BASE64"
}\\
EOM
# The local fs is mounted into the container and as such any files it writes will have their permissions changed.
# This will change the permissions back and clean up other files we don't want hanging around.
sudo chown -R "$(whoami)":"$(whoami)" .
find . -name '*terraform.tfstate*' -exec rm {} \;
find . -name '.terraform' -type d -prune -exec rm -rf {} \;
LOCAL_IMAGE_TAG="metadiff-ui-build-test-$(uuidgen | cut -c -8)"
docker build infra/build -t $LOCAL_IMAGE_TAG && \
docker run -it \
--runtime=sysbox-runc \
--volume "$PWD:/home/build-user/build/metadiff-ui" \
$LOCAL_IMAGE_TAG "$JSON_BODY"