Skip to content

Commit 469216e

Browse files
pjanottihughesjj
authored andcommitted
MSI build.sh script changes to build MSI locally
1 parent 5416185 commit 469216e

File tree

1 file changed

+22
-18
lines changed
  • internal/buildscripts/packaging/msi/msi-builder

1 file changed

+22
-18
lines changed

internal/buildscripts/packaging/msi/msi-builder/build.sh

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,27 @@
1616

1717
set -euo pipefail
1818

19-
WXS_PATH="/project/internal/buildscripts/packaging/msi/splunk-otel-collector.wxs"
20-
OTELCOL="/project/bin/otelcol_windows_amd64.exe"
21-
AGENT_CONFIG="/project/cmd/otelcol/config/collector/agent_config.yaml"
22-
GATEWAY_CONFIG="/project/cmd/otelcol/config/collector/gateway_config.yaml"
23-
FLUENTD_CONFIG="/project/internal/buildscripts/packaging/fpm/etc/otel/collector/fluentd/fluent.conf"
24-
FLUENTD_CONFD="/project/internal/buildscripts/packaging/msi/fluentd/conf.d"
25-
SUPPORT_BUNDLE_SCRIPT="/project/internal/buildscripts/packaging/msi/splunk-support-bundle.ps1"
26-
SPLUNK_ICON="/project/internal/buildscripts/packaging/msi/splunk.ico"
27-
OUTPUT_DIR="/project/dist"
19+
# This script builds the Splunk OpenTelemetry MSI from the project available at ${PROJECT_DIR}.
20+
PROJECT_DIR=${PROJECT_DIR:-/project}
21+
WORK_DIR=${WORK_DIR:-/work}
22+
23+
WXS_PATH="${PROJECT_DIR}/internal/buildscripts/packaging/msi/splunk-otel-collector.wxs"
24+
OTELCOL="${PROJECT_DIR}/bin/otelcol_windows_amd64.exe"
25+
AGENT_CONFIG="${PROJECT_DIR}/cmd/otelcol/config/collector/agent_config.yaml"
26+
GATEWAY_CONFIG="${PROJECT_DIR}/cmd/otelcol/config/collector/gateway_config.yaml"
27+
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"
31+
OUTPUT_DIR="${PROJECT_DIR}/dist"
2832
JMX_METRIC_GATHERER_RELEASE="1.29.0"
2933

3034
usage() {
3135
cat <<EOH >&2
3236
usage: ${BASH_SOURCE[0]} [OPTIONS] VERSION
3337
3438
Description:
35-
Build the Splunk OpenTelemetry MSI from the project available at /project.
39+
Build the Splunk OpenTelemetry MSI from the project available at ${PROJECT_DIR}.
3640
By default, the MSI is saved as '${OUTPUT_DIR}/splunk-otel-collector-VERSION-amd64.msi'.
3741
3842
OPTIONS:
@@ -133,7 +137,7 @@ parse_args_and_build() {
133137
fi
134138

135139
set -x
136-
build_dir="/work/build"
140+
build_dir="${WORK_DIR}/build"
137141
files_dir="${build_dir}/msi"
138142
msi_name="splunk-otel-collector-${version}-amd64.msi"
139143

@@ -155,21 +159,21 @@ parse_args_and_build() {
155159
jmx_metrics_jar="${build_dir}/opentelemetry-java-contrib-jmx-metrics.jar"
156160

157161
# kludge to satisfy relative path in splunk-otel-collector.wxs
158-
mkdir -p /work/internal/buildscripts/packaging/msi
159-
cp "${splunk_icon}" "/work/internal/buildscripts/packaging/msi/splunk.ico"
162+
mkdir -p ${WORK_DIR}/internal/buildscripts/packaging/msi
163+
cp "${splunk_icon}" "${WORK_DIR}/internal/buildscripts/packaging/msi/splunk.ico"
160164

161-
cd /work
165+
cd ${WORK_DIR}
162166
configFilesWsx="${build_dir}/configfiles.wsx"
163-
heat dir "$files_dir" -srd -sreg -gg -template fragment -cg ConfigFiles -dr INSTALLDIR -out "${configFilesWsx//\//\\}"
167+
heat dir "$files_dir" -srd -sreg -gg -template fragment -cg ConfigFiles -dr INSTALLDIR -out "${configFilesWsx}"
164168

165169
configFilesWixObj="${build_dir}/configfiles.wixobj"
166-
candle -arch x64 -out "${configFilesWixObj//\//\\}" "${configFilesWsx//\//\\}"
170+
candle -arch x64 -out "${configFilesWixObj}" "${configFilesWsx}"
167171

168172
collectorWixObj="${build_dir}/splunk-otel-collector.wixobj"
169-
candle -arch x64 -out "${collectorWixObj//\//\\}" -dVersion="$version" -dOtelcol="$otelcol" -dJmxMetricsJar="$jmx_metrics_jar" "${WXS_PATH//\//\\}"
173+
candle -arch x64 -out "${collectorWixObj}" -dVersion="$version" -dOtelcol="$otelcol" -dJmxMetricsJar="$jmx_metrics_jar" "${WXS_PATH}"
170174

171175
msi="${build_dir}/${msi_name}"
172-
light -ext WixUtilExtension.dll -sval -out "${msi//\//\\}" -b "${files_dir//\//\\}" "${collectorWixObj//\//\\}" "${configFilesWixObj//\//\\}"
176+
light -ext WixUtilExtension.dll -sval -out "${msi}" -b "${files_dir}" "${collectorWixObj}" "${configFilesWixObj}"
173177

174178
mkdir -p $output
175179
cp "${msi}" "${output}/${msi_name}"

0 commit comments

Comments
 (0)