@@ -20,14 +20,15 @@ set -euo pipefail
20
20
PROJECT_DIR=${PROJECT_DIR:-/ project}
21
21
WORK_DIR=${WORK_DIR:-/ work}
22
22
23
- WXS_PATH=" ${PROJECT_DIR} /internal/buildscripts/packaging/msi/splunk-otel-collector.wxs"
23
+ MSI_SRC_DIR=" ${PROJECT_DIR} /internal/buildscripts/packaging/msi"
24
+ WXS_PATH=" ${MSI_SRC_DIR} /splunk-otel-collector.wxs"
24
25
OTELCOL=" ${PROJECT_DIR} /bin/otelcol_windows_amd64.exe"
25
26
AGENT_CONFIG=" ${PROJECT_DIR} /cmd/otelcol/config/collector/agent_config.yaml"
26
27
GATEWAY_CONFIG=" ${PROJECT_DIR} /cmd/otelcol/config/collector/gateway_config.yaml"
27
28
FLUENTD_CONFIG=" ${PROJECT_DIR} /internal/buildscripts/packaging/fpm/etc/otel/collector/fluentd/fluent.conf"
28
- FLUENTD_CONFD=" ${PROJECT_DIR} /internal/buildscripts/packaging/msi /fluentd/conf.d"
29
- SUPPORT_BUNDLE_SCRIPT=" ${PROJECT_DIR} /internal/buildscripts/packaging/msi /splunk-support-bundle.ps1"
30
- SPLUNK_ICON=" ${PROJECT_DIR} /internal/buildscripts/packaging/msi /splunk.ico"
29
+ FLUENTD_CONFD=" ${MSI_SRC_DIR} /fluentd/conf.d"
30
+ SUPPORT_BUNDLE_SCRIPT=" ${MSI_SRC_DIR} /splunk-support-bundle.ps1"
31
+ SPLUNK_ICON=" ${MSI_SRC_DIR} /splunk.ico"
31
32
OUTPUT_DIR=" ${PROJECT_DIR} /dist"
32
33
JMX_METRIC_GATHERER_RELEASE=" 1.29.0"
33
34
@@ -40,25 +41,25 @@ Description:
40
41
By default, the MSI is saved as '${OUTPUT_DIR} /splunk-otel-collector-VERSION-amd64.msi'.
41
42
42
43
OPTIONS:
43
- --otelcol PATH: Absolute path to the otelcol exe.
44
+ --otelcol PATH Absolute path to the otelcol exe.
44
45
Defaults to '$OTELCOL '.
45
- --agent-config PATH: Absolute path to the agent config.
46
+ --agent-config PATH Absolute path to the agent config.
46
47
Defaults to '$AGENT_CONFIG '.
47
- --gateway-config PATH: Absolute path to the gateway config.
48
+ --gateway-config PATH Absolute path to the gateway config.
48
49
Defaults to '$GATEWAY_CONFIG '.
49
- --fluentd PATH: Absolute path to the fluentd config.
50
+ --fluentd PATH Absolute path to the fluentd config.
50
51
Defaults to '$FLUENTD_CONFIG '.
51
- --fluentd-confd PATH: Absolute path to the conf.d.
52
+ --fluentd-confd PATH Absolute path to the conf.d.
52
53
Defaults to '$FLUENTD_CONFD '.
53
- --support-bundle PATH: Absolute path to the support bundle script.
54
+ --support-bundle PATH Absolute path to the support bundle script.
54
55
Defaults to '$SUPPORT_BUNDLE_SCRIPT '.
55
- --jmx-metric-gatherer VERSION: The released version of the JMX Metric Gatherer JAR to include (will be downloaded).
56
+ --jmx-metric-gatherer VERSION The released version of the JMX Metric Gatherer JAR to include (will be downloaded).
56
57
Defaults to '$JMX_METRIC_GATHERER_RELEASE '.
57
- --splunk-icon PATH: Absolute path to the splunk.ico.
58
+ --splunk-icon PATH Absolute path to the splunk.ico.
58
59
Defaults to '$SPLUNK_ICON '.
59
- --output DIR: Directory to save the MSI.
60
+ --output DIR Directory to save the MSI.
60
61
Defaults to '$OUTPUT_DIR '.
61
-
62
+ --skip-build-dir-removal Skip removing the build directory before building the MSI.
62
63
EOH
63
64
}
64
65
@@ -73,6 +74,7 @@ parse_args_and_build() {
73
74
local splunk_icon=" $SPLUNK_ICON "
74
75
local output=" $OUTPUT_DIR "
75
76
local version=
77
+ local skip_build_dir_removal=
76
78
77
79
while [ -n " ${1-} " ]; do
78
80
case $1 in
@@ -112,6 +114,9 @@ parse_args_and_build() {
112
114
output=" $2 "
113
115
shift 1
114
116
;;
117
+ --skip-build-dir-removal)
118
+ skip_build_dir_removal=1
119
+ ;;
115
120
-* )
116
121
echo " Unknown option '$1 '"
117
122
echo
@@ -141,8 +146,10 @@ parse_args_and_build() {
141
146
files_dir=" ${build_dir} /msi"
142
147
msi_name=" splunk-otel-collector-${version} -amd64.msi"
143
148
144
- if [ -d " $build_dir " ]; then
149
+ if [ -z " $skip_build_dir_removal " && - d " $build_dir " ]; then
145
150
rm -rf " $build_dir "
151
+ else
152
+ echo " Skipping build directory removal"
146
153
fi
147
154
148
155
mkdir -p " ${files_dir} /fluentd/conf.d"
@@ -152,15 +159,16 @@ parse_args_and_build() {
152
159
cp " $fluentd_config " " ${files_dir} /fluentd/td-agent.conf"
153
160
cp " ${fluentd_confd} " /* .conf " ${files_dir} /fluentd/conf.d/"
154
161
155
- unzip -d " $files_dir " " ${OUTPUT_DIR} /agent-bundle_windows_amd64.zip"
156
- rm -f " ${OUTPUT_DIR} /agent-bundle_windows_amd64.zip"
162
+ if [ -z " $skip_build_dir_removal " ]; then
163
+ unzip -d " $files_dir " " ${OUTPUT_DIR} /agent-bundle_windows_amd64.zip"
164
+ rm -f " ${OUTPUT_DIR} /agent-bundle_windows_amd64.zip"
157
165
158
- download_jmx_metric_gatherer " $jmx_metric_gatherer_release " " $build_dir "
159
- jmx_metrics_jar=" ${build_dir} /opentelemetry-java-contrib-jmx-metrics.jar"
166
+ download_jmx_metric_gatherer " $jmx_metric_gatherer_release " " $build_dir "
167
+ else
168
+ echo " Skipping unzipping agent bundle and downloading JMX Metric Gatherer"
169
+ fi
160
170
161
- # kludge to satisfy relative path in splunk-otel-collector.wxs
162
- mkdir -p ${WORK_DIR} /internal/buildscripts/packaging/msi
163
- cp " ${splunk_icon} " " ${WORK_DIR} /internal/buildscripts/packaging/msi/splunk.ico"
171
+ jmx_metrics_jar=" ${build_dir} /opentelemetry-java-contrib-jmx-metrics.jar"
164
172
165
173
cd ${WORK_DIR}
166
174
configFilesWsx=" ${build_dir} /configfiles.wsx"
@@ -172,6 +180,13 @@ parse_args_and_build() {
172
180
collectorWixObj=" ${build_dir} /splunk-otel-collector.wixobj"
173
181
candle -arch x64 -out " ${collectorWixObj} " -dVersion=" $version " -dOtelcol=" $otelcol " -dJmxMetricsJar=" $jmx_metrics_jar " " ${WXS_PATH} "
174
182
183
+ customActionsDll=" ${MSI_SRC_DIR} /SplunkCustomActions/bin/Release/SplunkCustomActions.CA.dll"
184
+ MakeSfxCA " ${customActionsDll} " \
185
+ " $WIX \SDK\x64\sfxca.dll" \
186
+ " ${MSI_SRC_DIR} /SplunkCustomActions/bin/Release/SplunkCustomActions.dll" \
187
+ " ${MSI_SRC_DIR} /SplunkCustomActions/bin/Release/Microsoft.Deployment.WindowsInstaller.dll" \
188
+ " ${MSI_SRC_DIR} /SplunkCustomActions/CustomAction.config"
189
+
175
190
msi=" ${build_dir} /${msi_name} "
176
191
light -ext WixUtilExtension.dll -sval -out " ${msi} " -b " ${files_dir} " " ${collectorWixObj} " " ${configFilesWixObj} "
177
192
0 commit comments