ESMCI / git-fleximod

MIT License
2 stars 2 forks source link

An improper hash/tag needs to abort, but instead appears to run fine #32

Closed cacraigucar closed 3 months ago

cacraigucar commented 3 months ago

When the following is in .gitmodules:

[submodule "cdeps"] path = components/cdeps url = https://github.com/jedwards4b/CDEPS.git fxtag = ZZZZZZZZZ fxurl = https://github.com/ESCOMP/CDEPS.git fxrequired = ToplevelRequired I see: cdeps updated to ZZZZZZZZZ

ZZZZZZZ does not exist in the cdeps repository, so an error should be tripped and git-fleximod should abort. Instead it checks out cdeps with the default of what was there before.

jedwards4b commented 3 months ago

Are you using the latest git-fleximod in cam hash a2f0ad84a0?

 ./bin/git-fleximod update cdeps
s                cdeps cdeps1.0.28-1-g658f6a8 658f6a8 is out of sync with .gitmodules ZZZZZZZZ
Recursively checking out submodules of cdeps

                   fox at tag 4.1.2.1
                genf90 at hash 4816965
Cmd('git') failed due to: exit code(1)
  cmdline: git checkout ZZZZZZZZ
  stderr: 'error: pathspec 'ZZZZZZZZ' did not match any file(s) known to git'
cacraigucar commented 3 months ago

Perhaps you haven't pushed git-fleximod back into ESCOMP/CAM? I am using the version which is in your fork of ESCOMP/CAM on branch zz_rme/cam6_3_150. The last commit was at 2:30 today. I see a bunch of git-fleximod squashes at the top of my git log in that checkout.

jedwards4b commented 3 months ago

git push origin Username for 'https://github.com': jedwards4b Password for 'https://jedwards4b@github.com': Everything up-to-date

commit a2f0ad84a01fd52863b106ea10eaf2ff822e875d (HEAD -> zz_rme/cam6_3_150, origin/zz_rme/cam6_3_150) Author: Jim Edwards jedwards@ucar.edu Date: Thu Mar 28 16:12:59 2024 -0600

force python3

commit f60f4e78a829e0bb89afef39645087ec70aa1f24 Merge: 09ca6254 24b978bb Author: Jim Edwards jedwards@ucar.edu Date: Thu Mar 28 14:30:19 2024 -0600

Merge commit '24b978bb2092ea37ecc30053e8f9e8aba81278b6' into zz_rme/cam6_3_150

commit 24b978bb2092ea37ecc30053e8f9e8aba81278b6 Author: Jim Edwards jedwards@ucar.edu Date: Thu Mar 28 14:30:18 2024 -0600

Squashed '.lib/git-fleximod/' changes from 78b31548..ad6b84ee

ad6b84ee Bump to 0.7.3
e6264da3 Merge pull request #29 from ESMCI/explainM
3a9201dc better error handling for not a tag
b4e07beb fixes issue with ssh access to github (should not be required)
3fba3856 explain M flag
16b3ac37 Merge pull request #22 from ESMCI/fix/gitinterface
82428601 fix py3.11 issue in gitinterface

git-subtree-dir: .lib/git-fleximod
git-subtree-split: ad6b84ee19be4983561fbfff5d9d9abe24fda74e
cacraigucar commented 3 months ago

It still apears to be broken for me:

I cloned your branch, edited the file to use ZZZZZZZ for the fxtag, ran bin/git-fleximod update, and I get the following:

cice6 updated to rme/cesm_cice6_5_0_7
               cmeps up to date.
Recursively checking out submodules of cdeps

e                  fox not checked out, aligned at tag 4.1.2.1
e               genf90 not checked out, aligned at hash 4816965
               cdeps updated to ZZZZZZZZZZ
                cpl7 up to date.
               share up to date.
                 mct up to date.
          parallelio up to date.
Recursively checking out submodules of cime

