beats icon indicating copy to clipboard operation
beats copied to clipboard

[automation] Update go release version 1.18.5

Open apmmachine opened this issue 3 years ago • 7 comments

What

Bump go release version with the latest release.

Further details

See changelog for 1.18.5

It requires the version to be bumped first in golang-crossbuild project, then a new release will be added to https://github.com/elastic/golang-crossbuild/releases. Otherwise it will fail until the docker images are available.

Automatically generated from https://apm-ci.elastic.co/job/apm-shared/job/bump-go-release-version-pipeline/

apmmachine avatar Aug 02 '22 09:08 apmmachine

: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: 2022-08-11T18:10:19.768+0000

  • Duration: 132 min 11 sec

Test stats :test_tube:

Test Results
Failed 0
Passed 22559
Skipped 1937
Total 24496

:green_heart: Flaky test report

Tests succeeded.

:robot: GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

elasticmachine avatar Aug 02 '22 11:08 elasticmachine

Build should be fixed after merging https://github.com/elastic/beats/pull/32653.

cmacknz avatar Aug 10 '22 17:08 cmacknz

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

elasticmachine avatar Aug 10 '22 17:08 elasticmachine

The linter failure looks like it is due to errorlint incorrectly handling cases where it expects a fmt verb but there is none. This should not be true, but in case it is, this should fix it

diff --git a/winlogbeat/sys/wineventlog/query.go b/winlogbeat/sys/wineventlog/query.go
index 8b82260042..edb8ced592 100644
--- a/winlogbeat/sys/wineventlog/query.go
+++ b/winlogbeat/sys/wineventlog/query.go
@@ -19,6 +19,7 @@ package wineventlog
 
 import (
        "bytes"
+       "errors"
        "fmt"
        "regexp"
        "strconv"
@@ -75,7 +76,7 @@ type Query struct {
 func (q Query) Build() (string, error) {
        var errs multierror.Errors
        if q.Log == "" {
-               errs = append(errs, fmt.Errorf("empty log name"))
+               errs = append(errs, errors.New("empty log name"))
        }
 
        qp := &queryParams{Path: q.Log}
diff --git a/winlogbeat/sys/wineventlog/wineventlog_windows.go b/winlogbeat/sys/wineventlog/wineventlog_windows.go
index ffa7a2ae15..610596805d 100644
--- a/winlogbeat/sys/wineventlog/wineventlog_windows.go
+++ b/winlogbeat/sys/wineventlog/wineventlog_windows.go
@@ -190,7 +190,7 @@ func EvtSeek(resultSet EvtHandle, position int64, bookmark EvtHandle, flags EvtS
 // when finished with the handle.
 func EventHandles(subscription EvtHandle, maxHandles int) ([]EvtHandle, error) {
        if maxHandles < 1 {
-               return nil, fmt.Errorf("maxHandles must be greater than 0")
+               return nil, fmt.Errorf("maxHandles must be greater than 0: %d", maxHandles)
        }
 
        eventHandles := make([]EvtHandle, maxHandles)

This does not fix it. I will investigate.

OK, the issue is that errorlint does not correctly parse indexed fmt verbs when they have a verb modifier. The following diff works around this at the cost of repetition (the diff above is not needed to fix the issue, but is nice to have).

diff --git a/winlogbeat/sys/wineventlog/publisher_metadata.go b/winlogbeat/sys/wineventlog/publisher_metadata.go
index 64972c5080..559c547a8c 100644
--- a/winlogbeat/sys/wineventlog/publisher_metadata.go
+++ b/winlogbeat/sys/wineventlog/publisher_metadata.go
@@ -549,7 +549,7 @@ type EventMetadataIterator struct {
 func NewEventMetadataIterator(publisher *PublisherMetadata) (*EventMetadataIterator, error) {
        eventMetadataEnumHandle, err := _EvtOpenEventMetadataEnum(publisher.Handle, 0)
        if err != nil && err != windows.ERROR_FILE_NOT_FOUND { //nolint:errorlint // Bad linter! This is always errno or nil.
-               return nil, fmt.Errorf("failed to open event metadata enumerator with EvtOpenEventMetadataEnum: %w (%#[1]v)", err)
+               return nil, fmt.Errorf("failed to open event metadata enumerator with EvtOpenEventMetadataEnum: %w (%#v)", err, err)
        }
 
        return &EventMetadataIterator{
diff --git a/winlogbeat/sys/wineventlog/syscall_windows.go b/winlogbeat/sys/wineventlog/syscall_windows.go
index 9364f8641a..2d332e49d0 100644
--- a/winlogbeat/sys/wineventlog/syscall_windows.go
+++ b/winlogbeat/sys/wineventlog/syscall_windows.go
@@ -547,7 +547,7 @@ func EvtGetPublisherMetadataProperty(publisherMetadataHandle EvtHandle, property
        var bufferUsed uint32
        err := _EvtGetPublisherMetadataProperty(publisherMetadataHandle, propertyID, 0, 0, nil, &bufferUsed)
        if err != windows.ERROR_INSUFFICIENT_BUFFER { //nolint:errorlint // Bad linter! This is always errno or nil.
-               return "", fmt.Errorf("expected ERROR_INSUFFICIENT_BUFFER but got %w (%#[1]v)", err)
+               return "", fmt.Errorf("expected ERROR_INSUFFICIENT_BUFFER but got %w (%#v)", err, err)
        }
 
        buf := make([]byte, bufferUsed)
@@ -609,7 +609,7 @@ func GetEventMetadataProperty(metadataHandle EvtHandle, propertyID EvtEventMetad
        var bufferUsed uint32
        err := _EvtGetEventMetadataProperty(metadataHandle, 8, 0, 0, nil, &bufferUsed)
        if err != windows.ERROR_INSUFFICIENT_BUFFER { //nolint:errorlint // Bad linter! This is always errno or nil.
-               return nil, fmt.Errorf("expected ERROR_INSUFFICIENT_BUFFER but got %w (%#[1]v)", err)
+               return nil, fmt.Errorf("expected ERROR_INSUFFICIENT_BUFFER but got %w (%#v)", err, err)
        }
 
        buf := make([]byte, bufferUsed)

efd6 avatar Aug 10 '22 22:08 efd6

Thanks @efd6 for the linter fix! That should be the last problem to resolve before being able to merge this.

cmacknz avatar Aug 11 '22 18:08 cmacknz

It's worth noting that this is a general failure though I suppose not many people use indexed verbs.

I have filed an issue against polyfloyd/go-errorlint which is now fixed there in v1.0.1 and that will presumably wend its way into golangci-lint at some stage.

efd6 avatar Aug 11 '22 22:08 efd6

E2E test failures seem unrelated, the same failures are present on other branches.

cmacknz avatar Aug 12 '22 14:08 cmacknz

Follow up issue to improve the error messages from Kafka in this case: https://github.com/elastic/beats/issues/32692

cmacknz avatar Aug 15 '22 14:08 cmacknz