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

Check submodule hash consistency #229

Merged
merged 7 commits into from
Feb 10, 2025
9 changes: 9 additions & 0 deletions .github/workflows/general-ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,22 @@ jobs:
cd $GITHUB_WORKSPACE/CESM/components/mom/
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }}
git checkout pr-${{ github.event.pull_request.number }}
git submodule update --init --recursive

- name: Checkout initial event (Push)
if: ${{ github.event_name == 'push' }}
run: |
echo "Handling push"
cd $GITHUB_WORKSPACE/CESM/components/mom/
git checkout ${{ github.sha }}
git submodule update --init --recursive

- name: Check submodule hash consistency
run: |
echo "Checking if .gitmodules and external hashes are consistent"
cd $GITHUB_WORKSPACE/CESM/components/mom/
../../bin/git-fleximod update
Copy link
Contributor

Choose a reason for hiding this comment

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

Alper - you can also do ../../bin/git-fleximod test at this point. Instead of update and then git diff.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just ran the following in a clean checkout of the MOM_interface tag used in beta05:

$ git submodule update --init
Submodule 'MOM6' (https://github.com/NCAR/MOM6.git) registered for path 'MOM6'
Submodule 'MARBL' (https://github.com/marbl-ecosys/MARBL.git) registered for path 'externals/MARBL'
Submodule 'stochastic_physics' (https://github.com/ESCOMP/stochastic_physics.git) registered for path 'externals/stochastic_physics'
Cloning into '/glade/work/mlevy/codes/mi_tmp/MOM6'...
Cloning into '/glade/work/mlevy/codes/mi_tmp/externals/MARBL'...
Cloning into '/glade/work/mlevy/codes/mi_tmp/externals/stochastic_physics'...
Submodule path 'MOM6': checked out '8feb16278d3dbeb22e4902257d2dcf6560a49e06'
Submodule path 'externals/MARBL': checked out '2c04fb23d0ee9ceef6d61f1021652ccab62e8324'
Submodule path 'externals/stochastic_physics': checked out 'ba1dc9d73da5ede3927fd3cdcc38ab2db0a212e5'
$ /path/to/git-fleximod test
s                 MOM6 dev/ncar_250128 8feb16278 is out of sync with .gitmodules dev/ncar_241122b
          e        pkg/CVMix-src has no fxtag defined in .gitmodules
          e      pkg/GSW-Fortran has no fxtag defined in .gitmodules
    stochastic_physics at tag ocn_skeb_240807
                 MARBL at tag marbl0.48.2

and that returns with a non-zero exit code. So there seem to be two options for testing:

  1. use git-fleximod update to checkout the submodules, and then do a git diff to make sure the submodules are consistent with what git is expecting
  2. use git to checkout submodules, and then use git-fleximod test to check if they match what fleximod expects.

I don't have a preference for one method over the other

git diff --exit-code
Copy link
Collaborator

Choose a reason for hiding this comment

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

Talking with @jedwards4b, it sounds like ../../bin/git-fleximod test would be better than my proposed git diff --exit-code here. Though I'm not sure how it works, because running it in my sandbox I see

$ ../../bin/git-fleximod test
                  MOM6 at tag dev/ncar_241122b
          e        pkg/CVMix-src has no fxtag defined in .gitmodules, module at 87c3c0c
          e      pkg/GSW-Fortran has no fxtag defined in .gitmodules, module at 29e64d6
    stochastic_physics at tag ocn_skeb_240807
                 MARBL at tag marbl0.48.2

dev/ncar_241122b is the right tag from git-fleximod's perspective, but it's a problem because it's not what git submodules expects


# Build the standalone mom using the ubuntu script.
- name: Build Standalone MOM
Expand Down