forked from datastax/metric-collector-for-apache-cassandra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_package.sh
executable file
·63 lines (54 loc) · 2.19 KB
/
make_package.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# Package version. Mandatory.
VERSION=$1
# Cassandra version to use for compilation, e.g. 3.11.10. Optional.
CASSANDRA_VERSION=$2
# Compilation profile for this package, look into pom.xml for profile list. Optional.
BUILD_PROFILE=$3
if [ "$VERSION" == "" ]; then
echo "Missing version arg"
exit 1
fi
PACKAGE_DIR=package-$VERSION
PROJECT_DIR_NAME=datastax-mcac-agent-$VERSION
OPTIONAL_MVN_ARGS=""
if [ -n "$CASSANDRA_VERSION" ]; then
OPTIONAL_MVN_ARGS="${OPTIONAL_MVN_ARGS} -Dcassandra.version=${CASSANDRA_VERSION}"
# make a different package for the specific Cassandra version
PROJECT_DIR_NAME=datastax-mcac-agent-$VERSION-${CASSANDRA_VERSION}
fi
if [ -n "$BUILD_PROFILE" ]; then
OPTIONAL_MVN_ARGS="${OPTIONAL_MVN_ARGS} --activate-profiles=${BUILD_PROFILE}"
fi
mkdir -p $PACKAGE_DIR
mvn -DskipTests clean package -Drevision=$VERSION $OPTIONAL_MVN_ARGS
mkdir -p $PACKAGE_DIR/$PROJECT_DIR_NAME/config
cp config/collectd.conf.tmpl $PACKAGE_DIR/$PROJECT_DIR_NAME/config
cp config/metric-collector.yaml $PACKAGE_DIR/$PROJECT_DIR_NAME/config
cp README.md $PACKAGE_DIR/$PROJECT_DIR_NAME
cp LICENSE.txt $PACKAGE_DIR/$PROJECT_DIR_NAME
mkdir $PACKAGE_DIR/$PROJECT_DIR_NAME/lib
cp -r target/collectd $PACKAGE_DIR/$PROJECT_DIR_NAME/lib
cp target/datastax-mcac-agent-$VERSION.jar $PACKAGE_DIR/$PROJECT_DIR_NAME/lib/datastax-mcac-agent.jar
cp -r scripts $PACKAGE_DIR/$PROJECT_DIR_NAME/
pushd .
cd $PACKAGE_DIR
tar zcvf $PROJECT_DIR_NAME.tar.gz $PROJECT_DIR_NAME
zip $PROJECT_DIR_NAME.zip $(tar ztf $PROJECT_DIR_NAME.tar.gz)
popd
pushd .
cd dashboards/grafana
./make-dashboards.sh
popd
DASHBOARD_DIR_NAME=datastax-mcac-dashboards-$VERSION
mkdir -p $PACKAGE_DIR/$DASHBOARD_DIR_NAME/grafana
cp dashboards/docker-compose.yaml $PACKAGE_DIR/$DASHBOARD_DIR_NAME
cp -r dashboards/prometheus $PACKAGE_DIR/$DASHBOARD_DIR_NAME
cp dashboards/grafana/prometheus-datasource.yaml $PACKAGE_DIR/$DASHBOARD_DIR_NAME/grafana
cp dashboards/grafana/dashboards.yaml $PACKAGE_DIR/$DASHBOARD_DIR_NAME/grafana
cp -r dashboards/grafana/generated-dashboards $PACKAGE_DIR/$DASHBOARD_DIR_NAME/grafana
pushd .
cd $PACKAGE_DIR
tar zcvf $DASHBOARD_DIR_NAME.tar.gz $DASHBOARD_DIR_NAME
zip $DASHBOARD_DIR_NAME.zip $(tar ztf $DASHBOARD_DIR_NAME.tar.gz)
popd