@@ -12,20 +12,49 @@ echo "CURRENT_FOLDER=${CURRENT_FOLDER}"
1212TARGET_FOLDER=" $CURRENT_FOLDER " /target
1313echo TARGET_FOLDER=${TARGET_FOLDER}
1414mkdir -p $TARGET_FOLDER
15-
15+ echo " Created directory at: $TARGET_FOLDER "
1616echo " Building Docker Image"
1717docker build -t taco-builder $CURRENT_FOLDER
1818
1919echo " Assembling Tableau Connector"
2020docker run -d -it --name=taco-builder --mount type=bind,source=$TARGET_FOLDER ,target=/output taco-builder
21- echo " Copying Tableau Connector"
22- docker exec taco-builder sh -c " cp /tableau-sdk/connector-plugin-sdk/connector-packager/packaged-connector/documentdbjdbc.taco /output"
21+ if [ $? -ne 0 ]; then
22+ echo " Failed to run Docker container."
23+ exit 1
24+ fi
25+
26+ # Dynamically find the taco file to copy. Only one .taco file exists.
27+ echo " Copying Tableau Connector to output directory"
28+ docker exec taco-builder sh -c ' cp /tableau-sdk/connector-plugin-sdk/connector-packager/packaged-connector/*.taco /output/'
29+ if [ $? -ne 0 ]; then
30+ echo " Failed to copy .taco file to /output directory."
31+ exit 1
32+ fi
33+
34+ # Verify the Tableau Connector in the output directory
2335echo " Verifying Tableau Connector"
2436docker exec taco-builder sh -c " ls -l /output"
2537docker exec taco-builder pwd
26- echo " Extracting Tableau Connector"
27- docker cp taco-builder:/output/documentdbjdbc.taco $TARGET_FOLDER
38+ echo " Extracting Tableau Connector to $TARGET_FOLDER "
39+ TACO_FILE_NAME=$( docker exec taco-builder sh -c " ls /output/*.taco" )
40+ docker cp " taco-builder:$TACO_FILE_NAME " " $TARGET_FOLDER "
41+ if [ $? -ne 0 ]; then
42+ echo " Failed to copy .taco file from Docker container to target folder."
43+ exit 1
44+ fi
45+ echo " Connector extracted to $TARGET_FOLDER /"
2846echo " Checking Resulting TACO FILE in $TARGET_FOLDER "
2947ls -l $TARGET_FOLDER
48+ if [ $? -ne 0 ]; then
49+ echo " Failed to list contents of $TARGET_FOLDER ."
50+ exit 1
51+ fi
52+ # Stop and remove Docker container
53+ echo " Stopping and removing Docker container"
3054docker stop taco-builder
3155docker rm taco-builder
56+ if [ $? -ne 0 ]; then
57+ echo " Failed to stop or remove Docker container."
58+ exit 1
59+ fi
60+ echo " Build process completed successfully."
0 commit comments