elastic / stream

Test utility for streaming data via udp/tcp/tls/webhook/GCP Pub-Sub/Kafka.
https://container-library.elastic.co/r/observability/stream
Apache License 2.0
8 stars 13 forks source link

golang: bump automation with updatecli and GH actions #53

Closed v1v closed 1 year ago

v1v commented 1 year ago

What does this PR do?

Automate the golang bump within the project itself using updatecli and github actions

Why is it important?

Remove the dependency with Jenkins and the definition of what to do in apm-pipeline-library

Use updatecli that provides the tooling for bumping versions

Issues

Similar to https://github.com/elastic/beats/pull/34458

Test

GIT_USER=*** \
GIT_EMAIL=*** \
updatecli diff --config .ci/bump-golang.yml

does nothing in terms of changing if no a new version.

if a new version is available then it bumps all those files as expected

Expand to view

``` +++++++++++ + PREPARE + +++++++++++ Loading Pipeline ".ci/bump-golang.yml" SCM repository retrieved: 1 ++++++++++++++++++ + AUTO DISCOVERY + ++++++++++++++++++ ++++++++++++ + PIPELINE + ++++++++++++ ######################################### # BUMP GOLANG-VERSION TO LATEST VERSION # ######################################### SOURCES ======= latestGoVersion --------------- WARNING: ⚠ No GitHub Release found, we fallback to published git tags Searching for version matching pattern "go1\\.(\\d+)(\\.(\\d+))?$" βœ” Github Release version "go1.20" found matching pattern "go1\\.(\\d+)(\\.(\\d+))?$" CHANGELOG: ---------- no GitHub Release found for go1.20 on "https://github.com/golang/go" gomod ----- The shell 🐚 command "echo 1.20" ran successfully with the following output: ---- 1.20 ---- CONDITIONS: =========== dockerTag --------- βœ” The Docker image index.docker.io/library/golang:1.20 (amd64) exists and is available. goDefaultVersion-check ---------------------- The shell 🐚 command "grep -v -q 1.20 .go-version # 1.20" ran successfully with the following output: ---- ---- TARGETS ======== update-dockerfiles ------------------ **Dry Run enabled** ⚠ updated the [dry run] content of the file "/var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/stream/Dockerfile" --- /var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/stream/Dockerfile +++ /var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/stream/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.19.5 as builder +FROM golang:1.20 as builder RUN apt-get update \ && apt-get dist-upgrade -y \ update-go-version ----------------- **Dry Run enabled** ⚠ updated the [dry run] content of the file "/var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/stream/.go-version" --- /var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/stream/.go-version +++ /var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/stream/.go-version @@ -1 +1 @@ -1.19.5 +1.20 update-gomod ------------ **Dry Run enabled** ⚠ updated the [dry run] content of the file "/var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/stream/go.mod" --- /var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/stream/go.mod +++ /var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/stream/go.mod @@ -1,6 +1,6 @@ module github.com/elastic/stream -go 1.19 +go 1.20 require ( cloud.google.com/go/pubsub v1.25.1 ACTIONS ======== WARNING: **Fallback** Please add a title to you configuration using the field 'title: ' [Dry Run] An action of kind "github/pullrequest" is expected. ============================= REPORTS: ⚠ Bump golang-version to latest version: Source: βœ” [gomod] Get version in go.mod format (kind: shell) βœ” [latestGoVersion] Get Latest Go Release (kind: githubrelease) Condition: βœ” [dockerTag] Is docker image golang:1.20 published (kind: dockerimage) βœ” [goDefaultVersion-check] Check if defined golang version differs (kind: shell) Target: ⚠ [update-dockerfiles] Update from dockerfiles (kind: file) ⚠ [update-go-version] Update .go-version (kind: file) ⚠ [update-gomod] Update go.mod (kind: file) Run Summary =========== Pipeline(s) run: * Changed: 1 * Failed: 0 * Skipped: 0 * Succeeded: 0 * Total: 1 ```

https://github.com/elastic/beats/pull/34486 was created to test these changes

elasticmachine commented 1 year ago

:green_heart: Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

#### Build stats * Start Time: 2023-02-07T08:27:01.978+0000 * Duration: 5 min 12 sec #### Test stats :test_tube: | Test | Results | | ------------ | :-----------------------------: | | Failed | 0 | | Passed | 21 | | Skipped | 0 | | Total | 21 |

:robot: GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with: - `/test` : Re-trigger the build.

amannocci commented 1 year ago

Do we want to bump the version to the latest go version or the latest go minor version?

v1v commented 1 year ago

Do we want to bump the version to the latest go version or the latest go minor version?

There was no go minor version set in https://github.com/elastic/apm-pipeline-library/blob/d592c5e95a467213bb6f97ed24fe0cf5068d9ea7/.ci/.bump-go-release-version.yml#L99-L104 so It gets the latest available minor version