-
Notifications
You must be signed in to change notification settings - Fork 1
/
assemble.sh
executable file
·38 lines (29 loc) · 1.18 KB
/
assemble.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
32
33
34
35
36
37
38
#!/bin/bash
git diff --quiet
DIRTY_TREE=$?
if [[ $DIRTY_TREE -ne 0 ]]; then
echo "================================================================================="
echo " Artifacts built from a dirty working tree should not be promoted to production."
echo "================================================================================="
fi
SCALA_VERSION='2.13'
ARTIFACT=$(sbt assembly | grep TRINO_PLUGINS_ARTIFACT | grep '.jar' | head -n 1 | cut -d ':' -f 2 | tr -d [:space:])
echo "Artifact: ${ARTIFACT}"
SRC_PATH="target/scala-${SCALA_VERSION}/${ARTIFACT}"
TRINO_VERSION=$(echo $ARTIFACT | cut -d '-' -f 3)
GIT_HASH=$(echo $ARTIFACT | cut -d '-' -f 4 | cut -d '.' -f 1)
EVENTS_DST_PATH="trino-config-docker/plugin/trino-events/trino-${TRINO_VERSION}-plugins.jar"
DIRTY_MESSAGE=""
if [[ $DIRTY_TREE -ne 0 ]]; then
DIRTY_MESSAGE=" (dirty)"
fi
echo "Artifact name: ${ARTIFACT}"
echo "Trino version: ${TRINO_VERSION}"
echo "Git hash: ${GIT_HASH} ${DIRTY_MESSAGE}"
rm $EVENTS_DST_PATH
echo "Copying artifact to docker config: ${SRC_PATH} -> ${EVENTS_DST_PATH}"
cp $SRC_PATH $EVENTS_DST_PATH
if [[ $DIRTY_TREE -ne 0 ]]; then
echo "Artifact built from a dirty working tree."
exit 1
fi