Skip to content

Commit 6d848e5

Browse files
author
tvsathvi
committed
Modify script to dynamic .taco filname handling in build script
1 parent 3e51864 commit 6d848e5

File tree

3 files changed

+39
-8
lines changed

3 files changed

+39
-8
lines changed

.github/workflows/gradle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ jobs:
196196
MINOR_VERSION=$(grep "MINOR_VERSION" ${file} | cut -d'=' -f2)
197197
PATCH_VERSION=$(grep "PATCH_VERSION" ${file} | cut -d'=' -f2)
198198
echo "version=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION" >> $GITHUB_ENV
199-
mv tableau-connector/target/documentdbjdbc.taco tableau-connector/target/documentdbjdbc-$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION.taco
199+
mv tableau-connector/target/*.taco tableau-connector/target/documentdbjdbc-$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION.taco
200200
201201
- name: "Configure AWS credentials"
202202
if: ${{env.SIGNING_ENABLED == 'true'}}

tableau-connector/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ WORKDIR /tableau-connector
44
ADD ./src .
55
WORKDIR /tableau-sdk
66
RUN git clone https://github.com/tableau/connector-plugin-sdk.git &&\
7-
cd ./connector-plugin-sdk/connector-packager &&\
7+
cd ./connector-plugin-sdk &&\
8+
git checkout tags/tdvt-2.13.7 &&\
9+
cd connector-packager &&\
810
python3 -m venv .venv &&\
911
source ./.venv/bin/activate &&\
1012
python3 setup.py install &&\
1113
python3 -m connector_packager.package /tableau-connector
12-
ENTRYPOINT ["bash"]
14+
ENTRYPOINT ["bash"]

tableau-connector/build.sh

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,49 @@ echo "CURRENT_FOLDER=${CURRENT_FOLDER}"
1212
TARGET_FOLDER="$CURRENT_FOLDER"/target
1313
echo TARGET_FOLDER=${TARGET_FOLDER}
1414
mkdir -p $TARGET_FOLDER
15-
15+
echo "Created directory at: $TARGET_FOLDER"
1616
echo "Building Docker Image"
1717
docker build -t taco-builder $CURRENT_FOLDER
1818

1919
echo "Assembling Tableau Connector"
2020
docker 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
2335
echo "Verifying Tableau Connector"
2436
docker exec taco-builder sh -c "ls -l /output"
2537
docker 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/"
2846
echo "Checking Resulting TACO FILE in $TARGET_FOLDER"
2947
ls -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"
3054
docker stop taco-builder
3155
docker 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

Comments
 (0)