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

Weekly cron job checking for submodule updates #1741

Merged
merged 16 commits into from
Dec 15, 2021

Conversation

brenthuisman
Copy link
Contributor

@brenthuisman brenthuisman commented Oct 27, 2021

  • Create a script that generates diff.log if git submodules have tags more recent that the commit they're currently at.
  • A Github Action runs this script monthly.
  • If updates found, Github Action creates an Issue like so: [AUTOMATED] Git submodule updates found brenthuisman/arbor#9
  • Actually updating the git submodule and Spack file are still manual

First step in addressing #1731

@@ -0,0 +1,11 @@
#!/usr/bin/env bash

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@brenthuisman brenthuisman Nov 30, 2021

Choose a reason for hiding this comment

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

I think for this use-case it isn't what we want, because it would exit the script and Github Action early and we would not get output for any submodules that were not checked yet. We want to exit late, not early, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would still put it. We want to exit whenever a command fails. Consider 4 fails (silently). Then we would get an empty diff.

Copy link
Contributor

Choose a reason for hiding this comment

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

add a small summary of what the script does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

diff returns nonzero upon any difference. So no, here we don't want to exit upon any 'fail', we'd ever only get the difference reported for a single module.

I'll add a summary!

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right (Cf. http://mywiki.wooledge.org/BashFAQ/105). But what about error handling, e.g., if git submodule foreach 'git fetch' fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I disable network and run the script, the fetch loop terminates early (after the first remote being inaccessible) and the diff is generated based on unupdated module remotes. That is not terribly useful, but also not terribly bad, assuming that by running this weekly, such a failure every now and then will do no more harm than postpone us being notified a week late of updates.

Is that acceptable?

scripts/submodule-diff.sh Outdated Show resolved Hide resolved
scripts/submodule-diff.sh Outdated Show resolved Hide resolved
scripts/submodule-diff.sh Outdated Show resolved Hide resolved
.gitmodules Outdated Show resolved Hide resolved
Copy link
Contributor

@schmitts schmitts left a comment

Choose a reason for hiding this comment

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

Some minor comments inline

Copy link
Contributor

@schmitts schmitts left a comment

Choose a reason for hiding this comment

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

LGTM

@noraabiakar noraabiakar self-assigned this Dec 14, 2021
@brenthuisman brenthuisman requested review from noraabiakar and removed request for thorstenhater December 14, 2021 12:49
Copy link
Contributor

@noraabiakar noraabiakar left a comment

Choose a reason for hiding this comment

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

If there are differences between local and upstream submodules, and the automatically generated issue is not addressed, does that mean that every week an identical issue will be opened?

#!/usr/bin/env bash
# Check any git submodule remotes for updates, and print difference with current Arbor repo state to `diff.log`

git submodule foreach 'git describe HEAD --tags' > current_state_of_git_submodules_in_arbor_repo.log | tee current_state_of_git_submodules_in_arbor_repo.log
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need both | tee and > ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To both display the output on stdout and have it in the file.

Copy link
Contributor

Choose a reason for hiding this comment

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

I just tried it out locally and it didn't display the output on stdout. But git submodule foreach 'git describe HEAD --tags' | tee current_state_of_git_submodules_in_arbor_repo.log does what you describe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops :)

@brenthuisman
Copy link
Contributor Author

If there are differences between local and upstream submodules, and the automatically generated issue is not addressed, does that mean that every week an identical issue will be opened?

Correct.

@noraabiakar
Copy link
Contributor

noraabiakar commented Dec 14, 2021

I think a new issue every week might be too much, what do you think?
Edit: I guess it's fine. We can just close the old ones.

@brenthuisman
Copy link
Contributor Author

Weekly is perhaps too frequent, I've changed it to a monthly job.

@brenthuisman brenthuisman merged commit eafee4d into arbor-sim:master Dec 15, 2021
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