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

[Fix/enhancement] dockerimage labels check and attempted to deduplicate #309

Closed

Conversation

jstourac
Copy link
Member

@jstourac jstourac commented Nov 3, 2023

Relates to: #292

Docker image labels reviewed

Description

This change tries to deduplicate some strings in our docker image labels with ability to propagate some common values directly from the Makefile so we don't need to change these values with every release branch or for every newly introduced docker image.

There were some minor fixes in the labels introduced too in this commit.


Notable points for discussion:

  1. I used value of the RELEASE variable for the build-ref at the moment - I understand that this may not be ideal. We may introduce separate value for this in Makefile or we can try to compute the value (either ref hash or branch name) dynamically in Makefile too. But in general - the value of the RELEASE should match what we've used so far.
  2. Also, some labels (authoritative-source-url and build commit ref at least) could be propagated directly from Makefile - in this case I mean by using the --label parameter. There are two drawbacks I can think of:
    1. We could lost them in case of an individual build because this way these won't be enforced by Dockerfile itself
    2. In this Dockerfile we have a slightly different naming for some labels which includes s2i infix - we would have to assure we don't change it wrongly.
      • Actually - do we want these s2i infixes?
  3. I didn't touch the Anaconda Base Dockerfile - looks like the labels there should deserve review too.

How Has This Been Tested?

I did a brief build of one image so far to check the idea behind the changes works. Will do more once the conversation here is finalized:

make codeserver-ubi9-python-3.9 -e IMAGE_REGISTRY=quay.io/jstourac/workbench-images

Result images can be seen in https://quay.io/repository/jstourac/workbench-images?tab=tags&tag=latest

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

@jstourac jstourac self-assigned this Nov 3, 2023
Copy link
Contributor

openshift-ci bot commented Nov 3, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign vaishnavihire for approval. For more information see the Kubernetes Code Review Process.

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

@atheo89
Copy link
Member

atheo89 commented Nov 10, 2023

Hey Jan! This changes looks good to me 🙂 I added a small comment on the proposal!

@jstourac
Copy link
Member Author

jstourac commented Dec 7, 2023

Okay, I rebased and updated with the change so that the AUTHORITATIVE_SOURCE_URL is now propagated also from Makefile. And I also used the BUILD_COMMIT_REF value in the io.openshift.build.source-location value.

@jstourac
Copy link
Member Author

jstourac commented Dec 8, 2023

Regarding the Anaconda - there are two LABEL definitions in the Dockerfile:

https://github.com/opendatahub-io/notebooks/blob/main/base/anaconda-python-3.8/Dockerfile#L25C1-L34C48

LABEL summary="$SUMMARY" \
      description="$DESCRIPTION" \
      io.k8s.description="$DESCRIPTION" \
      io.k8s.display-name="Anaconda Python 3.8" \
      io.openshift.expose-services="8080:http" \
      io.openshift.tags="anaconda,builder,python,python38,python-38,anaconda-python38" \
      name="anaconda-python38" \
      version="1" \
      usage="s2i build https://github.com/sclorg/s2i-python-container.git --context-dir=3.8/test/setup-test-app/ ubi8/python-38 python-sample-app" \
      maintainer="[email protected] for now..."

and

https://github.com/opendatahub-io/notebooks/blob/main/base/anaconda-python-3.8/Dockerfile#L87C1-L91C98

LABEL name="odh-notebook-base-ubi8-anaconda-python-3.8" \
      summary="Anaconda based Python 3.8 base image for ODH notebooks" \
      description="Anaconda Base Python 3.8 builder image based on UBI8 for ODH notebooks" \
      io.k8s.display-name="Anaconda Python 3.8 base image for ODH notebooks" \
      io.k8s.description="Anaconda Base Python 3.8 builder image based on UBI8 for ODH notebooks"

Is there anything what we want to do with it? Do we want to update the second section to similar format as is e.g. in:

https://github.com/opendatahub-io/notebooks/blob/main/base/ubi9-python-3.9/Dockerfile#L3C1-L11C91

LABEL name="odh-notebook-base-ubi9-python-3.9" \
      summary="Python 3.9 base image for ODH notebooks" \
      description="Base Python 3.9 builder image based on UBI9 for ODH notebooks" \
      io.k8s.display-name="Python 3.9 base image for ODH notebooks" \
      io.k8s.description="Base Python 3.9 builder image based on UBI9 for ODH notebooks" \
      authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
      io.openshift.build.commit.ref="main" \
      io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/base/ubi9-python-3.9" \
      io.openshift.build.image="quay.io/opendatahub/workbench-images:base-ubi9-python-3.9"

Copy link
Member

@harshad16 harshad16 left a comment

