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

DAS-2214: Add the pre-commit file and update readme. #86

Merged
merged 9 commits into from
Aug 6, 2024

Conversation

flamingbear
Copy link
Member

@flamingbear flamingbear commented Aug 2, 2024

Description

Adds pre-commit functionality to the harmony-regression-tests repository

When pre-commit.ci is enabled: this will automatically run our pre-commit hooks for each PR.
Rather than fixing errors, it will simply fail the PR checks.

If a developer installs the pre-commit hooks themselves, they will catch errors
before they are even committed, again no fixes are automatically applied, but
the files are updated to be correct and the user can add the changes to their commit.

Additionally, I have bumped every package version by a patch version in order
to release the changes to the code. There should be no difference in how the
tests function. I have verified this but also included instructions in the
test for you do to the same.

Jira Issue ID

DAS-2214 ostensibly but mostly because I have to do significant ipython notebook writing.

Local Test Steps

Check that the commit in the .git-blame-ignore-revs file contains all of the reformatting changes.

Pull this branch.
Follow the new instructions in the README under pre-commit hooks.

To test this, make some minor change to a .py file or an .ipynb file, use git
to add the changes to a commit. You should see the checks all run when you are
trying to use git commit.

To test the all of the code changes / bumped versions.

from the test directory make and run all of the tests.

For your UAT environment set all of these variables:
export HARMONY_HOST_URL=https://harmony.uat.earthdata.nasa.gov
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export EDL_USER=
export EDL_PASSWORD=

Then make all images with:

> make images

That will take a while and then run them:

./run_notebooks.sh

Ensure all tests pass

PR Acceptance Checklist

  • [N/A] Acceptance criteria met
  • [N/A] Tests added/updated (if needed) and passing
  • Documentation updated (if needed)

@flamingbear flamingbear marked this pull request as ready for review August 2, 2024 22:11
@flamingbear
Copy link
Member Author

Mostly for awareness: @chris-durbin @ygliuvt @indiejames

This just adds auto-formatting via pre-commit hooks to our jupyter notebooks and python modules. But since you also work in here sometimes. I'm pinging you.

# Uses focal image because newer jammy image does not work with old docker versions
# see related information: https://github.com/adoptium/containers/issues/215#issuecomment-1142046045
FROM mambaorg/micromamba:1.4.2-focal
FROM mambaorg/micromamba:1.5.8-jammy
Copy link
Member Author

Choose a reason for hiding this comment

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

This updates the base image, but the old version was only because we couldn't update docker on the bamboo agents.

Copy link
Member Author

Choose a reason for hiding this comment

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

It does seem to fix some vulnerabilities as well.
Screenshot 2024-08-05 at 1 46 31 PM
Screenshot 2024-08-05 at 1 45 46 PM

README.md Outdated Show resolved Hide resolved
Copy link
Member

@owenlittlejohns owenlittlejohns 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 fixing all of this up and adding pre-commit. I ran all the regression tests locally, and they still pass. I also installed pre-commit via the new instructions, and it works as it should.

Nice!

@flamingbear
Copy link
Member Author

Close and reopen to see if I can pickup the pre-commit.ci

@flamingbear flamingbear closed this Aug 6, 2024
@flamingbear
Copy link
Member Author

reopening

@flamingbear flamingbear reopened this Aug 6, 2024
@flamingbear flamingbear merged commit d152d98 into main Aug 6, 2024
1 check passed
@flamingbear flamingbear deleted the mhs/DAS-2214/add-pre-commit-hooks branch August 6, 2024 16:57
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.

2 participants