-
Notifications
You must be signed in to change notification settings - Fork 116
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
Unset MAVEN_CONFIG env in Maven based images #160
Conversation
Signed-off-by: svor <vsvydenk@redhat.com>
@@ -31,7 +33,11 @@ while read -r line; do | |||
base_image_name=$(echo "$line" | tr -s ' ' | cut -f 1 -d ' ') | |||
base_image=$(echo "$line" | tr -s ' ' | cut -f 2 -d ' ') | |||
echo "Building ${NAME_FORMAT}/${base_image_name}:${TAG} based on $base_image ..." | |||
docker build -t "${NAME_FORMAT}/${base_image_name}:${TAG}" --no-cache --build-arg FROM_IMAGE="$base_image" "${SCRIPT_DIR}"/ | |||
script_dir=${SCRIPT_DIR} | |||
if [[ ${base_image:0:5} = ${MAVEN_BASE} ]] ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a too-restrictive check. What if the base image name is just a java image which happens to have maven in it? https://github.com/redhat-developer/codeready-workspaces/blob/master/dependencies/che-devfile-registry/devfiles/02_java-maven/devfile.yaml#L18
Why not do a check like this?
# substring check for "java" or "maven" in ${base_image}
if [[ ${base_image} = *"maven"* ]] || [[ ${base_image} = *"java"* ]]; then
Also this assumes that there's a special maven/Dockerfile to use for maven-based images... which we're not doing in downstream CRW... so this would possibly break the ability to use the same build_images.sh script. But TBH I'm not sure if we're actually using any of that.
So... +1, this seems OK.
I just don't like your "if first 5 chars of string = 'maven'" check, but YMMV. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I continue to be strongly against this sort of patch in the arbitrary user patch section. If we want an image with MAVEN_CONFIG
unset then we should build one explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also worth noting that this workaround is specific to the dockerhub community maven image, and is not necessary in e.g. an image where you install maven yourself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, probably OK with no impact on downstream as our stack/sidecar images are hard forks from this upstream Alpine stuff as we have to use UBI
Should we do a similar change to the devfile.yaml files for these? https://github.com/redhat-developer/codeready-workspaces/blob/master/dependencies/che-devfile-registry/devfiles/00_java-eap-maven/devfile.yaml#L20-L21 And do I need to apply |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm strongly against running a image-specific patch in a general script. If we want custom images we should build custom images in their own repo.
If all that is required is setting MAVEN_CONFIG=
then why can't this be done in the devfile, or alternatively, why can't we use a different maven image?
@@ -31,7 +33,11 @@ while read -r line; do | |||
base_image_name=$(echo "$line" | tr -s ' ' | cut -f 1 -d ' ') | |||
base_image=$(echo "$line" | tr -s ' ' | cut -f 2 -d ' ') | |||
echo "Building ${NAME_FORMAT}/${base_image_name}:${TAG} based on $base_image ..." | |||
docker build -t "${NAME_FORMAT}/${base_image_name}:${TAG}" --no-cache --build-arg FROM_IMAGE="$base_image" "${SCRIPT_DIR}"/ | |||
script_dir=${SCRIPT_DIR} | |||
if [[ ${base_image:0:5} = ${MAVEN_BASE} ]] ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I continue to be strongly against this sort of patch in the arbitrary user patch section. If we want an image with MAVEN_CONFIG
unset then we should build one explicitly.
@amisevsk My point was to unset |
What if we built a pair of small, UBI 8 based images that work on OpenShift and include either JDK 8 or 11? Then you would not be dependent on Alpine, would get the benefits of CVE fixes, and would provide something that could more closely be used for downstream too. Also the JDK 11 image could be the basis for quarkus devfiles. |
I'm happy with either option
Both also have (minor) downsides:
|
Yes, and that's a problem. How can you rely on an image if you have no idea how to build it? :( How about we use That's the one that's ref'd in #144 I also don't know how it's built but i do see it as the last line in the list in https://github.com/eclipse/che-devfile-registry/blob/master/arbitrary-users-patch/base_images |
As a base image it's |
Signed-off-by: svor <vsvydenk@redhat.com>
@amisevsk So, as we decided in the issue eclipse-che/che#13926 (comment), I set empty value for MAVEN_CONFIG in devfiles where the sample uses mvnw utility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM generally. Tested java-web-spring
and java-maven
-- mvnw
works without issue now.
@@ -26,8 +26,8 @@ components: | |||
alias: maven | |||
image: quay.io/eclipse/che-java8-maven:nightly | |||
env: | |||
- name: MAVEN_CONFIG | |||
value: "/home/user/.m2" | |||
- name: MAVEN_CONFIG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some stray whitespace here
@@ -18,8 +18,6 @@ components: | |||
alias: maven | |||
image: quay.io/eclipse/che-java11-maven:nightly | |||
env: | |||
- name: MAVEN_CONFIG | |||
value: /home/user/.m2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also unset MAVEN_CONFIG
here, since the base image has MAVEN_CONFIG=/root/.m2
by default. Our sample project doesn't use mvnw
but it might trip up someone trying to import their own project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unset for all maven based devfiles
Signed-off-by: svor <vsvydenk@redhat.com>
Signed-off-by: svor <vsvydenk@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
* set memory limit for php-intelephense plugin Signed-off-by: Valeriy Svydenko <vsvydenk@redhat.com> * Increase memory limit for php-intelephense plugin Signed-off-by: Valeriy Svydenko <vsvydenk@redhat.com>
Signed-off-by: svor vsvydenk@redhat.com
What does this PR do?
This PR unsets MAVEN_CONFIG env to make it possible to run mvnw scripts.
What issues does this PR fix or reference?
eclipse-che/che#13926