8000 SEAB-5015: Use [skip] to run partial CI build by ll5zh · Pull Request #5833 · dockstore/dockstore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

SEAB-5015: Use [skip] to run partial CI build #5833

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

Merged
merged 22 commits into from
Apr 3, 2024
Merged

Conversation

ll5zh
Copy link
Contributor
@ll5zh ll5zh commented Mar 7, 2024

Description
When pushing non-code changes, it is ideal to save build minutes by skipping CircleCI tests. However, using the [skip ci] tag (which skips the entire pipeline) isn't always great because automatic deployment requires a build.

One solution is having the option to run a short CI. To achieve this, this PR attempts to implement a custom tag, [skipTests]: if included in the most recent commit message, CircleCI should skip all jobs excluding the actual build (i.e. skip testing-related jobs). Whether or not to skip testing is decided by an intermediate job called skip_check: CircleCI should run all tests if skip_check succeeds, and should stop after the build if skip_check fails (i.e. finds [skipTests] in the commit message).

Review Instructions
The most recent commit uses the [skipTests] tag, so: 1) the build job should succeed, and 2) skip_check should fail, meaning the remaining CI jobs should be skipped. (as of PR feedback on Mar 7 2024, the unit_test job should also succeed)

Consider the effectiveness/utility of this functionality and/or how it could be modified/improved for our purposes.

everything workflow

