2022-02-01 07:41:27 -08:00
|
|
|
#!/usr/bin/env bash
|
2023-02-02 17:15:17 -08:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
2022-02-01 07:41:27 -08:00
|
|
|
#
|
|
|
|
|
# This script builds the required plugins.
|
|
|
|
|
set -e
|
|
|
|
|
|
2022-02-17 10:48:15 -05:00
|
|
|
BINARY_SUFFIX=""
|
2022-02-17 11:15:36 -05:00
|
|
|
if [ "${GOOS}x" = "windowsx" ]; then
|
2022-02-17 10:48:15 -05:00
|
|
|
BINARY_SUFFIX=".exe"
|
|
|
|
|
fi
|
|
|
|
|
|
2022-04-15 09:17:43 -04:00
|
|
|
# Get the parent directory of where this script is.
|
|
|
|
|
SOURCE="${BASH_SOURCE[0]}"
|
|
|
|
|
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
|
|
|
|
|
export DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
|
|
|
|
|
|
2023-06-02 08:04:50 -07:00
|
|
|
# Create boundary plugins
|
|
|
|
|
echo "==> Building boundary plugins..."
|
|
|
|
|
rm -f $DIR/plugins/boundary/assets/boundary-plugin-*
|
|
|
|
|
for CURR_PLUGIN in $(ls $DIR/plugins/boundary/mains); do
|
|
|
|
|
cd $DIR/plugins/boundary/mains/$CURR_PLUGIN;
|
|
|
|
|
go build -v -o $DIR/plugins/boundary/assets/boundary-plugin-${CURR_PLUGIN}${BINARY_SUFFIX} .;
|
|
|
|
|
cd $DIR;
|
|
|
|
|
done;
|
|
|
|
|
cd $DIR/plugins/boundary/assets;
|
|
|
|
|
for CURR_PLUGIN in $(ls boundary-plugin*); do
|
|
|
|
|
gzip -f -9 $CURR_PLUGIN;
|
|
|
|
|
done;
|
|
|
|
|
cd $DIR;
|
|
|
|
|
|
|
|
|
|
# Create other plugins
|
|
|
|
|
for PLUGIN_TYPE in "kms"; do
|
2022-04-15 09:17:43 -04:00
|
|
|
echo "==> Building ${PLUGIN_TYPE} plugins..."
|
|
|
|
|
rm -f $DIR/plugins/$PLUGIN_TYPE/assets/boundary-plugin-${PLUGIN_TYPE}*
|
|
|
|
|
for CURR_PLUGIN in $(ls $DIR/plugins/$PLUGIN_TYPE/mains); do
|
|
|
|
|
cd $DIR/plugins/$PLUGIN_TYPE/mains/$CURR_PLUGIN;
|
|
|
|
|
go build -v -o $DIR/plugins/$PLUGIN_TYPE/assets/boundary-plugin-${PLUGIN_TYPE}-${CURR_PLUGIN}${BINARY_SUFFIX} .;
|
|
|
|
|
cd $DIR;
|
2022-02-01 07:41:27 -08:00
|
|
|
done;
|
2022-04-15 09:17:43 -04:00
|
|
|
cd $DIR/plugins/$PLUGIN_TYPE/assets;
|
2022-02-01 07:41:27 -08:00
|
|
|
for CURR_PLUGIN in $(ls boundary-plugin*); do
|
|
|
|
|
gzip -f -9 $CURR_PLUGIN;
|
|
|
|
|
done;
|
2022-04-15 09:17:43 -04:00
|
|
|
cd $DIR;
|
|
|
|
|
done;
|