Choose a reason for hiding this comment

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

initial thought which made me hesitate were that, we would need to do this separately in downstream, however as we pretty much follow the similar methodology.
This would indeed help with both streams.

@jstourac can you rebase and update the PR.

@harshad16
Copy link
Member

Regarding the Anaconda - there are two LABEL definitions in the Dockerfile:
...
Is there anything what we want to do with it? Do we want to update the second section to similar format as is e.g. in:

https://github.com/opendatahub-io/notebooks/blob/main/base/ubi9-python-3.9/Dockerfile#L3C1-L11C91

LABEL name="odh-notebook-base-ubi9-python-3.9" \
      summary="Python 3.9 base image for ODH notebooks" \
      description="Base Python 3.9 builder image based on UBI9 for ODH notebooks" \
      io.k8s.display-name="Python 3.9 base image for ODH notebooks" \
      io.k8s.description="Base Python 3.9 builder image based on UBI9 for ODH notebooks" \
      authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
      io.openshift.build.commit.ref="main" \
      io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/base/ubi9-python-3.9" \
      io.openshift.build.image="quay.io/opendatahub/workbench-images:base-ubi9-python-3.9"

Updating the 2nd part exclusively the jupyter/anaconda-x part , same as other would be prefered.

@jstourac
Copy link
Member Author

Thank you, @harshad16, for your review. I'll try to find some time for this this week 🙂

authoritative-source-url="${AUTHORITATIVE_SOURCE_URL}" \
io.openshift.build.commit.ref="${BUILD_COMMIT_REF}" \
io.openshift.build.source-location="${AUTHORITATIVE_SOURCE_URL}/tree/${BUILD_COMMIT_REF}/base/anaconda-python-3.8" \
io.openshift.build.image="${IMAGE_REGISTRY}:base-c9s-python-3.9" TODO ?????
Copy link
Member Author

@jstourac jstourac Feb 2, 2024

Choose a reason for hiding this comment

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

@harshad16 I'm not quite sure what value should be put on this place. I wasn't able to find the image in the https://quay.io/repository/opendatahub/workbench-images - did I miss it somehow? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

This particular is not built on the ODH,
it is exclusively only built downstream.
we should probably clean a few of these.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see. So, do you prefer me to remove just this io.openshift.build.image label or all four in this case?

The first three are still valid and could be reused for the downstream part. Although, if there is no image build in upstream, I understand that it doesn't make much sense to have them here either.

Copy link
Member

Choose a reason for hiding this comment

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

yeah true,
we can remove all of these:

 authoritative-source-url
 io.openshift.build.commit.ref
 io.openshift.build.source-location
 io.openshift.build.image

as this more for anyone , who would like to build it, though we wouldn't be building it in upstream.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you, Harshad! Updated 🙂

This change tries to deduplicate some strings in our docker image labels
with ability to propagate some common values directly from the Makefile
so we don't need to change these values with every release branch or for
every newly introduced docker image.

There were some minor fixes in the labels introduced too in this commit.

---

Relates to: opendatahub-io#292
@harshad16
Copy link
Member

The PR looks great, my major concern is this would break the current CI build from openshift CI
and that doesn't completely rely on makefile.
https://github.com/openshift/release/blob/358594a0d50341051cdd9eb1137757a734fab063/ci-operator/config/opendatahub-io/notebooks/opendatahub-io-notebooks-main.yaml#L8
the CI , doesn't take in build args, which make cause this issue.
Result image of this PR needs to be tested.

@jstourac
Copy link
Member Author

Thank you, Harshad, for pointing this out. I missed that bits. I'll try to check whether I am able to amend our CI so we can merge this eventually.

@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@harshad16
Copy link
Member

The PR looks great, my major concern is this would break the current CI build from openshift CI and that doesn't completely rely on makefile. https://github.com/openshift/release/blob/358594a0d50341051cdd9eb1137757a734fab063/ci-operator/config/opendatahub-io/notebooks/opendatahub-io-notebooks-main.yaml#L8 the CI , doesn't take in build args, which make cause this issue. Result image of this PR needs to be tested.

Due to this, we are changing this PR to the draft.

@harshad16 harshad16 marked this pull request as draft May 31, 2024 03:49
Copy link
Contributor

openshift-ci bot commented May 31, 2024