Other thoughts:

  • A slight drawback: if [skipTests] is used, something needs to fail in order to skip future jobs, so overall it looks like the pipeline failed. Would this interfere with the build required for deployment? (The original goal was to conditionally run steps in a job, so [skipTests] would just bypass certain actions during the run, but I haven't yet found a way to incorporate the commit message into conditional steps)
  • Are there any other jobs that, when the [skipTests] tag is used, should be run alongside the build/unit_test?
  • Open to renaming skip_check, which may seem a bit unintuitive? (i.e. it fails if it succeeds to find [skipTests], and succeeds if it fails to find [skipTests])

Issue
SEAB-5015

Security and Privacy

If there are any concerns that require extra attention from the security team, highlight them here and check the box when complete.

  • Security and Privacy assessed

e.g. Does this change...

  • Any user data we collect, or data location?
  • Access control, authentication or authorization?
  • Encryption features?

Please make sure that you've checked the following before submitting your pull request. Thanks!

  • Check that you pass the basic style checks and unit tests by running mvn clean install
  • Ensure that the PR targets the correct branch. Check the milestone or fix version of the ticket.
  • Follow the existing JPA patterns for queries, using named parameters, to avoid SQL injection
  • If you are changing dependencies, check the Snyk status check or the dashboard to ensure you are not introducing new high/critical vulnerabilities
  • Assume that inputs to the API can be malicious, and sanitize and/or check for Denial of Service type values, e.g., massive sizes
  • Do not serve user-uploaded binary images through the Dockstore API
  • Ensure that endpoints that only allow privileged access enforce that with the @RolesAllowed annotation
  • Do not create cookies, although this may change in the future
  • 8000 If this PR is for a user-facing feature, create and link a documentation ticket for this feature (usually in the same milestone as the linked issue). Style points if you create a documentation PR directly and link that instead.

@ll5zh ll5zh requested review from coverbeck and denis-yuen March 7, 2024 15:49
@ll5zh ll5zh self-assigned this Mar 7, 2024
@ll5zh
Copy link
Contributor Author
ll5zh commented Mar 7, 2024

If the additional CircleCI tests are required to merge a PR, then the most recent commit cannot contain [skip]? I guess in order to skip tests for the merge, you would include [skip] in the merge commit?

@denis-yuen
Copy link
Member

If the additional CircleCI tests are required to merge a PR, then the most recent commit cannot contain [skip]? I guess in order to skip tests for the merge, you would include [skip] in the merge commit?

Yes on both counts. I guess you can skip tests on most commits in a PR, but not the last one if you need it reviewed.
I guess you'd need "skip" in the merge commit to skip them on the merge/squash.

So not a perfect solution, but much better than before.

@denis-yuen
Copy link
Member

Open to renaming skip_check, which may seem a bit unintuitive? (i.e. it fails if it succeeds to find [skip], and succeeds if it fails to find [skip])

I think the job name is fine, I think "skip" on its own in a commit message is a bit unintuitive. From a Maven perspective, I'd like "skipTests" for example

@denis-yuen
Copy link
Member

Are there any other jobs that, when the [skip] tag is used, should be run alongside the build?

I think you'd still want to run the relatively short unit tests job.
It uploads the jar that is sometimes used for the UI

Copy link
Member
@denis-yuen denis-yuen left a comment

Choose a reason for hiding this comment

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

Some discussion, but I think in general this looks promising.

Copy link
Collaborator
@coverbeck coverbeck left a comment

Choose a reason for hiding this comment

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

Conceptually, this looks great to me. Some concerns that I'm not sure how to resolve:

  1. We'll have to remember to use it; my default muscle memory to, for example, merge a README.md only commit to develop will be to type [skip ci], and then we'll still have the problem. It would be nice if you could tell CircleCI to ignore [skip ci] on the develop branch, but I don't think there's a way.
  2. We'll have to remember its name; right now I'd have to and look for it in the config.yml file.
  3. Maybe a more "positive" name? Instead of skipTests, quickBuild (especially since you are going to be running the unit tests)?

@denis-yuen
Copy link
Member

3. Maybe a more "positive" name? Instead of skipTests, quickBuild (especially since you are going to be running the unit tests)?

Kinda prefer not making something up, but point taken on unit tests now.
We could do skipITs
https://maven.apache.org/surefire/maven-failsafe-plugin/examples/skipping-tests.html

@ll5zh ll5zh requested a review from kathy-t March 15, 2024 13:36
@ll5zh ll5zh requested review from hyunnaye and svonworl March 15, 2024 13:36
@@ -50,43 +50,47 @@ workflows:
jobs:
- build:
<<: *common_filters
- skip_check:
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm okay with the [skipTests] name in the commit message, but I find the CI job name a bit unintuitive when looking at the screenshot since the name is skip_check but it fails if you want to skip the check.

Proposing something like runFullBuild? So it fails if there's [skipTests] in the commit message and passes if there's no skipTests

echo "export COMMIT_MESSAGE=\"$(git log --format=oneline -n 1 $CIRCLE_SHA1)\"" >> $BASH_ENV
source $BASH_ENV
echo "Commit message: $COMMIT_MESSAGE"
if [[ $COMMIT_MESSAGE =~ ^.*\[skipTests\].*$ ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a built in environment variable called CIRCLE_BRANCH that contains the name of the git branch. Could add a check that ignores the skipTests condition if the branch is develop

ll5zh added 3 commits March 21, 2024 14:32
("run_full_build" seemed more like the act of running the full build, "full_build_check" = check if the full build should be run)
Copy link
sonarqubecloud bot commented Apr 1, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
codecov bot commented Apr 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.96%. Comparing base (88b32d1) to head (8152045).
Report is 20 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #5833      +/-   ##
=============================================
- Coverage      74.35%   70.96%   -3.40%     
+ Complexity      5253     5019     -234     
=============================================
  Files            364      364              
  Lines          19019    19019              
  Branches        2019     2019              
=============================================
- Hits           14142    13496     -646     
- Misses          3918     4562     +644     
- Partials         959      961       +2     
Flag Coverage Δ
bitbuckettests 27.08% <ø> (+0.01%) ⬆️
integrationtests 53.86% <ø> (-4.45%) ⬇️
languageparsingtests 10.86% <ø> (ø)
localstacktests 21.41% <ø> (ø)
toolintegrationtests 30.39% <ø> (ø)
unit-tests_and_non-confidential-tests 28.77% <ø> (ø)
workflowintegrationtests 38.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ll5zh ll5zh marked this pull request as ready for review April 1, 2024 20:18
@ll5zh
Copy link
Contributor Author
ll5zh commented Apr 1, 2024
  • Renamed the CI job to full_build_check (i.e. checks whether or not to run the full build/tests)
  • Sticking with [skipTests] as the tag name for now
  • Added a condition to ignore [skipTests] on the develop branch, to ensure the entire build is run for commits on develop

Copy link
Collaborator
@coverbeck coverbeck left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this! I'm still a little worried that we (or at least I) will continue to use skip ci, and not take advantage of this, but hopefully we'll learn over time. And there's no other option, short of this ticket getting addressed.

Copy link
Contributor
@kathy-t kathy-t left a comment

Choose a reason for hiding this comment

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

Seems like it might be worth documenting the skipTests feature somewhere so we don't forget about it, but I'm not sure where. Maybe https://github.com/dockstore/dockstore?tab=readme-ov-file#for-dockstore-developers?

@ll5zh ll5zh merged commit 9fbcd28 into develop Apr 3, 2024
@ll5zh ll5zh deleted the seab-5015/skip-build branch April 3, 2024 13:46
@ll5zh ll5zh mentioned this pull request Apr 3, 2024
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0