The company I work for has had a third party agency build them a new website for the product I work on. A lot of money has been spent on making the brand really nice. The third party agency has their own git repo and they normally provide hosting for their clients as well. Since our product is a hosted application, we also have the ability to host the new Wordpress website ourselves, which we do as we have credit with our hosting provide. No point paying for something when we can do it for free.
Our environment was a clone of their repo, which we then have hooked up to CI and when a commit is done, it build. Basic stuff. I have our repo checked out and have a remote to their repo checked out as well. I use Sourcetree on Windows (no judging) so this works really well, I have our prod, dev and their prod repo all local. I merge their prod repo into our dev (staging) repo whenever they makes changes and it gets built. This setup was okay but they want a bit more flexibility for staging. Sure no problem. I'll switch the checkout and trigger repo to their repo for our staging builds. When they commit, it builds automatically for them. Win win.
I had to do a little but more work than just change the target repo though. Our CI uses yaml files for config and the file has to be in the repo that is used to build. No problem, I have access to their repo and with their permission, I committed the yaml file to their repo. Or so I though.
This is why I find it hard to write, I'm use to making 100's of edits, I'm use to altering and amending and what not. Deleting, rewriting, altering, this now does this, this now does that. This idea of immutability stifles me and it shouldn't. As I am writing this very post, I am editing. I am changing, I am going off on different ideas and it's frustrating. "Can I say how I feel better" is a constant nag (i even changed the word question to nag after I had wrote the sentence). I guess writing is always like this, but I am so use to making 100's of changes when something is wrong in code that I can't differentiate the two disciplines.
I've committed the file to my local copy of their repo, bare in mind, my Sourcetree project has two remotes, my fork (origin) and their repo. My repo is the parent repo in the project. There's in a child. This is the best way to describe the arrangement, I'm too tired to find the correct terminology. I'm on the local branch of their repo, I commit the file. I go to push the file. It defaults to origin to commit, I change to their origin, I select master and commit. Jobs a good'en. Err wait, why is it taking so long to commit a 4k file? Oh it's done finally, must be my connection. Let's check their repo and see if it's triggered a build. OH SHIT.
What the fuck has happened? Why are all my commits from my clones local branch here. now in their history? I had committed clones the entire master branch to their master branch and my yaml file is no where to be seen. Why why why. Rage takes over. I was on their origin on the commit, their checkout of their repo. What went wrong. Sourcetree and a little of double checking are to blame. Now I am not certain if this is a bug or not. But when I pushed to their repo, there were only 2 local branches available, my origins local checkouts. When I switched to their origin. There was still only two branch available to push. I had not taken notice of this and pushed my master branch thing it was the local checkout of their master branch and forgetting (stupidly) that theirs was a different name. Why wouldn't sourcetree show all branch? Seems like a bug to me. So I had push all my merges and extra files to their repo. Added it all to their history. BIG PROBLEM. My clone has prod CI files, will prod credentials in them. I had changed staging to use env vars for these as when I made the builds quickly to get and left the credentials hardcoded. These were now in their copy of the repo too. Luckily, it's only ftp to the website they are making anyway. But it could have been anything and that's the problem. Now I need to rotate the keys in the morning. Joy.
I was livid, I even said in the email I was fuming to them apologising. It was late in the day and I didn't want to have to deal with this. It was a minor mistake but I was acting like I caused a major catastrophe. Why?
It's been 5 hours since I finished work and I am still feeling the effects of the rage. I really shouldn't have got so angry, but it's just another mistake added to the list of mistakes. I think I was more angry about this than I was when I deleted the prod site. See, this time I had taken time to do it right, I had switched out the hardcoded credentials, made the files more readable. Taken time to do a professional job and in the end I (with a little help from Sourcetree) messed up. I'm embarrassed. I didn't have anything to prove to them, but the simple act of committing a file to a repo had gone wrong. Let's see what happens in the morning. THe Other tech lead didn't seem too fussed (or didn't understand) but now that repo has 45 more commits all from me.