File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 45
45
variables :
46
46
THUB_FUNCTION_ZIP : demo.zip
47
47
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
50
50
THUB_BUILD_PATH : ..
51
51
THUB_BUILD_OK : false
52
52
THUB_BUCKET_PATH : ' gs://terrahub_bucket_123456'
64
64
build :
65
65
commands :
66
66
- ' 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/
68
68
finally :
69
69
- ' echo "BUILD: build step successful"'
70
70
post_build :
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
# # 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...'
7
7
exit 1
8
8
fi
9
9
10
10
# # 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...'
14
14
exit 1
15
15
fi
16
16
26
26
27
27
# # Checking if THUB_BUILD_OK is true
28
28
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
31
32
echo ' Build was executed'
32
33
else
33
34
echo ' Build was NOT executed'
You can’t perform that action at this time.
0 commit comments