Skip to content

Clone submodules over HTTPS, not SSH - #635

Merged
mark-petersen merged 1 commit into
MPAS-Dev:ocean/developfrom
Helumpago:submodules-use-https
Jul 27, 2020
Merged

mark-petersen merged 1 commit into
MPAS-Dev:ocean/developfrom
Helumpago:submodules-use-https

Conversation

@Helumpago

Copy link
Copy Markdown

This PR updates the .gitmodules settings so that Git will clone the CVMix and BGC repositories over HTTPS instead of SSH.

This is important for systems (e.g., build servers) that don't have an SSH key associated with GitHub. These systems need to clone public repositories using anonymous HTTPS.

Prior to this change, attempts to build this repository would emit the following error: Missing core_ocean/cvmix/.git, did you forget to 'git submodule update --init --recursive' ? Due to not having an SSH key registered with GitHub, running the requested git submodule update --init --recursive line fails due to insufficient access rights.

After this PR, the update command works correctly on anonymous systems.

Important for build systems that don't have an SSH key tied to GitHub.

@xylar xylar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This worked great for me and does seem like a useful change.

@xylar
xylar requested a review from philipwjones July 17, 2020 07:38

@philipwjones philipwjones left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a good step. To fully eliminate the message for standalone builds with the regular Make system, we also need the following in src/core_ocean/Makefile:
replace:
(pwd ; echo "Missing core_ocean/cvmix/.git, did you forget to 'git submodule update --init --recursive' ?"; exit 1)
with:
(echo "Retrieving ocean submodules"; git submodule update --init --recursive; cd cvmix/src/shared; make all FC="$(FC)" FCFLAGS="$(FFLAGS)" FINCLUDES="$(FINCLUDES)")

and similarly:
(echo "Missing core_ocean/BGC/.git, did you forget to 'git submodule update --init --recursive' ?"; exit 1)
with
(echo "Retrieving ocean submodules"; git submodule update --init --recursive; cd BGC; make all FC="$(FC)" FCFLAGS="$(FFLAGS)" FINCLUDES="$(FINCLUDES)") \

I tested this on both NERSC and Summit. With those changes, the model successfully built without needing an explicit submodule update command and did not trigger any ssh key passwords. So finally does what @pwolfram wanted. It will still fail if people don't have a git module loaded or git in their path, but think that'll be rare.

@Helumpago

Copy link
Copy Markdown
Author

Thanks for reviewing.

@philipwjones, will that cause issues if someone updates the references for your submodules? For people who have already built MPAS, the .git file in the submodules will already exist, which means the update won't be triggered. The old files will stick around for other people.

Would it be better to drop the conditional and always run the update as part of the libcvmix and libBGC targets?

@Helumpago

Copy link
Copy Markdown
Author

Actually, I would really appreciate it if the build system didn't try to automatically update the submodules. Doing so will cause a couple issues in container-based environments:

  1. git generally isn't installed in containers.
  2. Most container build systems are configured to ignore .git directories. This means that, even if someone does install git into their container, they won't be able to run the submodule update.

So, for what it's worth, I'd much prefer the explicit error to implicitly trying to download the submodules.

@philipwjones

Copy link
Copy Markdown
Contributor

@Helumpago - that's fine with me. I don't have a problem with the current setup and don't think it's too much of a burden to either remember to update after checkout or get a reminder if you don't. I think others have found it more of an annoyance, so we had been exploring alternatives.

But I do think we should make your change at least - that does save some extra password queries and allows you to walk away from a long build without it hanging up waiting for you to enter a password.

And yes, you're correct that the changes to the makefile would not pick up an update in the submodule reference so you might be running with an old submodule. But that's also true of the current situation.

@mark-petersen mark-petersen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Helumpago this is great, thanks for your contribution. I'll merge it soon.

@mark-petersen
mark-petersen merged commit 37815ff into MPAS-Dev:ocean/develop Jul 27, 2020
@xylar xylar mentioned this pull request Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants