Sometimes you just want to have a fresh workspace in which to imagine, but don't want to trample or even fuss with existing code. And, logically, it'd be nice if this sketch code could live near the code it will eventually replace. Say, on a branch in that same codebase. Wouldn't that be nice? That'd be nice. And saints be praised it turns out there's a way to do it!
I know, I know. I'm late to the game on this one. But I just, just found a usecase that - absent pressing deadlines and piling work items - I felt like I could invest time in addressing: how to consolidate and reuse my Github Actions build logic.
Happy new year! The world is about to ring in a new year, and with it comes a chance to reflect, to prioritize, to clean. My Github repositories were proliferating like rabbits! It was getting out of hand, and something needed to be done!
Suppose you've got this innocuous looking Spring Boot 3 (well, 3.0.1, in particular) program that runs just fine on the JRE (go ahead, try it: mvn spring-boot:run).
Spring Boot 3.0.0 was released on the same day as the US date for Thanksgiving Day (November 24th) 2022! (That was also the first time in history I've forgotten to publish that week's installment of a @BootifulPodcast because I was so excited with the new release!) Anyway, it changed everything. The first order of business was to start going around and updating my Github Actions pipelines to use the new native facility and to update code to use it.
I saw a great tweet from Bruno Borges about using Github Actions to derive the version of Java to be installed by analyzing the pom.xml of the build itself. It seems like a good enough idea, so I put it into practive here. Most of the magic lives in a very tiny JavaScript file, index.js:
Suppose you're working with a REST API that produces pages of data capped at, let's suppose, 50 records per fetch. Each batch of 50 comes with a nextPageToken, that can be used to fetch the next batch of results. So, you call the service the first time with no nextPageToken, and you're given the first batch of results. Call it again with the nextPageToken that came with the first batch and you'll get the second page of results. Call it again with the nextPageToken that came with the second batch and you'll get the third page of results. You see? One page depends on the previous one.
Before I moved most of my workloads over to Tanzu Community Edition, I had GKE, Google's simple and lean Kubernetes distribution. GKE's dead simple to get going and they walk you through the installation an connection step-by-step so that you'd be more surprised if you couldn't get to your cluster.