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

Move linting to a Github action for better integration #30985

Merged
merged 3 commits into from
Mar 24, 2022

Conversation

rdner
Copy link
Member

@rdner rdner commented Mar 24, 2022

What does this PR do?

Now the linting issues will be displayed in the PR diff on Github and
one can see the issues inline during the review.

Why is it important?

After getting some feedback related to #30896
and some testing of the Github action in elastic/elastic-agent-libs#30 the solution how to make this setup reliable was found and now we can switch to the Github action.

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.

Logs

Now the linting issues will be displayed in the PR diff on Github and
one can see the issues inline during the review.
@rdner rdner requested a review from a team as a code owner March 24, 2022 08:21
@rdner rdner self-assigned this Mar 24, 2022
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label Team:Automation Label for the Observability productivity team and removed needs_team Indicates that the issue/PR needs a Team:* label labels Mar 24, 2022
@rdner rdner added needs_team Indicates that the issue/PR needs a Team:* label Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Mar 24, 2022
@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 Mar 24, 2022
@mergify
Copy link
Contributor

mergify bot commented Mar 24, 2022

This pull request does not have a backport label. Could you fix it @rdner? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Mar 24, 2022
@rdner rdner requested a review from cmacknz March 24, 2022 08:24
@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 24, 2022

💚 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-03-24T08:37:02.195+0000

  • Duration: 67 min 30 sec

Test stats 🧪

Test Results
Failed 0
Passed 22523
Skipped 1940
Total 24463

💚 Flaky test report

Tests succeeded.

🤖 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!)

@@ -134,6 +134,7 @@ The list below covers the major changes between 7.0.0-rc2 and main only.
- Add gcp firestore metricset. {pull}29918[29918]
- Added TESTING_FILEBEAT_FILEPATTERN option for filebeat module pytests {pull}30103[30103]
- Add gcp dataproc metricset. {pull}30008[30008]
- Add Github action for linting
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is needed, we have not been filled any details in the changelog related to the CI/CD, if it helps

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I put it there the last time I changed the CI. Since it's just for developers, I think it would not hurt.

@rdner rdner merged commit a3e55a4 into elastic:main Mar 24, 2022
@rdner rdner deleted the linting-github-action branch March 24, 2022 09:51
Comment on lines +18 to +20
- GOOS: windows
- GOOS: linux
- GOOS: darwin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rdner, is there any specific platform dependency while running golang-lint on windows and darwin? If so, I see down below the runs-on: ubuntu-latest, is that expected while running on windows/darwin too? I wonder if this matrix could be reduced to one OS (linux) if the outcome is the same for the other two platforms

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@v1v We have to run the linter against every platform (GOOS) we have any Go code for, otherwise any platform-specific code is not inspected and issues are not reported.

It does not matter on which OS it's running physically (ubuntu-latest), it's just an environment variable that tells the Go compiler which files to compile.

For Darwin we have these:

./metricbeat/internal/metrics/memory/memory_darwin.go
./metricbeat/internal/metrics/cpu/metrics_darwin.go
./auditbeat/module/file_integrity/fileorigin_darwin.go
./libbeat/statestore/backend/memlog/util_darwin.go
./libbeat/metric/system/process/process_darwin.go
./x-pack/osquerybeat/ext/osquery-extension/main_darwin.go

For Windows we have these:

./metricbeat/module/windows/service/zservice_windows.go
./metricbeat/module/windows/service/defs_service_windows.go
./metricbeat/internal/metrics/memory/memory_windows.go
./metricbeat/internal/metrics/cpu/metrics_windows.go
./metricbeat/internal/sysinit/system_windows.go
./metricbeat/helper/privileges_windows.go
./metricbeat/helper/dialer/dialer_windows.go
./metricbeat/helper/windows/pdh/zpdh_windows.go
./metricbeat/helper/windows/pdh/pdh_windows.go
./metricbeat/helper/windows/pdh/pdh_query_windows.go
./metricbeat/helper/windows/pdh/defs_pdh_windows.go
./filebeat/input/file/identifier_test_windows.go
./filebeat/input/file/identifier_inode_deviceid_windows.go
./filebeat/input/default-inputs/inputs_windows.go
./filebeat/input/filestream/fswatch_test_non_windows.go
./filebeat/input/filestream/identifier_inode_deviceid_windows.go
./filebeat/input/filestream/filestream_test_non_windows.go
./filebeat/input/filestream/identifier_test_non_windows.go
./auditbeat/module/file_integrity/fileinfo_windows.go
./auditbeat/module/file_integrity/security_windows.go
./auditbeat/module/file_integrity/zsecurity_windows.go
./winlogbeat/checkpoint/file_windows.go
./winlogbeat/sys/winevent/sid_windows.go
./winlogbeat/sys/wineventlog/syscall_windows.go
./winlogbeat/sys/wineventlog/zsyscall_windows.go
./winlogbeat/sys/wineventlog/wineventlog_windows.go
./winlogbeat/eventlog/errors_windows.go
./packetbeat/npcap/npcap_windows.go
./packetbeat/procs/syscall_windows.go
./packetbeat/procs/zsyscall_windows.go
./packetbeat/procs/procs_windows.go
./libbeat/logp/eventlog_windows.go
./libbeat/statestore/backend/memlog/util_windows.go
./libbeat/processors/decode_xml_wineventlog/decoder_windows.go
./libbeat/common/file/helper_windows.go
./libbeat/common/file/fileinfo_windows.go
./libbeat/common/file/stderr_windows.go
./libbeat/common/file/file_windows.go
./libbeat/api/npipe/listener_windows.go
./libbeat/api/make_listener_windows.go
./libbeat/service/service_windows.go
./libbeat/metric/system/numcpu/cpu_windows.go
./libbeat/metric/system/diskio/diskstat_windows.go
./libbeat/metric/system/process/process_windows.go
./x-pack/osquerybeat/ext/osquery-extension/main_windows.go
./x-pack/osquerybeat/internal/install/install_windows.go
./x-pack/osquerybeat/internal/osqd/osqueryd_windows.go
./x-pack/auditbeat/module/system/package/package_windows.go
./x-pack/winlogbeat/module/testing_windows.go
./x-pack/packetbeat/npcap/npcap_windows.go
./x-pack/libbeat/common/proc/job_windows.go

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification! It makes totally sense now :)

kush-elastic pushed a commit to kush-elastic/beats that referenced this pull request May 2, 2022
Now the linting issues will be displayed in the PR diff on Github and
one can see the issues inline during the review.
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
Now the linting issues will be displayed in the PR diff on Github and
one can see the issues inline during the review.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify enhancement Team:Automation Label for the Observability productivity team 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.

None yet

3 participants