diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 84911a4..4544a5c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,4 +44,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COSIGN_EXPERIMENTAL: 1 - GOVERSION: "1.22" + GOVERSION: "1.23.1" diff --git a/Dockerfile b/Dockerfile index 0a3e76f..bbe225f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,76 +1,85 @@ -FROM debian:12.7-slim AS stage1 +FROM alpine:3.8 as stage1 -# Supermicro SUM -# Note: If we remove the SUM tool, we can move back to an alpine image. Then also compile bioscfg with CGO_ENABLED=0 -WORKDIR /tmp/sum +# IPMITOOL -## Pre-reqs -RUN apt-get update -RUN apt-get install wget -y - -## Download -RUN wget https://www.supermicro.com/Bios/sw_download/698/sum_2.14.0_Linux_x86_64_20240215.tar.gz -O sum.tar.gz -RUN mkdir -p unzipped -RUN tar -xvzf sum.tar.gz -C unzipped --strip-components=1 +ARG IPMITOOL_REPO=https://github.com/ipmitool/ipmitool.git +ARG IPMITOOL_COMMIT=19d78782d795d0cf4ceefe655f616210c9143e62 -## Install -RUN cp unzipped/sum /usr/bin/sum #TODO; smc sum has the same name as the gnu command sum (/usr/bin/sum). So we are overwritting it. Sorry not Sorry. -RUN chmod +x /usr/bin/sum +WORKDIR /tmp +RUN apk add --update --upgrade --no-cache --virtual build-deps\ + alpine-sdk \ + automake \ + autoconf \ + libtool \ + openssl-dev \ + readline-dev \ + && git clone -b master ${IPMITOOL_REPO} -# IPMI Tool # # cherry-pick'ed 1edb0e27e44196d1ebe449aba0b9be22d376bcb6 # to fix https://github.com/ipmitool/ipmitool/issues/377 # -ARG IPMITOOL_REPO=https://github.com/ipmitool/ipmitool.git -ARG IPMITOOL_COMMIT=19d78782d795d0cf4ceefe655f616210c9143e62 -ARG IPMITOOL_CHERRY_PICK=1edb0e27e44196d1ebe449aba0b9be22d376bcb6 -ARG IPMITOOL_BUILD_DEPENDENCIES="git curl make autoconf automake libtool libreadline-dev" +WORKDIR /tmp/ipmitool +RUN git checkout ${IPMITOOL_COMMIT} \ + && git config --global user.email "github.ci@doesnot.existorg" \ + && git cherry-pick 1edb0e27e44196d1ebe449aba0b9be22d376bcb6 \ + && ./bootstrap \ + && ./configure \ + --prefix=/usr/local \ + --enable-ipmievd \ + --enable-ipmishell \ + --enable-intf-lan \ + --enable-intf-lanplus \ + --enable-intf-open \ + && make \ + && make install \ + && apk del build-deps + +WORKDIR /tmp +RUN rm -rf /tmp/ipmitool -WORKDIR /tmp/ipmi +## Get IPMI IANA resource, to prevent dependency on third party servers at runtime. +WORKDIR /usr/share/misc +RUN wget https://www.iana.org/assignments/enterprise-numbers.txt -## Pre-reqs -RUN apt-get update -RUN apt-get install ${IPMITOOL_BUILD_DEPENDENCIES} -y +# Supermicro SUM +WORKDIR /tmp/sum ## Download -RUN git clone -b master ${IPMITOOL_REPO} -WORKDIR /tmp/ipmi/ipmitool -RUN git checkout ${IPMITOOL_COMMIT} -RUN git config --global user.email "github.ci@doesnot.existorg" -RUN git cherry-pick ${IPMITOOL_CHERRY_PICK} +RUN wget https://www.supermicro.com/Bios/sw_download/698/sum_2.14.0_Linux_x86_64_20240215.tar.gz -O sum.tar.gz +RUN mkdir -p unzipped +RUN tar -xvzf sum.tar.gz -C unzipped --strip-components=1 ## Install -RUN ./bootstrap -RUN autoreconf -i -RUN ./configure \ - --prefix=/usr/local \ - --enable-ipmievd \ - --enable-ipmishell \ - --enable-intf-lan \ - --enable-intf-lanplus \ - --enable-intf-open -RUN make -RUN make install +RUN cp unzipped/sum /usr/bin/sum #TODO; smc sum has the same name as the gnu command sum (/usr/bin/sum). So we are overwritting it. Sorry not Sorry. +RUN chmod +x /usr/bin/sum -## Get IPMI IANA resource, to prevent dependency on third party servers at runtime. -WORKDIR /usr/share/misc -RUN wget https://www.iana.org/assignments/enterprise-numbers.txt +WORKDIR /tmp +RUN rm -rf /tmp/sum # Build a lean image with dependencies installed. -FROM debian:12.7-slim -COPY --from=stage1 /usr/bin/sum /usr/bin/sum -COPY --from=stage1 /usr/local/bin/ipmitool /usr/local/bin/ipmitool -COPY --from=stage1 /usr/share/misc/enterprise-numbers.txt /usr/share/misc/enterprise-numbers.txt - -## Install runtime dependencies -RUN apt-get update -y -RUN apt-get install libreadline8 --no-install-recommends -y - -# BiosCfg +## Do this because apk can install a ton of junk. +FROM alpine:3.8 +COPY --from=stage1 / / + +## SUM and IPMITOOL is dynamically linked and needs glibc +ENV GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc +ENV GLIBC_VERSION=2.30-r0 +RUN set -ex && \ + apk --update add libstdc++ curl ca-certificates && \ + for pkg in glibc-${GLIBC_VERSION} glibc-bin-${GLIBC_VERSION}; \ + do curl -sSL ${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/${pkg}.apk -o /tmp/${pkg}.apk; done && \ + apk add --allow-untrusted /tmp/*.apk && \ + rm -v /tmp/*.apk && \ + /usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib + +# required by ipmitool and sum runtime +RUN apk add --update --upgrade --no-cache --virtual run-deps \ + ca-certificates \ + libcrypto1.0 \ + readline COPY bioscfg /usr/sbin/bioscfg RUN chmod +x /usr/sbin/bioscfg - ENTRYPOINT ["/usr/sbin/bioscfg"] \ No newline at end of file diff --git a/go.mod b/go.mod index 5580cc8..fd567f7 100644 --- a/go.mod +++ b/go.mod @@ -1,17 +1,17 @@ module github.com/metal-toolbox/bioscfg -go 1.22.1 +go 1.23.1 require ( - github.com/bmc-toolbox/bmclib/v2 v2.3.3 + github.com/bmc-toolbox/bmclib/v2 v2.3.4 github.com/bombsimon/logrusr/v4 v4.1.0 github.com/coreos/go-oidc/v3 v3.11.0 github.com/equinix-labs/otel-init-go v0.0.9 github.com/google/uuid v1.6.0 github.com/hashicorp/go-retryablehttp v0.7.7 github.com/jeremywohl/flatten v1.0.1 - github.com/metal-toolbox/ctrl v0.2.9 - github.com/metal-toolbox/fleetdb v1.19.7 + github.com/metal-toolbox/ctrl v0.3.0 + github.com/metal-toolbox/fleetdb v1.19.8 github.com/metal-toolbox/rivets v1.3.10 github.com/mitchellh/copystructure v1.2.0 github.com/mitchellh/mapstructure v1.5.0 @@ -25,11 +25,10 @@ require ( go.opentelemetry.io/otel v1.31.0 go.opentelemetry.io/otel/trace v1.31.0 golang.org/x/net v0.30.0 - golang.org/x/oauth2 v0.23.0 + golang.org/x/oauth2 v0.22.0 ) require ( - cloud.google.com/go/kms v1.17.1 // indirect dario.cat/mergo v1.0.0 // indirect github.com/Jeffail/gabs/v2 v2.7.0 // indirect github.com/VictorLowther/simplexml v0.0.0-20180716164440-0bff93621230 // indirect @@ -92,12 +91,12 @@ require ( github.com/lib/pq v1.10.9 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/metal-toolbox/conditionorc v1.1.8 // indirect + github.com/metal-toolbox/conditionorc v1.1.9 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/nats-io/nats.go v1.36.0 // indirect + github.com/nats-io/nats.go v1.37.0 // indirect github.com/nats-io/nkeys v0.4.7 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect diff --git a/go.sum b/go.sum index f4fcb77..3f764f9 100644 --- a/go.sum +++ b/go.sum @@ -30,7 +30,6 @@ cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Ud cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14= -cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= cloud.google.com/go/auth v0.7.2 h1:uiha352VrCDMXg+yoBtaD0tUF4Kv9vrtrWPYXwutnDE= cloud.google.com/go/auth v0.7.2/go.mod h1:VEc4p5NNxycWQTMQEDQF0bd6aTMb6VgYDXEwiJJQAbs= cloud.google.com/go/auth/oauth2adapt v0.2.3 h1:MlxF+Pd3OmSudg/b1yZ5lJwoXCEaeedAguodky1PcKI= @@ -52,12 +51,10 @@ cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykW cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= -cloud.google.com/go/iam v1.1.8 h1:r7umDwhj+BQyz0ScZMp4QrGXjSTI3ZINnpgU2nlB/K0= -cloud.google.com/go/iam v1.1.8/go.mod h1:GvE6lyMmfxXauzNq8NbgJbeVQNspG+tcdL/W8QO1+zE= -cloud.google.com/go/kms v1.17.1 h1:5k0wXqkxL+YcXd4viQzTqCgzzVKKxzgrK+rCZJytEQs= -cloud.google.com/go/kms v1.17.1/go.mod h1:DCMnCF/apA6fZk5Cj4XsD979OyHAqFasPuA5Sd0kGlQ= -cloud.google.com/go/longrunning v0.5.7 h1:WLbHekDbjK1fVFD3ibpFFVoyizlLRl73I7YKuAKilhU= -cloud.google.com/go/longrunning v0.5.7/go.mod h1:8GClkudohy1Fxm3owmBGid8W0pSgodEMwEAztp38Xng= +cloud.google.com/go/iam v1.1.7 h1:z4VHOhwKLF/+UYXAJDFwGtNF0b6gjsW1Pk9Ml0U/IoM= +cloud.google.com/go/iam v1.1.7/go.mod h1:J4PMPg8TtyurAUvSmPj8FF3EDgY1SPRZxcUGrn7WXGA= +cloud.google.com/go/kms v1.15.8 h1:szIeDCowID8th2i8XE4uRev5PMxQFqW+JjwYxL9h6xs= +cloud.google.com/go/kms v1.15.8/go.mod h1:WoUHcDjD9pluCg7pNds131awnH429QGvRM3N/4MyoVs= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -111,8 +108,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bmc-toolbox/bmclib/v2 v2.3.3 h1:ORCB91SrCShUnJ4vwQ00OPSmNg+08NLgaBH/ezfMKjQ= -github.com/bmc-toolbox/bmclib/v2 v2.3.3/go.mod h1:t8If/0fHQTRIK/yKDk2H3SgthDNNj+7z2aeftDFRFrU= +github.com/bmc-toolbox/bmclib/v2 v2.3.4 h1:ihCC9jH8g5Racg4zy+lWpjt7vRt2aWzit3LEL1DiS7k= +github.com/bmc-toolbox/bmclib/v2 v2.3.4/go.mod h1:t8If/0fHQTRIK/yKDk2H3SgthDNNj+7z2aeftDFRFrU= github.com/bmc-toolbox/common v0.0.0-20240926143744-8c478be881d7 h1:Xe6j3oMwe82buwBwEpok9wr+v21Io59pqMTZ5rKRVn8= github.com/bmc-toolbox/common v0.0.0-20240926143744-8c478be881d7/go.mod h1:Cdnkm+edb6C0pVkyCrwh3JTXAe0iUF9diDG/DztPI9I= github.com/bombsimon/logrusr/v2 v2.0.1 h1:1VgxVNQMCvjirZIYaT9JYn6sAVGVEcNtRE0y4mvaOAM= @@ -554,19 +551,19 @@ github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4 github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/metal-toolbox/conditionorc v1.1.8 h1:5wjIdPLdLY2RkIeGZ73tTFEnKJxBzBM5ZJMopDqFgSg= -github.com/metal-toolbox/conditionorc v1.1.8/go.mod h1:eXlXZoOJBmihR4/+xA2o1dj1sQTXkU63Ekma7Ouc+o0= -github.com/metal-toolbox/ctrl v0.2.9 h1:Q1Hqpqyb71/gg2PcX/qrfoDE8FlydJt4rPQb7/Z8LhI= -github.com/metal-toolbox/ctrl v0.2.9/go.mod h1:QVATUIWFx3dbjOoEX0EnJHtRvypRlXZ9HUGaPLRyTG8= -github.com/metal-toolbox/fleetdb v1.19.7 h1:lTl67gtt5DzTdH4MgLViyXaTaH6FM8BtmM7NX7hXDZY= -github.com/metal-toolbox/fleetdb v1.19.7/go.mod h1:IMbJwyC9DnznuPNjAaP54Y6uWuWu9cPXGH+yoe7jwGA= +github.com/metal-toolbox/conditionorc v1.1.9 h1:8VX8QWjHd+ZGacylwp5Q3PB8+Dt/9dBeA64e00BF93Y= +github.com/metal-toolbox/conditionorc v1.1.9/go.mod h1:eXlXZoOJBmihR4/+xA2o1dj1sQTXkU63Ekma7Ouc+o0= +github.com/metal-toolbox/ctrl v0.3.0 h1:h/d0LQN4o/4GO567Vx9i9q+VM+yT74ejjXm8DoeLvTY= +github.com/metal-toolbox/ctrl v0.3.0/go.mod h1:J0PoZJ5B231+f3Ys4C23w5A1NBISB4y6e+45UiS7fLY= +github.com/metal-toolbox/fleetdb v1.19.8 h1:zQzfgFWuc7lFqSJYvqbfVX4DShgFFFohWql80rFFYtI= +github.com/metal-toolbox/fleetdb v1.19.8/go.mod h1:IMbJwyC9DnznuPNjAaP54Y6uWuWu9cPXGH+yoe7jwGA= github.com/metal-toolbox/rivets v1.3.10 h1:UgYQSx/QJF6Yuzf+YSRF/t9soL6QjMY8sLugf/aMmII= github.com/metal-toolbox/rivets v1.3.10/go.mod h1:HkF9k8yw3MZqrIkxsi7w7EkTP3h2/t08WBpm+WK/Dsk= github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= -github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= +github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -594,12 +591,12 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nats-io/jwt/v2 v2.5.5 h1:ROfXb50elFq5c9+1ztaUbdlrArNFl2+fQWP6B8HGEq4= -github.com/nats-io/jwt/v2 v2.5.5/go.mod h1:ZdWS1nZa6WMZfFwwgpEaqBV8EPGVgOTDHN/wTbz0Y5A= -github.com/nats-io/nats-server/v2 v2.10.12 h1:G6u+RDrHkw4bkwn7I911O5jqys7jJVRY6MwgndyUsnE= -github.com/nats-io/nats-server/v2 v2.10.12/go.mod h1:H1n6zXtYLFCgXcf/SF8QNTSIFuS8tyZQMN9NguUHdEs= -github.com/nats-io/nats.go v1.36.0 h1:suEUPuWzTSse/XhESwqLxXGuj8vGRuPRoG7MoRN/qyU= -github.com/nats-io/nats.go v1.36.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= +github.com/nats-io/jwt/v2 v2.5.8 h1:uvdSzwWiEGWGXf+0Q+70qv6AQdvcvxrv9hPM0RiPamE= +github.com/nats-io/jwt/v2 v2.5.8/go.mod h1:ZdWS1nZa6WMZfFwwgpEaqBV8EPGVgOTDHN/wTbz0Y5A= +github.com/nats-io/nats-server/v2 v2.10.20 h1:CXDTYNHeBiAKBTAIP2gjpgbWap2GhATnTLgP8etyvEI= +github.com/nats-io/nats-server/v2 v2.10.20/go.mod h1:hgcPnoUtMfxz1qVOvLZGurVypQ+Cg6GXVXjG53iHk+M= +github.com/nats-io/nats.go v1.37.0 h1:07rauXbVnnJvv1gfIyghFEo6lUcYRY0WXc3x7x0vUxE= +github.com/nats-io/nats.go v1.37.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI= github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= @@ -954,8 +951,8 @@ golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= -golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1087,8 +1084,8 @@ golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= diff --git a/internal/bioscfg/bioscfg.go b/internal/bioscfg/bioscfg.go index 5a25cfe..50a1d9a 100644 --- a/internal/bioscfg/bioscfg.go +++ b/internal/bioscfg/bioscfg.go @@ -2,7 +2,6 @@ package bioscfg import ( "context" - "time" "github.com/metal-toolbox/bioscfg/internal/config" "github.com/metal-toolbox/bioscfg/internal/store/fleetdb" @@ -14,7 +13,6 @@ import ( var ( pkgName = "internal/bioscfg" - retries = 5 ) // BiosCfg BiosCfg Controller Struct @@ -75,33 +73,26 @@ func (bc *BiosCfg) initDependences(ctx context.Context) error { } func (bc *BiosCfg) initNats(ctx context.Context) error { - var err error - - for i := range retries { - bc.nc = ctrl.NewNatsController( - string(rctypes.BiosControl), - bc.cfg.FacilityCode, - string(rctypes.BiosControl), - bc.cfg.Endpoints.Nats.URL, - bc.cfg.Endpoints.Nats.CredsFile, - rctypes.BiosControl, - ctrl.WithConcurrency(bc.cfg.Concurrency), - ctrl.WithKVReplicas(bc.cfg.Endpoints.Nats.KVReplicationFactor), - ctrl.WithLogger(bc.logger.Logger), - ctrl.WithConnectionTimeout(bc.cfg.Endpoints.Nats.ConnectTimeout), - ) - - err = bc.nc.Connect(ctx) - if err == nil { - return nil - } + bc.nc = ctrl.NewNatsController( + string(rctypes.BiosControl), + bc.cfg.FacilityCode, + string(rctypes.BiosControl), + bc.cfg.Endpoints.Nats.URL, + bc.cfg.Endpoints.Nats.CredsFile, + rctypes.BiosControl, + ctrl.WithConcurrency(bc.cfg.Concurrency), + ctrl.WithKVReplicas(bc.cfg.Endpoints.Nats.KVReplicationFactor), + ctrl.WithLogger(bc.logger.Logger), + ctrl.WithConnectionTimeout(bc.cfg.Endpoints.Nats.ConnectTimeout), + ) + err := bc.nc.Connect(ctx) + if err != nil { bc.logger.Error(err) - bc.logger.Warnf("Attempt %d of %d failed. Trying again . . .", i, retries) - time.Sleep(time.Duration(i) * time.Second) + return err } - return err + return nil } func (bc *BiosCfg) initFleetDB(ctx context.Context) error {