Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix modified go.sum issue in beat generators #28375

Merged

Conversation

andrewkroh
Copy link
Member

@andrewkroh andrewkroh commented Oct 12, 2021

What does this PR do?

There were two issues:

go mod download was run after the newly generated beat was committed. This modified the go.sum because it
adds hashes for the downloaded dependencies. The caused mage check to fail because the git project has
pending changes.

The dependencies of package_test.go were missing from go.sum. When running mage testPackages it
was failing because github.com/blakesmith/ar and github.com/cavaliercoder/go-rpm were missing.

Why is it important?

CI is failing in the generator tests. This was failing when Go 1.17.1 was updated in #27543 (comment).

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
    - [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

PLATFORMS=linux/amd64 make -C generator/_templates/beat test test-package

Issues

Logs

 >> Testing package contents
 go: updates to go.mod needed; to update it:
 	go mod tidy
 
 package ran for 4m51.60809048s
 Error: running "go test /var/lib/jenkins/workspace/PR-28353-1-ae052b9e-d3a6-4774-8541-442abc6e8666/pkg/mod/github.com/elastic/beats/[email protected]/dev-tools/packaging/package_test.go -root-owner -files /var/lib/jenkins/workspace/PR-28353-1-ae052b9e-d3a6-4774-8541-442abc6e8666/src/beatpath/testmetricbeat/build/distributions/*" failed with exit code 1
>> Testing package contents
# command-line-arguments
../../../pkg/mod/github.com/elastic/beats/[email protected]/dev-tools/packaging/package_test.go:40:2: missing go.sum entry for module providing package github.com/cavaliercoder/go-rpm; to add:
        go mod download github.com/cavaliercoder/go-rpm
FAIL    command-line-arguments [setup failed]

There were two issues:

`go mod download` was run after the newly generated beat was committed. This modified the go.sum because it
adds hashes for the downloaded dependencies. The caused `mage check` to fail because the git project has
pending changes.

The dependencies of package_test.go were missing from go.sum. When running `mage testPackages` it
was failing because github.com/blakesmith/ar and github.com/cavaliercoder/go-rpm were missing.
@andrewkroh andrewkroh added bug :Generator Related to code generators for building custom Beats or modules. backport-v7.16.0 Automated backport with mergify labels Oct 12, 2021
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 12, 2021
@andrewkroh andrewkroh added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Oct 12, 2021
@elasticmachine
Copy link
Collaborator

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

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Oct 12, 2021
@andrewkroh andrewkroh requested a review from kvch October 12, 2021 23:47
@elasticmachine
Copy link
Collaborator

elasticmachine commented Oct 12, 2021

💚 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: 2021-10-13T01:18:33.525+0000

  • Duration: 29 min 54 sec

  • Commit: 311122b

❕ Flaky test report

No test was executed to be analysed.

🤖 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.

@andrewkroh
Copy link
Member Author

/test generator

@andrewkroh andrewkroh merged commit 81f32e7 into elastic:master Oct 18, 2021
mergify bot pushed a commit that referenced this pull request Oct 18, 2021
* Fix modified go.sum issue in beat generators

There were two issues:

`go mod download` was run after the newly generated beat was committed. This modified the go.sum because it
adds hashes for the downloaded dependencies. The caused `mage check` to fail because the git project has
pending changes.

The dependencies of package_test.go were missing from go.sum. When running `mage testPackages` it
was failing because github.com/blakesmith/ar and github.com/cavaliercoder/go-rpm were missing.

* Re-enable generator tests

Relates #28361

(cherry picked from commit 81f32e7)
andrewkroh added a commit that referenced this pull request Oct 18, 2021
* Fix modified go.sum issue in beat generators

There were two issues:

`go mod download` was run after the newly generated beat was committed. This modified the go.sum because it
adds hashes for the downloaded dependencies. The caused `mage check` to fail because the git project has
pending changes.

The dependencies of package_test.go were missing from go.sum. When running `mage testPackages` it
was failing because github.com/blakesmith/ar and github.com/cavaliercoder/go-rpm were missing.

* Re-enable generator tests

Relates #28361

(cherry picked from commit 81f32e7)

Co-authored-by: Andrew Kroh <[email protected]>
Icedroid pushed a commit to Icedroid/beats that referenced this pull request Nov 1, 2021
* Fix modified go.sum issue in beat generators

There were two issues:

`go mod download` was run after the newly generated beat was committed. This modified the go.sum because it
adds hashes for the downloaded dependencies. The caused `mage check` to fail because the git project has
pending changes.

The dependencies of package_test.go were missing from go.sum. When running `mage testPackages` it
was failing because github.com/blakesmith/ar and github.com/cavaliercoder/go-rpm were missing.

* Re-enable generator tests

Relates elastic#28361
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v7.16.0 Automated backport with mergify bug :Generator Related to code generators for building custom Beats or modules. Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants