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

Script to automate RTD config file update #59

Merged
merged 10 commits into from
Aug 29, 2023
Merged

Script to automate RTD config file update #59

merged 10 commits into from
Aug 29, 2023

Conversation

eirikurj
Copy link
Contributor

Purpose

This PR adds an initial script that can be used to automate the update of RTD config files for a number of our repositories. The idea is to minimize the maintenance needed managing this particular file until some other solution, such as templating, is supported (see https://github.com/mdolab/private-docs/issues/298 for some discussion). If not, we could improve on this later by automatically generating the yaml file.

Expected time until merged

No rush

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@eirikurj eirikurj requested a review from a team as a code owner August 22, 2023 14:35
@eirikurj eirikurj requested review from A-CGray and marcomangano and removed request for a team August 22, 2023 14:35
Copy link
Contributor

@marcomangano marcomangano left a comment

Choose a reason for hiding this comment

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

This is so good.
I just have a couple of comments about making the process smoother in case there are issues with individual repos.

rtd/updateYaml.sh Outdated Show resolved Hide resolved
REPODIR="$WORKDIR/$repo"
echo "Updating $repo"
git clone git@github.com:mdolab/"$repo".git
cd $REPODIR
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 have a safety check here to make sure that if a repo is missing from the list, we just move on to the next repo instead of exiting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some safeguards by checking exit conditions

echo "Updating $repo"
git clone git@github.com:mdolab/"$repo".git
cd $REPODIR
git checkout -b $BRANCH_NAME
Copy link
Contributor

Choose a reason for hiding this comment

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

similar here, if for any reason we already have a branch with that name, I would add a check (or maybe a user prompt?) on whether to continue or not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some safeguards by checking exit conditions

Copy link
Contributor

@marcomangano marcomangano left a comment

Choose a reason for hiding this comment

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

Very nice, thanks for the fixes! I just have a final comment - maybe there's a function that has been left over there? I would still echo a failure message from checkFailure

# Init array to track progress
declare -A REPO_STATUS

repoFailed () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this function being used?

Copy link
Contributor Author

@eirikurj eirikurj Aug 29, 2023

Choose a reason for hiding this comment

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

Good catch, I was going to use it, but decided not to in the end. Just moved the error echo instead. Should be good now.

@marcomangano
Copy link
Contributor

If no one else has comments, I will merge this tomorrow morning.

Copy link
Member

@A-CGray A-CGray left a comment

Choose a reason for hiding this comment

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

Nice job, this looks very thourough

if [[ -z $MANUAL_REPO && -z $REPO_LIST ]]; then
echo "Insufficient inputs, see usage:"
echo "$USAGE"
die
Copy link
Member

Choose a reason for hiding this comment

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

nice

@A-CGray A-CGray merged commit 17979c8 into main Aug 29, 2023
@A-CGray A-CGray deleted the rtdconf branch August 29, 2023 23:12
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