ESMCI / cime

Common Infrastructure for Modeling the Earth
http://esmci.github.io/cime
Other
162 stars 207 forks source link

Add case git #4655

Closed jedwards4b closed 3 months ago

jedwards4b commented 3 months ago

This PR adds a case interface to git. It creates a local git repository when case.setup is run and updates that repository with each action that triggers an update of the CaseStatus file. Optionally a remote repository can be attached by setting CASE_GIT_REPOSITORY to the name of the remote repository. The case name is used as the repository branch name and if the branch already exists in the remote an error is generated. So multiple cases can exist in the same remote repository and each case is a branch of that repo. The new file gitinterface.py can interact with git in two ways:

  1. If the python git module is found it will be used.
  2. If the python git module is not found git commands will be run through shell commands.

Note that the variable CASE_GIT_REPOSITORY must be defined in your driver config_component.xml in order to use this feature, it should be defined as follows:

<entry id="CASE_GIT_REPOSITORY">
  <type>char</type>
   <default_value></default_value>
   <group>case_git</group>
   <file>env_build.xml</file>
   <desc>Remote git repository used for this case</desc>
</entry>

I have tested this code on three systems: derecho (with python git module) izumi (without python git module) TACC vista (grace-hopper system no python git module)

Test suite: scripts_regression_tests on the three systems listed above Test baseline: Test namelist changes: Test status: bit for bit

User interface changes?: Users who wish to use the CASE_GIT_REPOSITORY feature must have write permissions to the remote repository and it is recommended that the ssh interface to that repository be used to avoid frequent prompts for github tokens.

Update gh-pages html (Y/N)?:

jasonb5 commented 3 months ago

I ran into one issue which is more of an edge case. I was in a new environment, created a case and went to run ./case.setup. image Do we want to handle this before the case is created?

jedwards4b commented 3 months ago

I'm not sure how to fix that - were you on a github server or in a local environment? I think that our github scripts set those git config variables don't they?

jasonb5 commented 3 months ago

It was an environment in a container, but it could happen on any system where the user is new and hasn't setup git, since this is only required on making commits. This is really an edge case, I wouldn't expected it to happen often.

Should have a fix for this, soon.

Looking for: ['python=3.8']

Could not solve for environment specs
The following packages are incompatible
├─ python 3.8**  is requested and can be installed;
└─ truststore is not installable because it requires
   └─ python >=3.10  but there are no viable options
      ├─ python [3.10.0|3.10.1|...|3.12.5] conflicts with any installable versions previously reported;
      └─ python 3.12.0rc3 would require
         └─ _python_rc, which does not exist (perhaps a missing channel).
jasonb5 commented 3 months ago

This PR https://github.com/ESMCI/cime/pull/4658 should fix that error.

jedwards4b commented 3 months ago

Replaced by #4660