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

Feature #289 develop sonarqube_gha #290

Merged
merged 11 commits into from
Apr 4, 2024

Conversation

JohnHalleyGotway
Copy link
Contributor

@JohnHalleyGotway JohnHalleyGotway commented Apr 3, 2024

These PR adds SonarQube Scanning to GitHub actions, as described below:

  1. sonarqube.yml defines the new workflow that is triggered by pushes to the develop or main branches, as well as pull requests to those branches. I also added a manual workflow dispatch option, but that won't show up in GitHub until these changes are also made in the main_v2.1 branch. This workflow checks out the code, determines the current branch name, runs a script to set up the SonarQube properties file, and then calls custom actions to perform the scan and check the results.
  2. configure_sonarqube.sh customizes the sonar-project.properties settings for the current run.
  3. sonar-project.properties is updated with template values to be updated by configure_sonarqube.sh and the run_sonarqube.sh script used by the nightly build.
  4. run_sonarqube.sh is the script run during the nightly build. This is updated to handle the newly-parameterized sonar-project.properties file.
  5. Update the PR template to remind PR reviewers to check the SonarQube status.
  6. Delete the internal_tests directory since the SonarQube scanning files were moved from there to internal/scripts/sonarqube (prior to this feature branch) for consistency with other METplus repos.

Note that the scans were enhanced to include the actual code version number rather than just a hard-code string of 1.0.

Please also see this issue comment about a runtime exception. While this exception occurs when running on seneca, it DOES NOT occur when running through GitHub actions. I inspected the log from this run and see on lines 118-121 that no exception occurs:

INFO: Sensor JavaScript inside YAML analysis [javascript] (done) | time=6ms
INFO: Sensor CSS Rules [javascript]
INFO: 1 source file to be analyzed
INFO: 1/1 source file has been analyzed

Pull Request Testing

  • Describe testing already performed for these changes:

    I manually ran the SonarQube scan for both the develop and main_v2.1 branches so that they'd present in needham.rap.ucar.edu to serve as references.

  • Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:

  • Review the code changes.

  • Confirm that the SonarQube workflow runs for this PR.

  • Inspect the SonarQube server:

  • Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [Yes]
    None needed.

  • Do these changes include sufficient testing updates? [Yes]
    None needed.

  • Will this PR result in changes to the test suite? [No]

    If yes, describe the new output and/or changes to the existing output:

  • Please complete this pull request review by [Fri 4/5/24].

Pull Request Checklist

See the METplus Workflow for details.

  • Add any new Python packages to the METplus Components Python Requirements table.
  • Review the source issue metadata (required labels, projects, and milestone).
  • Complete the PR definition above.
  • Ensure the PR title matches the feature or bugfix branch name.
  • Define the PR metadata, as permissions allow.
    Select: Reviewer(s)
    Select: Organization level software support Project or Repository level development cycle Project
    Select: Milestone as the version that will include these changes
  • After submitting the PR, select the ⚙️ icon in the Development section of the right hand sidebar. Search for the issue that this PR will close and select it, if it is not already selected.
  • After the PR is approved, merge your changes. If permissions do not allow this, request that the reviewer do the merge.
  • Close the linked issue and delete your feature or bugfix branch from GitHub.

…es for SonarQube. These have been relocated to internal/scripts/sonarqube for consistency with other METplus repos. I checked the crontab entry on seneca for the met_test user that the latter version is used, and not this one I'm deleting.
@JohnHalleyGotway
Copy link
Contributor Author

@bikegeek and @jprestop, I'm moving this PR from draft to being ready for review. I think I've tied up all the loose ends. I'll submit a similar PR for the main_v2.1 branch to get these changes into the default branch... and then move on to the other METplus repos.

@JohnHalleyGotway JohnHalleyGotway marked this pull request as ready for review April 4, 2024 14:41
@bikegeek
Copy link
Collaborator

bikegeek commented Apr 4, 2024 via email

@JohnHalleyGotway
Copy link
Contributor Author

@bikegeek, yes, since it came together so quickly and easily, I think I'll try to get all of these changes in for beta4. Working on the companion PR for the main_v2.1 branch now.

@bikegeek
Copy link
Collaborator

bikegeek commented Apr 4, 2024

I will add METreformat to the list of sonar.sources in the sonar-project-properties. There are some tests for the METreformat code, so the code coverage should be >0% if the tests are getting picked up.

Copy link
Collaborator

@bikegeek bikegeek left a comment

Choose a reason for hiding this comment

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

I added METreformat to the sonar_project.properties. All the expected behaviors are observed. Approving.

@bikegeek bikegeek merged commit b18c59b into develop Apr 4, 2024
15 checks passed
@bikegeek bikegeek deleted the feature_289_develop_sonarqube_gha branch April 4, 2024 15:33
bikegeek added a commit that referenced this pull request Apr 4, 2024
* Per #289, same set of changes from PR #290, but for the main_v2.1 branch instead.

* Update sonar-project.properties

include checks for METreformat code

---------

Co-authored-by: bikegeek <3753118+bikegeek@users.noreply.github.com>
@JohnHalleyGotway JohnHalleyGotway removed the request for review from jprestop April 4, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Add GitHub action to run SonarQube for METdataio pull requests and feature branches
2 participants