Site icon ToddySM

Re-disigning the Monolithic GitHub Workflow for Promoting Images from Quarantine

Yesterday I posted about Promoting Container Images from Quarantine Using GitHub Actions describing a simple way to do a Trivy vulnerability scan and promote the image if it passes the vulnerability threshold. However, the problem with that workflow was that it was too monolithic. While the monolithic workflow does the work, I wanted to have a “library” of smaller actions that I can reuse in various container supply chain workflows. Therefore, I decided to redesign both the “acquire/mirror” and the “promote from quarantine” workflows.

Looking deeper and deconstructing both workflows shows the following steps for each:

Steps 1 and 2 from the first workflow and step 1 from the second workflow are exactly the same – login to a registry. They can be parameterized and reused. The same is true for step 3 in the first workflow and step 3.3 in the second.

With all this in mind, I worked with Copilot to create the following reusable actions that I can use in my workflows:

Now, I can reuse the above actions in any workflow that I want. For my current two workflows, “acquire/mirror” and “promote from quarantine” the re-usability is only for the “registry login” and the “mirror image” actions but you will see how in the future those will come handy.

Also, there is a lot of resemblance with my work on the Custos supply chain security workflow platform. For example, the “registry login” action in GitHub is modeled as a connector in Custos while the “mirror image” action is modeled as an action in Custos.

Next time I will write about something that almost every enterprise customer I talked with experiences – acquiring brand new images with vulnerabilities and I will show how they handle the issue currently. I will also talk about the challenges with images from public sources like Docker Hub. In the future, I will show a better approach to source images and how to handle them.

Exit mobile version