Skip to content

Commit

Permalink
Fixes broken builds on 1.3 branch following pattern from master (#80)
Browse files Browse the repository at this point in the history
* Pin Golang version to 1.15 (#79)

* Pin Go version to 1.15

Later versions fail build because of module checksum validation of collectd.org.

* Remove duplicated dependency

Sadly using GH repo for collectd.org dependency did not fix the checksum issue.

* Stop generating go.sum

* Regenerate go.sum

* Don't regenerate go.sum in integration tests

* Fix older apputils hash in go.sum

Co-authored-by: Martin Mágr <[email protected]>
  • Loading branch information
csibbitt and paramite authored Dec 17, 2021
1 parent b32f58a commit 9715bea
Show file tree
Hide file tree
Showing 7 changed files with 567 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.15'
- name: Verify image builds
run: |
docker build --tag infrawatch/sg-core:latest --file build/Dockerfile .
Expand Down
13 changes: 7 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

base=$(pwd)

GOCMD=${GOCMD:-"go"}
PLUGIN_DIR=${PLUGIN_DIR:-"/tmp/plugins/"}
CONTAINER_BUILD=${CONTAINER_BUILD:-false}

Expand Down Expand Up @@ -60,7 +61,7 @@ build_plugins() {
search_list "$(basename $i)" OMIT_TRANSPORTS
if [ $? -ne 1 ]; then
echo "building $(basename $i).so"
go build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
$GOCMD build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
fi
done

Expand All @@ -71,7 +72,7 @@ build_plugins() {
search_list "$(basename $i)" OMIT_HANDLERS
if [ $? -ne 1 ]; then
echo "building $(basename $i).so"
go build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
$GOCMD build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
fi
done

Expand All @@ -82,7 +83,7 @@ build_plugins() {
search_list "$(basename $i)" OMIT_APPLICATIONS
if [ $? -ne 1 ]; then
echo "building $(basename $i).so"
go build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
$GOCMD build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
fi
done
}
Expand All @@ -92,9 +93,9 @@ build_core() {
cd "$base"
if $CONTAINER_BUILD; then
echo "building sg-core for container"
go build -o /tmp/sg-core cmd/*.go
else
go build -o sg-core cmd/*.go
$GOCMD build -o /tmp/sg-core cmd/*.go
else
$GOCMD build -o sg-core cmd/*.go
fi
}

Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ COPY . $D/
COPY build/repos/opstools.repo /etc/yum.repos.d/opstools.repo

RUN dnf install golang git qpid-proton-c-devel -y --setopt=tsflags=nodocs
RUN PRODUCTION_BUILD=true ./build.sh
RUN go install golang.org/dl/go1.15@latest && /go/bin/go1.15 download && PRODUCTION_BUILD=true GOCMD=/go/bin/go1.15 ./build.sh

# --- end build, create smart gateway layer ---
FROM registry.access.redhat.com/ubi8-minimal:latest
Expand Down
6 changes: 4 additions & 2 deletions ci/integration/logging/run_sg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ dnf install -y git golang gcc make qpid-proton-c-devel
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

go install golang.org/dl/go1.15@latest
go1.15 download

# install sg-core and start sg-core
go mod tidy
mkdir -p /usr/lib64/sg-core
PLUGIN_DIR=/usr/lib64/sg-core/ ./build.sh
PLUGIN_DIR=/usr/lib64/sg-core/ GOCMD=go1.15 ./build.sh

./sg-core -config ./ci/integration/logging/sg_config.yaml
7 changes: 5 additions & 2 deletions ci/unit/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ yum install -y git golang gcc make glibc-langpack-en qpid-proton-c-devel
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

go mod tidy
go test -v -coverprofile=profile.cov ./...
go install golang.org/dl/go1.15@latest
go1.15 download


go1.15 test -v -coverprofile=profile.cov ./...
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.15

require (
collectd.org v0.5.0
github.com/Azure/go-amqp v0.13.9 // indirect
github.com/elastic/go-elasticsearch/v7 v7.10.0
github.com/go-openapi/errors v0.20.0
github.com/go-playground/universal-translator v0.17.0 // indirect
Expand Down
546 changes: 546 additions & 0 deletions go.sum

Large diffs are not rendered by default.

0 comments on commit 9715bea

Please sign in to comment.