Container Registry 101

Welcome back to another blog about what I did, and learned about this week in the Telescope project. As mentioned last week, I was going to attempt to push the feed-discovery image into the GitHub Container Registry. I also did some more research after some issues popped up from that, and I took on a couple of reviews this week as well.

Registering More Issues

After doing a bunch of research on the topic last week, I had found a workflow that I thought would work for what I wanted to achieve. It was called push-to-ghcr. I had done up an initial draft of how I thought the yaml file should look like and submitted a Draft PR in order to ask for some help. I would normally link a picture of that work here, but I ended up amending over that initial attempt. The reason for doing so is because the professor had found a potential issue in the push-to-ghcr repo that had to do with not being able to perform the action if the name had capital letters in it. He suggested that I use the official docker build-push action.

Using the official action, along side the docker/login-action, which allows me to log into the Github container registry. I was able to come up with a workflow that, in theory, will build and push the feed-discovery image to the registry.

As documented in the PR, it took me many attempts to try and get the file to properly navigate to the correct Dockerfile. The default behavior is for the action to build the Dockerfile located in the root directory of the application. In order to tell it otherwise you need to provide some context. I tired a number of different variations, and all of them failed locally

I had a hunch that it was failing because I was trying to push the image from my fork instead of pushing it from the main branch. I decided to push these changes into the draft. Turns out I was kinda of right. I had to make a slight adjustment to the context given by simply taking away the {{defaultContext}} I had in front of the sub directory I was targeting. After making that change, and then changing the trigger from being a push on my local branch, to a push on the main branch for files that are part of that specific microservice, it was time to test this PR out on the main branch. The only way to do that was to merge the PR, and then submit another PR that causes the workflow to trigger.

PR Two of the week

The second PR of the week was a very trivial one. I just updated the README file in feed-discovery microservice so that all the npm instructions were updated with the proper pnpm instructions. The real reason for this PR though, as mentioned earlier, was to trigger the workflow to see if the image would get registered. There were a few others around when I attempted this. We where all watching the live build in the GitHub actions, waiting in anticipation to see if it worked. Unfortunately, it did not.

According to the professor, this issue if because of how the Telescope repository is setup. We will have to figure out a way around this by either transferring the repository to be a public one, or by hosting our own registry.

After the Triage meeting this week, I believe we will be attempting to transfer the repo. We will be doing this the Thursday before reading week since that will give us some breathing room to fix any potential issues that come up from doing this. I have been doing some reading into the matter.

Reviews

This week I also took on a couple of reviews while I was waiting for some help with those drafts I submitted. The first review I tried to follow the testing instructions, but came up with some errors, and I was not the only one either.

I was told how to correct that issue and then attempted to test it again, same results…Okay I showed my results and it turns out that there was a merge a couple of hour before that changed the fix. After navigating to the proper directory, I was able to test and build the file properly and I approved the PR.

The second review was to try and get a better SHA extraction from GitHub webHooks. There was not as many issues this time around, a pretty simple review. After confirming what the intended behavior was, and then looking through the code, it was another approval from me.

Design a site like this with WordPress.com
Get started