sensu / monitoring-plugins

Sensu Assets for the monitoring-plugins.org project
https://monitoring-plugins.org
5 stars 17 forks source link

build.sh only supports amd64 #3

Closed sjthespian closed 1 year ago

sjthespian commented 5 years ago

I'm trying to get sensu plugins that work on my rpi boxes. For this one, the following patch makes the build produce properly-named assets for the build architecture.

diff --git a/build.sh b/build.sh
index 366f5da..4550c64 100755
--- a/build.sh
+++ b/build.sh
@@ -3,10 +3,12 @@
 export PLUGINS="check_disk,check_http,check_ntp,check_ntp_peer,check_ntp_time,check_ping,check_procs,check_smtp,check_ssh,check_swap,check_tcp,check_time,check_users"
 export SENSU_GO_ASSET_VERSION=$(git describe --abbrev=0 --tags)

+export ARCH=$(uname -m)
+
 mkdir assets/
 for PLATFORM in alpine debian centos;
 do
-  export SENSU_GO_ASSET_FILENAME="monitoring-plugins-${PLATFORM}_${SENSU_GO_ASSET_VERSION}_linux_amd64.tar.gz"
+  export SENSU_GO_ASSET_FILENAME="monitoring-plugins-${PLATFORM}_${SENSU_GO_ASSET_VERSION}_linux_${ARCH}.tar.gz"
   docker build --build-arg "PLUGINS=$PLUGINS" --build-arg "SENSU_GO_ASSET_VERSION=$SENSU_GO_ASSET_VERSION" -t monitoring-plugins-${PLATFORM}:$SENSU_GO_ASSET_VERSION -f Dockerfile.${PLATFORM} .
   docker cp -L $(docker create monitoring-plugins-${PLATFORM}:$SENSU_GO_ASSET_VERSION true):/$SENSU_GO_ASSET_FILENAME ./assets/
 done;
jspaleta commented 4 years ago

I'm going to put a pin in this. I want to get the travisCI integration done first so the builds are fully automated. Its still a manual process to deal with releases and I want to fix that first before we go crazy with the number of binaries being produced

asachs01 commented 2 years ago

@jspaleta what are your thoughts about adding ARM support? We had a similar request in #27.

jspaleta commented 2 years ago

This plugin has a problem in that it takes upwards of 30 minutes to build all the targets already. If we add arm, we are basically doubling that to an hour. We need to rethink how we approach this.

Because these are not statically compiled binaries, we can't have one build per arch.... trying to build multi-arch for all linux distros is unsustainable.

jspaleta commented 2 years ago

Okay more on this... The build process for ARM would require introducing some sort of cross compile process as github actions doesnt offer an ARM runner yet. Not impossible but also not a small change. Something I'd certainly review and try to merge if it were contributed, but its hard to see this bubbling up into my priorities relative to other things.

elfranne commented 2 years ago

@sjthespian I had some free time, #39

echlebek commented 1 year ago

Seems this can be closed.