Add Device42 build jobs

Change-Id: Ia9817c16c8aaae58b3cec70d21807d6d1136d153
This commit is contained in:
Mohammed Naser 2020-08-14 12:10:08 -04:00
parent 3fa880a35a
commit 83a46241d3
2 changed files with 18 additions and 1 deletions

View File

@ -7,6 +7,8 @@ RUN unzip d42-agent-remote.zip
RUN chmod +x d42-agent-remote/d42_autodisc_linux_x64
FROM debian:buster
COPY entrypoint.sh /entrypoint.sh
COPY --from=builder d42-agent-remote/d42_autodisc_linux_x64 /usr/local/bin/d42_autodisc_linux_x64
ENTRYPOINT ["/usr/local/bin/d42_autodisc_linux_x64", "-config", "/etc/device42/inventory.cfg"]
WORKDIR /etc/device42
ENTRYPOINT ["/entrypoint.sh"]

15
d42-agent-remote/entrypoint.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -xe
BUILD_MODIFY_TIME=$(stat -c %y /usr/local/bin/d42_autodisc_linux_x64)
/usr/local/bin/d42_autodisc_linux_x64
# NOTE(mnaser): If Device42 self-updates, it restarts itself but the problem
# with this is that in a containerized environment, we will be
# in an update loop.
NEW_MODIFY_TIME=$(stat -c %y /usr/local/bin/d42_autodisc_linux_x64)
if [ "$BUILD_MODIFY_TIME" != "$NEW_MODIFY_TIME" ]; then
/usr/local/bin/d42_autodisc_linux_x64
fi