coreos / layering-examples

Apache License 2.0
111 stars 24 forks source link

Merge main into rhcos #15

Closed cgwalters closed 2 years ago

cgwalters commented 2 years ago

Adapt the current examples for RHCOS.

jmarrero commented 2 years ago

@cgwalters squash?

cgwalters commented 2 years ago

Well...so far this actually merges in changes from main, so condensing it to a single commit would I think be messier.

Honestly though what I'm trying to think about long term is if we can somehow avoid forking at all...and actually have it Just Work to override the base image for all of these directly. Maybe with some distribution conditionals.

cgwalters commented 2 years ago

Specifically https://github.com/coreos/coreos-layering-examples/pull/15/commits/e3c26631487677e27e1cc916b43e07070b01bbd7 is a merge commit that pulls in a lot of other changes.

jmarrero commented 2 years ago

I see, well then LGTM. Ahh yeah the base image can be changed based on an arg. I can check if instead of just passing the base image in an ARG I can make it work with passing fcos/rhcos as ARG and we figure the base image.

cgwalters commented 2 years ago

Uhhh...wow I somehow ROYALLY screwed this up and merged this in to main, not the rhcos branch...

cgwalters commented 2 years ago

Argh. Well...it is tempting to force push main back to e955e9299228192d8d1a49c309b1aaa80030aef0 which is where I think things forked from.

jmarrero commented 2 years ago

we are early... force push it. I need to do a better job of looking at the branches names when I am reviewing.

jmarrero commented 2 years ago

So I found here something that seems to work to deal with RHEL vs FCOS images.

ARG IS_RHCOS=
# --build-arg IS_RHCOS=true sets rhcos image 
ARG BASE_IMAGE=${IS_RHCOS:+registry.ci.openshift.org/rhcos-devel/rhel-coreos:4.11}
# if IS_RHCOS is not set then we use default.
ARG BASE_IMAGE=${BASE_IMAGE:-quay.io/coreos-assembler/fcos:testing-devel}
# We can also manually replace the default images by passing --build-arg BASE_IMAGE=myimage
FROM ${BASE_IMAGE}

I can rework your branch to use this if you think this looks like a good way to handle it.

cgwalters commented 2 years ago

Sorry I forgot to respond to this earlier! We chatted about this real time.

I think what I lean (but I'm up for discussion!) is to default to FROM quay.io/coreos-assembler/fcos:stable or so. And then we just document how to use podman build --from registry.ci.openshift.org/rhcos-devel/rhel-coreos:4.11 to override it. OpenShift Builds also support overriding the FROM line. I think many other systems do, for exactly the reason we have here.

The other reason for this is I think soon we will want to introduce a centos-stream-9-coreos:4.11 etc., and at that point things get really unwieldly to replicate in each Dockerfile.