e    CIME/non_py/cprnc not checked out, aligned at tag v1.0.6

                cime up to date.
                cism up to date.
Recursively checking out submodules of clm

e                fates not checked out, aligned at tag sci.1.71.0_api.33.0.0
                 clm up to date.
                 fms up to date.
              mosart up to date.
                 rtm up to date.
           chem_proc up to date.
               carma up to date.
Successfully checked out                cosp2 at v2.1.4cesm
               cosp2 up to date.
Successfully checked out                clubb at clubb_4ncar_20221129_59cb19f_20230330_branchtag
               clubb up to date.
               pumas up to date.
        pumas-frozen up to date.
            ali_arms up to date.
          atmos_phys up to date.
  atmos_cubed_sphere up to date.
Successfully checked out                 mpas at b8c33daa
                mpas updated to b8c33daa
            geoschem up to date.
Recursively checking out submodules of hemco

e                HEMCO not checked out, aligned at tag 3.6.3-cesm
Recursively checking out submodules of HEMCO

e docs/source/geos-chem-shared-docs has no fxtag defined in .gitmodules
               hemco updated to rme/hemco-cesm1_2_1_hemco3_6_3_cesm
          rte-rrtmgp up to date.
         rrtmgp-data up to date.

izumi$ module list
Currently Loaded Modulefiles:
  1) lang/python/3.11.5
izumi$ git log
commit a2f0ad84a01fd52863b106ea10eaf2ff822e875d (HEAD -> zz_rme/cam6_3_150, origin/zz_rme/cam6_3_150)
Author: Jim Edwards <jedwards@ucar.edu>
Date:   Thu Mar 28 16:12:59 2024 -0600

    force python3

The .gitmodules edited file contains:

[submodule "cdeps"]
path = components/cdeps
url = https://github.com/jedwards4b/CDEPS.git
fxtag = ZZZZZZZZZZ
fxurl = https://github.com/ESCOMP/CDEPS.git
fxrequired = ToplevelRequired
jedwards4b commented 3 months ago

From the top:

[jedwards@izumi ~]$ rm -fr  cam6_3_150.rme
[jedwards@izumi ~]$ git clone https://github.com/jedwards4b/cam -b zz_rme/cam6_3_150 cam6_3_150_rme
Cloning into 'cam6_3_150_rme'...
remote: Enumerating objects: 36926, done.
remote: Counting objects: 100% (2466/2466), done.
remote: Compressing objects: 100% (1099/1099), done.
remote: Total 36926 (delta 1488), reused 2183 (delta 1293), pack-reused 34460
Receiving objects: 100% (36926/36926), 39.99 MiB | 32.02 MiB/s, done.
Resolving deltas: 100% (26552/26552), done.
Updating files: 100% (2207/2207), done.
[jedwards@izumi ~]$ cd cam6_3_150_rme/
[jedwards@izumi cam6_3_150_rme]$ emacs .gitmodules 
^Z
[1]+  Stopped                 emacs .gitmodules
[jedwards@izumi cam6_3_150_rme]$ bg
[1]+ emacs .gitmodules &
[jedwards@izumi cam6_3_150_rme]$ ./bin/git-fleximod update
e            chem_proc not checked out, aligned at tag chem_proc5_0_05
e                carma not checked out, aligned at tag carma4_01
e                cosp2 not checked out, aligned at tag v2.1.4cesm
e                clubb not checked out, aligned at tag clubb_4ncar_20221129_59cb19f_20230330_branchtag
e                pumas not checked out, aligned at tag pumas_cam-release_v1.35
e         pumas-frozen not checked out, aligned at tag pumas_cam-release_v1.17_rename
e             ali_arms not checked out, aligned at tag ALI_ARMS_v1.0.1
e           atmos_phys not checked out, aligned at tag atmos_phys0_02_000
e   atmos_cubed_sphere not checked out, aligned at tag fv3_cesm.04
e                 mpas not checked out, aligned at hash b8c33daa
e             geoschem not checked out, aligned at tag 14.1.2
e                hemco not checked out, out of sync at tag None, expected tag is rme/hemco-cesm1_2_1_hemco3_6_3_cesm
e           rte-rrtmgp not checked out, aligned at tag v1.7
e          rrtmgp-data not checked out, aligned at tag v1.8
          ccs_config up to date.
               cice5 up to date.
