Skip to content

Commit

Permalink
Fix MSI release build for signed exe (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyc-splunk authored Apr 1, 2021
1 parent 1495da5 commit db5856d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
7 changes: 3 additions & 4 deletions internal/buildscripts/packaging/msi/msi-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ USER root
RUN apt-get update -y
RUN apt-get install -y curl unzip

USER wix

COPY ./build.sh /work/build.sh
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod a+x /work/build.sh /docker-entrypoint.sh

ENV OUTPUT_DIR=project/dist
ENV SMART_AGENT_RELEASE=5.9.1

# `wix` user cannot write to anything outside /work, so run w/ `-u 0` if necessary (circle configuration)
ENTRYPOINT ["bash", "-c", "su wix -c \"/work/build.sh $0 $@ --output /work/build/stage --smart-agent $SMART_AGENT_RELEASE \" && cp /work/build/stage/*.msi $OUTPUT_DIR/"]
ENTRYPOINT ["/docker-entrypoint.sh"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -euo pipefail

SMART_AGENT_RELEASE="${SMART_AGENT_RELEASE:-}"
OUTPUT_DIR="${OUTPUT_DIR:-}"

if [ -z "$SMART_AGENT_RELEASE" ]; then
echo "SMART_AGENT_RELEASE env var not set!" >&2
exit 1
fi

if [ -z "$OUTPUT_DIR" ]; then
echo "OUTPUT_DIR env var not set!" >&2
exit 1
fi

if [ $# -eq 0 ]; then
echo "Required version argument not specified!" >&2
exit 1
fi

buildargs="--output /work/build/stage --smart-agent $SMART_AGENT_RELEASE $@"
su wix -c "/work/build.sh $buildargs"

cp /work/build/stage/*.msi $OUTPUT_DIR/
3 changes: 2 additions & 1 deletion internal/buildscripts/packaging/release/helpers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ def build_msi(exe_path, args):
msi_builder_image, _ = client.images.build(path=msi_builder_path)

with tempfile.TemporaryDirectory(dir=str(REPO_DIR)) as build_dir:
shutil.copy(exe_path, os.path.join(build_dir, "otelcol.exe"))
container_options = {
"remove": True,
"volumes": {
Expand All @@ -454,7 +455,7 @@ def build_msi(exe_path, args):
"user": 0,
"working_dir": "/work",
"environment": {'OUTPUT_DIR': "/work/stage"},
"command": f"{msi_version}",
"command": [f"--otelcol /work/stage/otelcol.exe {msi_version}"],
}
output = client.containers.run(msi_builder_image, **container_options)
print(output.decode("utf-8"))
Expand Down

0 comments on commit db5856d

Please sign in to comment.