@jstourac: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/runtime-cuda-tensorflow-ubi9-python-3-9-pr-image-mirror 1326d63 link true /test runtime-cuda-tensorflow-ubi9-python-3-9-pr-image-mirror
ci/prow/runtime-cuda-tensorflow-ubi8-python-3-8-pr-image-mirror 1326d63 link true /test runtime-cuda-tensorflow-ubi8-python-3-8-pr-image-mirror
ci/prow/notebook-cuda-rstudio-c9s-python-3-9-pr-image-mirror 1326d63 link true /test notebook-cuda-rstudio-c9s-python-3-9-pr-image-mirror
ci/prow/notebook-jupyter-trustyai-ubi8-python-3-8-pr-image-mirror 1326d63 link true /test notebook-jupyter-trustyai-ubi8-python-3-8-pr-image-mirror
ci/prow/notebook-habana-1-10-0-ubi8-python-3-8-pr-image-mirror 1326d63 link true /test notebook-habana-1-10-0-ubi8-python-3-8-pr-image-mirror
ci/prow/notebooks-e2e-tests 1326d63 link true /test notebooks-e2e-tests
ci/prow/images 1326d63 link true /test images
ci/prow/habana-notebooks-e2e-tests 1326d63 link true /test habana-notebooks-e2e-tests
ci/prow/runtime-intel-ml-ubi9-python-3-9-pr-image-mirror 1326d63 link true /test runtime-intel-ml-ubi9-python-3-9-pr-image-mirror
ci/prow/notebook-habana-1-13-0-ubi8-python-3-8-pr-image-mirror 1326d63 link true /test notebook-habana-1-13-0-ubi8-python-3-8-pr-image-mirror
ci/prow/runtime-intel-tf-xpu-ubi9-py-3-9-pr-image-mirror 1326d63 link true /test runtime-intel-tf-xpu-ubi9-py-3-9-pr-image-mirror
ci/prow/runtime-intel-pyt-cpu-ubi9-py-3-9-pr-image-mirror 1326d63 link true /test runtime-intel-pyt-cpu-ubi9-py-3-9-pr-image-mirror
ci/prow/notebook-jupyter-intel-pyt-cpu-ubi9-py-3-9-pr-image-mirror 1326d63 link true /test notebook-jupyter-intel-pyt-cpu-ubi9-py-3-9-pr-image-mirror
ci/prow/notebook-jupyter-intel-pyt-xpu-ubi9-py-3-9-pr-image-mirror 1326d63 link true /test notebook-jupyter-intel-pyt-xpu-ubi9-py-3-9-pr-image-mirror
ci/prow/notebook-jupyter-intel-tf-xpu-ubi9-py-3-9-pr-image-mirror 1326d63 link true /test notebook-jupyter-intel-tf-xpu-ubi9-py-3-9-pr-image-mirror
ci/prow/runtime-intel-pyt-xpu-ubi9-py-3-9-pr-image-mirror 1326d63 link true /test runtime-intel-pyt-xpu-ubi9-py-3-9-pr-image-mirror
ci/prow/notebook-jupyter-intel-tf-cpu-ubi9-py-3-9-pr-image-mirror 1326d63 link true /test notebook-jupyter-intel-tf-cpu-ubi9-py-3-9-pr-image-mirror
ci/prow/runtime-intel-tf-cpu-ubi9-py-3-9-pr-image-mirror 1326d63 link true /test runtime-intel-tf-cpu-ubi9-py-3-9-pr-image-mirror
ci/prow/notebook-amd-jupyter-minimal-c9s-python-3-9-pr-image-mirror 1326d63 link true /test notebook-amd-jupyter-minimal-c9s-python-3-9-pr-image-mirror
ci/prow/notebook-amd-c9s-python-3-9-pr-image-mirror 1326d63 link true /test notebook-amd-c9s-python-3-9-pr-image-mirror
ci/prow/notebook-jupyter-intel-pyt-ubi9-python-3-9-pr-image-mirror 1326d63 link true /test notebook-jupyter-intel-pyt-ubi9-python-3-9-pr-image-mirror
ci/prow/runtime-intel-pyt-ubi9-python-3-9-pr-image-mirror 1326d63 link true /test runtime-intel-pyt-ubi9-python-3-9-pr-image-mirror
ci/prow/runtime-intel-tf-ubi9-python-3-9-pr-image-mirror 1326d63 link true /test runtime-intel-tf-ubi9-python-3-9-pr-image-mirror
ci/prow/notebook-jupyter-intel-ml-ubi9-python-3-9-pr-image-mirror 1326d63 link true /test notebook-jupyter-intel-ml-ubi9-python-3-9-pr-image-mirror
ci/prow/notebook-jupyter-intel-tf-ubi9-python-3-9-pr-image-mirror 1326d63 link true /test notebook-jupyter-intel-tf-ubi9-python-3-9-pr-image-mirror

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@jstourac jstourac closed this Jun 19, 2024
@jstourac jstourac deleted the enhanceDockerimageLabels branch June 19, 2024 12:51
@jstourac jstourac restored the enhanceDockerimageLabels branch July 4, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants