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

Build fails using odo create openjdk-1.8 command with parameter --binary #511

Closed
cmoulliard opened this issue Jun 5, 2018 · 8 comments
Closed
Assignees
Labels
estimated-size/L (20-40) Rough sizing for Epics. About 2 sprints of work for a person. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).

Comments

@cmoulliard
Copy link
Contributor

cmoulliard commented Jun 5, 2018

According to the command doc, we can create a component and the buildConfig if we pass as parameter by example --binary

Examples:
  # Create new Node.js component with the source in current directory. 
  odo create nodejs

  # Create new Node.js component named 'frontend' with the source in './frontend' directory
  odo create nodejs frontend --local ./frontend

  # Create new Node.js component with source from remote git repository.
  odo create nodejs --git https://github.com/openshift/nodejs-ex.git

  # Create new Wildfly component with binary named sample.war in './downloads' directory
  odo create wildfly wildly --binary ./downloads/sample.war

Unfortunately, that will fail if we use this command as s2i build will use the python s2i docker image

odo create openjdk18 sb1 --binary ./target/ocp-fmp-build-install-1.0-exec.jar
...

Cloning "https://github.com/kadel/bootstrap-supervisored-s2i " ...
--
  | Commit:	66370523614e0873977d369378c62e8b0c49b28f (run assemble/run scripts  in source code .s2i direcotry)
  | Author:	Tomas Kral <tkral@redhat.com>
  | Date:	Tue Apr 24 15:53:25 2018 +0200
  | + set -eo pipefail
  | + PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/s2i
  | + HOME=/opt/app-root
  | + curl -s -o /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
  | + /usr/bin/python /tmp/get-pip.py --user
  | The directory '/opt/app-root/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
  | The directory '/opt/app-root/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
  | Collecting pip
  | Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl  (1.3MB)
  | Collecting setuptools
  | Downloading https://files.pythonhosted.org/packages/7f/e1/820d941153923aac1d49d7fc37e17b6e73bfbd2904959fffbad77900cf92/setuptools-39.2.0-py2.py3-none-any.whl  (567kB)
  | Collecting wheel
  | Downloading https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl  (41kB)
  | Installing collected packages: pip, setuptools, wheel
  | Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/opt/app-root'
  | Check the permissions.
  | error: build error: non-zero (13) exit code from registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift@sha256:aa51a265d9a1650c7371879b3f58b40987675aa80a589cafcadec360a71e63a6


BuildConfig fil;e generated is

apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  annotations:
    app.kubernetes.io/component-source-type: binary
    app.kubernetes.io/url: >-
      file:///Users/dabou/Temp/to-be-deleted/ocp-odo-build-install/target/ocp-fmp-build-install-1.0-exec.jar
  labels:
    app: odoapp
    app.kubernetes.io/component-name: sb1
    app.kubernetes.io/component-type: openjdk18
    app.kubernetes.io/name: odoapp
  name: sb1
  namespace: odo
spec:
  failedBuildsHistoryLimit: 5
  nodeSelector: null
  output:
    to:
      kind: ImageStreamTag
      name: 'sb1:latest'
  postCommit: {}
  resources: {}
  runPolicy: Serial
  source:
    git:
      ref: v0.0.1
      uri: 'https://github.com/kadel/bootstrap-supervisored-s2i'
    type: Git
  strategy:
    sourceStrategy:
      from:
        kind: ImageStreamTag
        name: 'openjdk18:latest'
        namespace: openshift
    type: Source
  successfulBuildsHistoryLimit: 5
  triggers: []

I'm expecting that a SourceStream Binary strategy will be used here and not git as source.

@kadel
Copy link
Member

kadel commented Jun 6, 2018

--binary in odo is something different than binary source in BuildConfig.
In odo binary means that you already build an applicational and providing just binary (compiled) artifact to the component.

BuildConfig is not there for building the application. It is just injecting supervisord into s2i image. So we can keep it constantly running without the need to restart the whole container after each application rebuild.
We could delete BuildConfig. After the component is created, it doesn't serve any purpose and it is no longer needed.

@cmoulliard
Copy link
Contributor Author

cmoulliard commented Jun 6, 2018

just binary (compiled) artifact to the component.

This is what I'm doing as I provide the jar file generated locally --> odo create openjdk18 sb1 --binary ./target/ocp-fmp-build-install-1.0-exec.jar

So what is then wrong ? How can odo create correctly the BuildConfig which should be equal to this one - https://goo.gl/MwGuLJ ? @kadel

@kadel
Copy link
Member

kadel commented Jun 6, 2018

When creating odo component that uses binary (or local directory) as a source BuildConfig is not needed, everything happens directly in the running container without triggering BuildConfig. BuildConfig is there only for initializing new component but it is not used afterward.

The problem in this case is that registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift doesn't have /opt/app-root directory. Our scripts are expecting that every s2i image has that :-(

The current way how we inject SupervisorD process to s2i images (we need this to make odo watch and odo push work quickly) is based on https://github.com/openshift-evangelists/pseudo-vps-quickstart. We will be looking into ways to improve this, we know that current solution is not ideal and universal.

@cmoulliard
Copy link
Contributor Author

So for the moment, oc new-build is better than odo create for local or binary builds ;-)

As i can imagine that s2i - build is an option that odo must support, it is also nevertheless important to think about the future and how we could propose a better way to perform build on OpenShift. I will open another ticket to discuss such ideas.

@kadel
Copy link
Member

kadel commented Jun 7, 2018

So for the moment, oc new-build is better than odo create for local or binary builds ;-)

For some builder images, like openjdk one used in this case, yes :-(

@kadel
Copy link
Member

kadel commented Jun 12, 2018

Some discussion related to this is in #445

@kadel kadel added backlog priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). labels Jun 12, 2018
@cdrage cdrage self-assigned this Sep 12, 2018
@cdrage cdrage added size/L and removed size/XL labels Sep 12, 2018
@cdrage cdrage added this to To do in Sprint 155 via automation Sep 12, 2018
@kadel kadel removed this from To do in Sprint 155 Oct 3, 2018
@cdrage
Copy link
Member

cdrage commented Oct 23, 2018

So this works with wildfly, but obviously we want it to work with the openjdk18 images. How do you think we could proceed with that? I have a feeling we'll have to update our supervisord image to correctly detect and use the /opt/app-root directory.

Output of testing with wildfly located below:

github.com/redhat-developer/odo  master ✔                                                                                                                                     4h6m  ⍉
▶ ./odo create wildfly --binary ~/ocp-fmp-build-install/target/ocp-fmp-build-install-1.0-exec.jar      
Component 'ocp-fmp-buil-wildfly-jlpd' was created and port 8080/TCP was opened
To push source code to the component run 'odo push'

Component 'ocp-fmp-buil-wildfly-jlpd' is now set as active component.

github.com/redhat-developer/odo  master ✔                                                                                                                                      4h6m
▶ ./odo push
Pushing changes to component: ocp-fmp-buil-wildfly-jlpd
^C

github.com/redhat-developer/odo  master ✔                                                                                                                                     4h6m  ⍉
▶ ./odo push -v 4
I1023 14:52:07.397731   10868 occlient.go:265] Trying to connect to server 192.168.42.174:8443
I1023 14:52:07.398051   10868 occlient.go:271] Server https://192.168.42.174:8443 is up
I1023 14:52:07.409522   10868 occlient.go:248] isLoggedIn err:  <nil>
 output: "developer"
I1023 14:52:07.410235   10868 push.go:45] No component name passed, assuming current component
Pushing changes to component: ocp-fmp-buil-wildfly-jlpd
I1023 14:52:07.410913   10868 occlient.go:1909] Getting DeploymentConfig: ocp-fmp-buil-wildfly-jlpd-odo-lfwi
I1023 14:52:07.433164   10868 component.go:476] Source for component ocp-fmp-buil-wildfly-jlpd is file:///home/wikus/ocp-fmp-build-install/target/ocp-fmp-build-install-1.0-exec.jar (binary)
I1023 14:52:07.433195   10868 push.go:97] Copying file /home/wikus/ocp-fmp-build-install/target/ocp-fmp-build-install-1.0-exec.jar to pod
I1023 14:52:07.449001   10868 occlient.go:1110] Waiting for deploymentconfig=ocp-fmp-buil-wildfly-jlpd-odo-lfwi pod
I1023 14:52:07.463865   10868 occlient.go:1125] Status of ocp-fmp-buil-wildfly-jlpd-odo-lfwi-1-t6z8z pod is Pending
I1023 14:52:07.664299   10868 occlient.go:1125] Status of ocp-fmp-buil-wildfly-jlpd-odo-lfwi-1-t6z8z pod is Running
I1023 14:52:07.664313   10868 occlient.go:1128] Pod ocp-fmp-buil-wildfly-jlpd-odo-lfwi-1-t6z8z is running.
I1023 14:52:07.664333   10868 component.go:343] Copying to pod ocp-fmp-buil-wildfly-jlpd-odo-lfwi-1-t6z8z
jPlease wait, building component....
+ set -eo pipefail
+ '[' -f /opt/app-root/src/.s2i/bin/assemble ']'
+ '[' -f /usr/local/s2i/assemble ']'
+ /usr/libexec/s2i/assemble
cp: cannot stat '/opt/s2i/destination/src/.': No such file or directory
Moving binaries in source directory into /wildfly/standalone/deployments for later deployment...
Moving all war artifacts from /opt/app-root/src/. directory into /wildfly/standalone/deployments for later deployment...
Moving all ear artifacts from /opt/app-root/src/. directory into /wildfly/standalone/deployments for later deployment...
Moving all rar artifacts from /opt/app-root/src/. directory into /wildfly/standalone/deployments for later deployment...
Moving all jar artifacts from /opt/app-root/src/. directory into /wildfly/standalone/deployments for later deployment...
'/opt/app-root/src/./ocp-fmp-build-install-1.0-exec.jar' -> '/wildfly/standalone/deployments/ocp-fmp-build-install-1.0-exec.jar'
removed '/opt/app-root/src/./ocp-fmp-build-install-1.0-exec.jar'
'/opt/app-root/src/./ocp-fmp-build-install-1.0.jar' -> '/wildfly/standalone/deployments/ocp-fmp-build-install-1.0.jar'
removed '/opt/app-root/src/./ocp-fmp-build-install-1.0.jar'
...done
+ /var/lib/supervisord/bin/supervisord ctl stop run
run: stopped
+ /var/lib/supervisord/bin/supervisord ctl start run
run: started
changes successfully pushed to component: ocp-fmp-buil-wildfly-jlpd
I1023 14:52:10.585396   10868 root.go:119] Could not get the latest release information in time. Never mind, exiting gracefully :)

github.com/redhat-developer/odo  master ✔                                                                                                                                      4h6m
▶ ./odo url create
Adding URL to component: ocp-fmp-buil-wildfly-jlpd
URL created for component: ocp-fmp-buil-wildfly-jlpd

ocp-fmp-buil-wildfly-jlpd - http://ocp-fmp-buil-wildfly-jlpd-odo-lfwi-myproject.192.168.42.174.nip.io

@kadel
Copy link
Member

kadel commented Nov 15, 2018

This was fixed thanks to #622 and #924

@kadel kadel closed this as completed Nov 15, 2018
@rm3l rm3l added the estimated-size/L (20-40) Rough sizing for Epics. About 2 sprints of work for a person. label Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
estimated-size/L (20-40) Rough sizing for Epics. About 2 sprints of work for a person. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).
Projects
Archived in project
Development

No branches or pull requests

4 participants