In this talk, you’ll be introduced to an innovative,
powerful, flexible, and easy-to-use tool developed by the
folks at NerdWallet that simplifies some of the complexities
associated with making horizontal changes in service
oriented systems via automation.
3. Abstract
In this talk, you’ll be introduced to an innovative,
powerful, flexible, and easy-to-use tool developed by the
folks at NerdWallet that simplifies some of the complexities
associated with making horizontal changes in service
oriented systems via automation.
4. Problem Statement
In a highly distributed system comprised of multiple repos,
make a change to a non-empty subset programmatically.
6. Adding a New File - Current Workflow
1. Suppose you have n repos and want to make a change to a
non-empty subset s (i.e. change the engines property in
package.json, etc...)
2. For each repo in s
a. fork and clone the repo to your local
b. add the file
c. stage the changes
d. commit the changes
e. push the commit to your remote
f. open a PR to upstream
g. solicit reviews and approvals
h. land commits on upstream
i. release changes to lower-level environments, test, and promote
through to production
7. Making a Code Change - Current Workflow
1. Suppose you have n repos and want to make a change to a
non-empty subset s (i.e. at renovate.json, eslintrc,
etc…)
2. For each repo in s
a. fork and clone the repo to your local
b. find and update the relevant code
c. stage the changes
d. commit the changes
e. push the commit to your remote
f. open a PR to upstream
g. solicit reviews and approvals
h. land commits on upstream
i. release changes to lower-level environments, test, and promote
through to production
8. Obvservations
Note that in both examples, steps 2a - 2f are the
same given we choose the appropriate abstraction
layer.
The time needed to make these changes is directly
proportional to the size of s.
Also, provided there is a programmatic way of
identifying which repos should be in set s as well as
a programmatic way to apply the changes to the repos,
then we can effectively abstract out these steps into
a script. You can think of Shepherd as that
abstraction.
9. Shepherd
Shepherd is an open-source CLI tool developed at NerdWallet
that coordinates the application of code changes across
multiple repos, from checking them out, to making the
changes, to submitting pull requests.
Think of Shepherd in this way:
Shepherd is to code as what migrations are to databases.
11. Install Steps
Pretty short:
- npm install -g @nerdwallet/shepherd
- That’s it!
Verify the install via cli by running the following command:
- shepherd --help
Notes: If installing off of clone, run npm run build
post-install
14. Demo 1 cont’d
- Shepherd commands
- shepherd checkout .
- shepherd apply .
- shepherd commit .
- shepherd push .
- shepherd pr-preview .
- shepherd pr .
Note: All commands can be verified by inspecting Shepherd’s
working directory (defaults to ~/.shepherd).
15. Demo 2: Exercise 1: Add engines property to package.json
Q: What are the shell commands to apply this change?
Q: What would the shepherd.yml file look like?
Q: Can you do this only using shepherd.yml and no other
files?
17. ROI
- Reduce time to delivery
- Increase productivity
- Increase velocity
- Increase efficiency
- Self documenting
- Repeatable
- Identify opportunities to simplify (i.e. horizontal
changes like these are somewhat of an indicator we should
consider different approaches)
19. How to get involved
- Slack
- https://bit.ly/node-shepherd
- GitHub
- https://github.com/NerdWalletOSS/shepherd
- Contribute
- Good first issue
- https://github.com/NerdWalletOSS/shepherd/labels/good%20first%20i
ssue
- Example
- https://github.com/NerdWalletOSS/shepherd/issues/190