Skip to content

Commit

Permalink
[7.x] chore: update-beats goal to bump the go version (backport #5778) (
Browse files Browse the repository at this point in the history
#5811)

* chore: update-beats goal to bump the go version (#5778)

(cherry picked from commit bcd5bb6)

# Conflicts:
#	.ci/scripts/update-beats.sh
#	README.md

* fix merge conflict

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
Co-authored-by: Andrew Wilkins <axw@elastic.co>
  • Loading branch information
3 people authored Jul 28, 2021
1 parent 613849d commit dc2d955
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
18 changes: 18 additions & 0 deletions .ci/scripts/update-beats.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
#
# This script is executed by the automation we are putting in place
# and it requires the git add/commit commands.
#
set -euo pipefail

make update-beats
COMMIT_MESSAGE="Update to elastic/beats@$(go list -m -f {{.Version}} github.com/elastic/beats/... | cut -d- -f3)"

git checkout -b "update-beats-$(date "+%Y%m%d%H%M%S")"
git add go.mod go.sum NOTICE.txt .go-version docs/version.asciidoc
find . -maxdepth 2 -name Dockerfile -exec git add {} \;

git diff --staged --quiet || git commit -m "$COMMIT_MESSAGE"
git --no-pager log -1

echo "You can now push and create a Pull Request"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ html_docs
/docker-compose.override.yml
/config.mk
/systemtest/logs
docker-compose.yml.bck
docker-compose.yml.bck
Dockerfile.bck
version.asciidoc.bck
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@ update-beats: update-beats-module update
.PHONY: update-beats-module
update-beats-module:
$(GO) get -d -u $(BEATS_MODULE)@$(BEATS_VERSION) && $(GO) mod tidy
diff -u .go-version $$($(GO) list -m -f {{.Dir}} $(BEATS_MODULE))/.go-version \
|| { code=$$?; echo ".go-version out of sync with Beats"; exit $$code; }
cp -f $$($(GO) list -m -f {{.Dir}} $(BEATS_MODULE))/.go-version .go-version
find . -maxdepth 2 -name Dockerfile -exec sed -i'.bck' -E -e "s#(FROM golang):[0-9]+\.[0-9]+\.[0-9]+#\1:$$(cat .go-version)#g" {} \;
sed -i'.bck' -E -e "s#(:go-version): [0-9]+\.[0-9]+\.[0-9]+#\1: $$(cat .go-version)#g" docs/version.asciidoc

##############################################################################
# Kibana synchronisation.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To get started with APM please see our [Getting Started Guide](https://www.elast

### Requirements

* [Golang](https://golang.org/dl/) 1.16.5
* [Golang](https://golang.org/dl/) 1.16.x

### Install

Expand Down

0 comments on commit dc2d955

Please sign in to comment.