Recursively checking out submodules of cice6

e                 cice not checked out, aligned at tag cice6_5_0_20240222
Recursively checking out submodules of cice

e              icepack has no fxtag defined in .gitmodules
               cice6 updated to rme/cesm_cice6_5_0_7
               cmeps up to date.
Recursively checking out submodules of cdeps

e                  fox not checked out, aligned at tag 4.1.2.1
e               genf90 not checked out, aligned at hash 4816965
Cmd('git') failed due to: exit code(1)
  cmdline: git checkout ZZZZZZ
  stderr: 'error: pathspec 'ZZZZZZ' did not match any file(s) known to git'
jedwards4b commented 3 months ago
diff --git a/.gitmodules b/.gitmodules
index ed8cdd1e..d8c1a548 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -29,7 +29,7 @@ fxrequired = ToplevelRequired
 [submodule "cdeps"]
 path = components/cdeps
 url = https://github.com/jedwards4b/CDEPS.git
-fxtag = rme/cdeps1.0.28
+fxtag = ZZZZZZ
 fxurl = https://github.com/ESCOMP/CDEPS.git
 fxrequired = ToplevelRequired
jedwards4b commented 3 months ago

okay - I was able to reproduce when I module load lang/python/3.11.5

cacraigucar commented 3 months ago

I'm glad you saw it, as my steps appeared to be identical to yours!

jedwards4b commented 3 months ago

I've pushed a fix to zz_rme/cam6_3_150, please try again.

cacraigucar commented 3 months ago

I do see the following error message:

e               genf90 not checked out, aligned at hash 4816965
In operation git -C components/cdeps checkout ZZZZZZZZZZZZZZ: error: pathspec 'ZZZZZZZZZZZZZZ' did not match any file(s) known to git

                cpl7 up to date.
               share up to date.
                 mct up to date.
          parallelio up to date.
Recursively checking out submodules of cime

e    CIME/non_py/cprnc not checked out, aligned at tag v1.0.6

                cime up to date.
                cism up to date.
Recursively checking out submodules of clm

e                fates not checked out, aligned at tag sci.1.71.0_api.33.0.0
                 clm up to date.
                 fms up to date.
              mosart up to date.
                 rtm up to date.
           chem_proc up to date.
               carma up to date.
Successfully checked out                cosp2 at v2.1.4cesm
               cosp2 up to date.
Successfully checked out                clubb at clubb_4ncar_20221129_59cb19f_20230330_branchtag
               clubb up to date.
               pumas up to date.
        pumas-frozen up to date.
            ali_arms up to date.
          atmos_phys up to date.
  atmos_cubed_sphere up to date.
Successfully checked out                 mpas at b8c33daa
                mpas updated to b8c33daa
            geoschem up to date.
Recursively checking out submodules of hemco

e                HEMCO not checked out, aligned at tag 3.6.3-cesm
Recursively checking out submodules of HEMCO

e docs/source/geos-chem-shared-docs has no fxtag defined in .gitmodules
               hemco updated to rme/hemco-cesm1_2_1_hemco3_6_3_cesm
          rte-rrtmgp up to date.
         rrtmgp-data up to date.

but then git-fleximod continues. The current behavior is very dangerous, since if someone weren't watching, this error has rolled off the top of the screen AND the cdeps directory has a checkout in it, just not the one that the user thought they requested.

I would suggest that if any error is encountered, the script halt at that point and an error message be the last thing that is written from the script.

jedwards4b commented 3 months ago

try again

cacraigucar commented 3 months ago

That is working now - thanks!