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

switching checkout repo; fixing bug in branch checkout #131

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

cwhitlock-NOAA
Copy link
Collaborator

Describe your changes

Replaced gitlab checkout with github checkout; fixed bug in checkout that hard-coded branch="main"

Issue ticket number and link (if applicable)

Checklist before requesting a review

  • [ x] I ran my code
  • [ x] I tried to make my code readable
  • [ x] I tried to comment my code
  • I wrote a new test, if applicable
  • I wrote new instructions/documentation, if applicable
  • [ x] I ran pytest and inspected it's output
  • I ran pylint and attempted to implement some of it's feedback

This probably does deserve a pytest test for teh branch checkout, but that's another to-do item

@ilaflott
Copy link
Member

i completely agree that fre pp checkout needs a test. This shouldn't be too bad, but i do wonder if github actions will let us do it.

the test would look like one of the other clirunner() tests, and it would check for the cloned repo directory, AND that the directory is non-empty.

def test_pp_checkout():
    result = runner.invoke(fre.fre, args=["pp checkout", otherarg1, otherarg2])
    assert all( [ result.exit_code == 0,
                  pathlib.Path('./fre-workflows').exists(),
                  <some way to make sure dir not empty>
                 ] )

Copy link
Member

@ilaflott ilaflott left a comment

Choose a reason for hiding this comment

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

lets try writing the test for checkout, and see if github will let us run it in CI/CD.

if github doesn't, learning how to skip the test if python notices it's running in a CI/CD is also a good thing, i imagine.

@cwhitlock-NOAA
Copy link
Collaborator Author

cwhitlock-NOAA commented Jul 27, 2024 via email

@ilaflott
Copy link
Member

> I'd also like to check for something more than is-present and is-not-empty

admirable- but lets grapple with that after we author a basic check! a simple, yet imperfect check, is better than no check!

> the bugfix is in response to checking out the wrong branch (was hard-coded to "main").

what bug? confused!

> This might be a misuse of the "protected branch" function - but if we kept around a branch that wasn't named "main" in the workflows repo, I can check against that to make sure that the checks are working.

still confused. we do expect to have more than one branch for the workflows repo in general FYI.

> And the branch-specific checkouts are needed for running the workflow regtests - you need to have the current branch you are referring to referenced by the checkout, not the main branch of the workflows repo. Getting the checkout tests working here is an incremental step towards getting the workflow tests working there.

let's start with any branch checkout being tested first, merge this code in with that check ASAP if possible, and then we can

Copy link
Collaborator

@ceblanton ceblanton left a comment

Choose a reason for hiding this comment

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

Looks good to me. It's possible we want to eventually make the default tag the same tag of fre-cli, like 2024.01. The main branch might be too cutting edge someday once people are using the definitions.

@ceblanton
Copy link
Collaborator

Completely agree with @ilaflott 's suggestions for increasing test coverage for fre pp checkout.

@ceblanton
Copy link
Collaborator

> I'd also like to check for something more than is-present and is-not-empty

admirable- but lets grapple with that after we author a basic check! a simple, yet imperfect check, is better than no check!

> the bugfix is in response to checking out the wrong branch (was hard-coded to "main").

what bug? confused!

> This might be a misuse of the "protected branch" function - but if we kept around a branch that wasn't named "main" in the workflows repo, I can check against that to make sure that the checks are working.

still confused. we do expect to have more than one branch for the workflows repo in general FYI.

> And the branch-specific checkouts are needed for running the workflow regtests - you need to have the current branch you are referring to referenced by the checkout, not the main branch of the workflows repo. Getting the checkout tests working here is an incremental step towards getting the workflow tests working there.

let's start with any branch checkout being tested first, merge this code in with that check ASAP if possible, and then we can

For now, I don't think we should (or can, really) validate which branch fre pp checkout is checking out. Eventually though, we want more safety guardrails to ensure consistent behavior (i.e. compatibility between the fre-cli version and the fre-workflows version).

@ceblanton
Copy link
Collaborator

I noted the desired tests in a new issue, #136. I'm going to merge this small update since we need it for fre/2024.01

@ceblanton
Copy link
Collaborator

@ilaflott I was going to merge but our rules prevent it! This is probably a good feature.

New tests for fre pp checkout are tracked in #136. Can you approve this PR as is?

@ilaflott ilaflott merged commit fb6b822 into main Jul 30, 2024
3 checks passed
@ilaflott ilaflott deleted the 122.github.checkout branch July 30, 2024 16:01
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.

3 participants