Scripting Your Way Outta Hell

Friday, September 30, 2016 ยท 4 min read

It all started innocently enough. I had “jfrazelle” as my GitHub handle for years, but my Twitter, IRC and other handles are all “jessfraz”. No one on GitHub was actually using “jessfraz” so I sat on it waiting to make my move.

I’m currently on vacation this week so of course I was looking to break all the things. One thing you must know about me is that at no point was I thinking I hate this. I actually love stuff like this, I live for pain. Why else would I run Linux on the desktop? But back to the story.

I polled the twitterverse…

And then I made my move…

Everything was fine for a few minutes. Another thing you must know about me is: I have a private Jenkins instance for continuous builds and testing. Yes, I am this much of a nerd, but it is essential for building all the Dockerfiles for my publicly readable private docker registry at r.j3ss.co. I will save all that for another blog post, but the jobs started triggering. Immediately I got a bunch of emails about failed builds because Jenkins could not clone the repos.

“This is fine” I thought to myself. It’s all configured with Jenkins DSLs and I can just do a sed on those files and it will work again.

I do this.

The “apply-dsl” job is still red, oh duh because it cannot clone the repo where the DSLs live to even fix the problem. So I change it manually.

This is fine.

The builds all start again. Except now all the Go builds are failing because importing “jfrazelle/…” is not working. Vendor your crap kids!!!

So I fix all these repos with the best vim command ever argdo. argdo will apply the script you run to all the open buffers, so just open the buffers of all the go files and run this:

argdo %s/jfrazelle/jessfraz/g | update

The | update makes sure it saves the buffer when it’s done editing.

After ~50 repos of this I am tired but it’s fine. It’s all fine. Things are working again.

Now I’m wondering who else I have broken… I search GitHub to see…

I am for sure going to hell for this. What have I done?

I made/am making some pull requests to various repos. A few of those in the query above are actually forks of my repos that don’t show up in GitHub as forks because of the way the person forked it so they can be ignored.

Overall, I think I really f*cked this entire situation by having an account for “jfrazelle” and an account for “jessfraz” and swapping them. I think this is why the git clone/fetch/etc redirects that should happen when you change your username are broken. So let me just make this clear, none of this is GitHub’s fault. I pretty much did this super wrong. Also I have a deep fear of someone taking my old username and making fake repos to try and trick imports in Go so I figured I will squat on it forever to avoid this. Maybe someone from GitHub can alleviate my probably irrational fear.

Amazingly all the Travis CI builds transferred seamlessly. People have been all up in my mentions on Twitter saying they did this and all their autobuilds for Docker Hub broke. This honestly doesn’t affect me because I host my own registry that continuously builds AND I allow the general public to pull images from it.

In conclusion, I actually think everything is fine now. :)