Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ubi9 and add ubi9-based developer image #190

Merged
merged 9 commits into from
Nov 20, 2024
Merged

Conversation

dkwon17
Copy link
Collaborator

@dkwon17 dkwon17 commented Nov 13, 2024

Part of eclipse-che/che#23034

To test:

  1. Set env vars:
BASE_IMAGE=quay.io/<username>/<repo>:ubi9
UDI=quay.io/<username/<repo>:udi
  1. Build and push the base image
cd base/ubi9
DOCKER_BUILDKIT=1 docker image build --progress=plain -t $BASE_IMAGE .
docker push $BASE_IMAGE
  1. Build and push the udi image
    First, replace line 4 of the udi dockerfile here so that the base image matches the base image built from step 2.

Then, run the following:

cd universal/ubi9
DOCKER_BUILDKIT=1 docker image build --progress=plain -t $UDI .
docker push $UDI

I've built and pushed my own images for testing here:

quay.io/dkwon17/base-developer-image:ubi9-latest
quay.io/dkwon17/universal-developer-image:ubi9-latest
  1. Test by creating workspaces for the following cases

Case 1

The workspace starts with the base image:

<CHE_HOST>/#https://github.com/dkwon17/empty?image=<BASE_IMAGE>

Case 2

The workspace starts with the UDI image <CHE_HOST>/#https://github.com/dkwon17/quarkus-api-example/tree/per-workspace?image=<UDI>

Next, verify that the following command runs without any errors:

podman info

Run the Package and Build image devfile tasks to verify that podman image builds are also working.

Lastly, test kubedock by adding the KUBEDOCK_ENABLED=true env variable in the tooling container:

oc patch dw <workspace-name> --type='json' -p='[{"op": "add", "path": "/spec/template/components/0/container/env", "value": [{"name": "KUBEDOCK_ENABLED", "value": "true"}]}]' -n <namespace>

and by running the following when the workspace restarts:

$ podman run hello-world
!... Hello Podman World ...!

         .--"--.           
       / -     - \         
      / (O)   (O) \        
   ~~~| -=(,Y,)=- |         
    .---. /`  \   |~~      
 ~/  o  o \~~~~.----. ~~   
  | =(X)= |~  / (O (O) \   
   ~~~~~~~  ~| =(Y_)=-  |   
  ~~~~    ~~~|   U      |~~ 

Project:   https://github.com/containers/podman
Website:   https://podman.io
Desktop:   https://podman-desktop.io
Documents: https://docs.podman.io
YouTube:   https://youtube.com/@Podman
X/Twitter: @Podman_io
Mastodon:  @[email protected]

Additionally check that extensions from .vscode/extensions are installed:

image

Case 3

The workspace starts with the UDI image and podman build works.

After testing case 2, run the devfile: Package and the devfile: Build Image devfile tasks to build the container image:

...
STEP 9/10: USER 185
--> b2fc97577056
STEP 10/10: ENTRYPOINT [ "java", "-jar", "/deployments/quarkus-run.jar" ]
COMMIT image-registry.openshift-image-registry.svc:5000/openshift/quarkus-api-example
--> c44f4cfddabb
Successfully tagged image-registry.openshift-image-registry.svc:5000/openshift/quarkus-api-example:latest
c44f4cfddabb7817beec39951d1ceaabd4c575dbdf5a8e2b9a68ae012a383652
 *  Terminal will be reused by tasks, press any key to close it. 

Also, verify that the devfile: Start Development Mode command also runs without issues:

...
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ quarkus-api-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- quarkus-maven-plugin:2.6.3.Final:dev (default-cli) @ quarkus-api-example ---
[INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:testResources) @ quarkus-api-example
[e/src/main/kubernetes.ng for existing resources in: /projects/quarkus-api-exampl
__  ____  __  _____   ___  __ ____  ______ /projects/quarkus-api-example/src/test/resources
2024-11-13 04:34:09,161 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, hibernate-orm, hibernate-orm-panache, jdbc-postgresql, kubernetes, kubernetes-client, narayana-jta, resteasy, resteasy-jackson, smallrye-context-propagation, smallrye-openapi, swagger-ui, vertx]
--
Tests paused
Press [r] to resume testing, [o] Toggle test output, [h] for more options>

## gh-cli
RUN \
TEMP_DIR="$(mktemp -d)"; \
cd "${TEMP_DIR}"; \
GH_VERSION="2.23.0"; \
GH_VERSION="2.45.0"; \
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done to match the GH version in the ubi8 image:

GH_VERSION="2.45.0"; \

universal/ubi9/Dockerfile Outdated Show resolved Hide resolved
Copy link
Collaborator

@svor svor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkwon17 great work! All cases from the description work as expected. A few moments:

  • In the description (step 2 and 3) should be cd base/ubi9 and cd universal/ubi9
  • Maybe we should add an information about ubi9 and udi9 into README.md and CONTRIBUTING.md files as well?
  • Should we have a GH action for udi9 like Empty workspace smoke test on udi9?

base/ubi9/Dockerfile Outdated Show resolved Hide resolved
@dkwon17
Copy link
Collaborator Author

dkwon17 commented Nov 14, 2024

@svor thank you for the review!

In the description (step 2 and 3) should be cd base/ubi9 and cd universal/ubi9

Fixed

Maybe we should add an information about ubi9 and udi9 into README.md and CONTRIBUTING.md files as well?

I've added a commit to change some mentions of ubi8 to ubi9. Since we are planning to deprecate ubi8: eclipse-che/che#23034 I plan to make another PR to be merged after this current PR, to remove the ubi8 code and update the rest of the readme

Should we have a GH action for udi9 like Empty workspace smoke test on udi9?

I've added a new workflow for this in my latest commit

Copy link
Collaborator

@svor svor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few comments, but in general LGTM!

Signed-off-by: David Kwon <[email protected]>
@openshift-ci openshift-ci bot removed the lgtm label Nov 15, 2024
@dkwon17
Copy link
Collaborator Author

dkwon17 commented Nov 15, 2024

Thank you @svor , I updated the PR

Copy link
Contributor

@AObuchow AObuchow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some very minor comments but overall this looks great to me, awesome work @dkwon17 :)

base/ubi9/.stow-local-ignore Outdated Show resolved Hide resolved
base/ubi9/Dockerfile Outdated Show resolved Hide resolved
base/ubi9/Dockerfile Show resolved Hide resolved
base/ubi9/Dockerfile Outdated Show resolved Hide resolved
# Cloud

# oc client
ENV OC_VERSION=4.15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should update OC to the latest 4.17 (or 4.16 which is the first version of oc built specifically for RHEL 9 containers?). Though perhaps we're trying to keep as close of a 1-1 compatibility between the UBI8 and UBI9 based UDI images.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it as is for this PR, and potentially upgrade in a different PR

universal/ubi9/Dockerfile Outdated Show resolved Hide resolved
universal/ubi9/Dockerfile Show resolved Hide resolved
# Configure container engine
COPY --chown=0:0 containers.conf /etc/containers/containers.conf

ENV K8S_VERSION=1.28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, if we update OC we should also update to the corresponding k8s (kubectl) version that's bundled with OC.

Signed-off-by: David Kwon <[email protected]>
Signed-off-by: David Kwon <[email protected]>
Copy link
Contributor

@AObuchow AObuchow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, amazing work @dkwon17 :)

Copy link

openshift-ci bot commented Nov 20, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: AObuchow, dkwon17, svor

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@AObuchow
Copy link
Contributor

AObuchow commented Nov 20, 2024

Additional steps that should follow this PR (or could be included in it):

  • Update the GH Action to build and push the UBI9-based UDI, as we're only building the base image. I think we should be able to copy most of the logic used for the UBI8-based UDI
  • Update the README (here and here) to reference the UBI9-based images once they're hosted on quay.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants