jonashackt
jonashackt

Reputation: 14429

How to automatically create PRs with Paketo.io/Cloud Native Buildpacks Docker image rebase (CI-Pipeline like GitHub Actions or renovatebot)?

As described in the Cloud Native Buildpack features they add a rebasing capability with

Instant updates of base images without re-building.

In the buildpacks docs the rebase operation of Paketo's pack CLI is described to be executed like this:

pack rebase my-app:my-tag

As this is one of the key features of Cloud Native Buildpacks - and is a feature most microservice based architectures are in need of desparately - it would be great to know, how this could be automated inside a CI/CD pipeline such as GitHub Actions or a dependency management tool like renovate. Renovate already supports Docker, but because there's is no depencency management file for Paketo, it doesn't create Pull Requests right now.

So the question is how Paketo/Buildpacks rebase operation could be automated to create PRs without human interaction?

Upvotes: 0

Views: 276

Answers (1)

Daniel Mikusa
Daniel Mikusa

Reputation: 15041

The pack rebase command is going to swap out the run image used by your container. The run image is part of the builder that you selected when you built your image.

For example, there is the Paketo paketobuildpacks/builder:base builder. You can run pack inspect-builder paketobuildpacks/builder:base and pack will give you a bunch of details about the builder. Included in that is a section telling you the run image for this builder and any images built using this builder.

Run Images:
  index.docker.io/paketobuildpacks/run:base-cnb
  gcr.io/paketo-buildpacks/run:base-cnb

Note there are two listed, but they are the same image just hosted in two different places.

Given this, you are going to want to set up your CI system to monitor for new versions of the run image for your builder. When there is a new run image, you'll want to pack rebase so you update your images to use the latest run image.

I haven't used Renovate but it sounds like the Docker support is probably what you want. Point it at your base image & use that to trigger the pack rebase command.

We have some Github actions which monitor Paketo images (not for this specific purpose, but the idea is the same). There's not a great way to do it (at least at the time I write this), but we use the schedule to periodically check for updates to the image. Then kick off workflows, in this case the workflow would basically be to run pack rebase.

Upvotes: 1

Related Questions