Skip to content

Commit 1b1ac07

Browse files
committed
another small fix
1 parent f2b99af commit 1b1ac07

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

google_function/.terrahub.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ build:
4545
variables:
4646
THUB_FUNCTION_ZIP: demo.zip
4747
THUB_FUNCTION_TXT: demo.txt
48-
COMPONENT_NAME: google_function
49-
OBJECT_NAME: google_storage_object
48+
THUB_COMPONENT: google_function
49+
THUB_OBJECT: google_storage_object
5050
THUB_BUILD_PATH: ..
5151
THUB_BUILD_OK: false
5252
THUB_BUCKET_PATH: 'gs://terrahub_bucket_123456'
@@ -64,7 +64,7 @@ build:
6464
build:
6565
commands:
6666
- 'echo "BUILD: Running build step"'
67-
- ./scripts/build.sh $COMPONENT_NAME $OBJECT_NAME $THUB_BUCKET_KEY/
67+
- ./scripts/build.sh $THUB_COMPONENT $THUB_OBJECT $THUB_BUCKET_KEY/
6868
finally:
6969
- 'echo "BUILD: build step successful"'
7070
post_build:

google_function/scripts/build.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/bin/bash
22

33
## Component name
4-
COMPONENT_NAME=${1}
5-
if [ -z "${COMPONENT_NAME}" ]; then
6-
echo >&2 'ERROR: COMPONENT_NAME variable is empty. Aborting...'
4+
THUB_COMPONENT=${1}
5+
if [ -z "${THUB_COMPONENT}" ]; then
6+
echo >&2 'ERROR: THUB_COMPONENT variable is empty. Aborting...'
77
exit 1
88
fi
99

1010
## Object name
11-
OBJECT_NAME=${2}
12-
if [ -z "${OBJECT_NAME}" ]; then
13-
echo >&2 'ERROR: OBJECT_NAME variable is empty. Aborting...'
11+
THUB_OBJECT=${2}
12+
if [ -z "${THUB_OBJECT}" ]; then
13+
echo >&2 'ERROR: THUB_OBJECT variable is empty. Aborting...'
1414
exit 1
1515
fi
1616

@@ -26,8 +26,9 @@ fi
2626

2727
## Checking if THUB_BUILD_OK is true
2828
if [ "$THUB_BUILD_OK" == "true" ]; then
29-
OBJECT_IN_COMPONENT='component.template.resource.google_storage_bucket_object.'${OBJECT_NAME}'.name'
30-
terrahub configure -i ${COMPONENT_NAME} -c ${OBJECT_IN_COMPONENT}=${THUB_BUCKET_KEY}$(date +%s).zip
29+
THUB_OBJECT_KEY='component.template.resource.google_storage_bucket_object.'${THUB_OBJECT}'.name'
30+
terrahub --version > /dev/null 2>&1 || { echo >&2 'terrahub is missing. Aborting...'; exit 1; }
31+
terrahub configure -i ${THUB_COMPONENT} -c ${THUB_OBJECT_KEY}=${THUB_BUCKET_KEY}$(date +%s).zip
3132
echo 'Build was executed'
3233
else
3334
echo 'Build was NOT executed'

0 commit comments

Comments
 (0)