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

feat: Webapp-Wildfly supports S2I source builds too #201

Merged
merged 1 commit into from May 14, 2020

Conversation

manusa
Copy link
Member

@manusa manusa commented May 13, 2020

3 build modes:

  • Docker (Kubernetes) mvn k8s:build
  • OpenShift-Docker (S2I Binary) mvn oc:build -Djkube.build.strategy=docker
  • OpenShift-S2I (S2I Source) mvn oc:build

@manusa manusa mentioned this pull request May 13, 2020
@codecov
Copy link

codecov bot commented May 13, 2020

Codecov Report

Merging #201 into master will increase coverage by 0.04%.
The diff coverage is 38.46%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #201      +/-   ##
============================================
+ Coverage     26.22%   26.27%   +0.04%     
- Complexity     1577     1589      +12     
============================================
  Files           350      350              
  Lines         18276    18296      +20     
  Branches       2807     2808       +1     
============================================
+ Hits           4793     4807      +14     
- Misses        12925    12931       +6     
  Partials        558      558              
Impacted Files Coverage Δ Complexity Δ
.../org/eclipse/jkube/generator/api/FromSelector.java 69.76% <0.00%> (-18.47%) 6.00 <0.00> (ø)
...lipse/jkube/generator/webapp/AppServerHandler.java 25.00% <0.00%> (+25.00%) 1.00 <0.00> (+1.00)
...clipse/jkube/generator/webapp/WebAppGenerator.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...nerator/webapp/handler/WildFlyAppSeverHandler.java 82.60% <100.00%> (+49.27%) 20.00 <10.00> (+11.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ef0e0c...16f5ff6. Read the comment docs.

3 build modes:
 - Docker (Kubernetes)
 - OpenShift-Docker (S2I Binary)
 - OpenShift-S2I (S2I Source)

Signed-off-by: Marc Nuri <marc@marcnuri.com>
@rohanKanojia
Copy link
Member

Thanks a lot for this 👍 . I thought it's going to be more involved. I would test and take a look at this PR tomorrow.

@sonarcloud
Copy link

sonarcloud bot commented May 13, 2020

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

42.9% 42.9% Coverage
0.0% 0.0% Duplication

@manusa
Copy link
Member Author

manusa commented May 14, 2020

...I thought it's going to be more involved...

Implementation looks simple but it was quite involved.

The base S2I image needs to allow some way to be able to provide the packaged war and deploy it (instead of compiling it with the s2i builder image).

In this case, wildfly-s2i will copy any .war that's located in the /tmp/src/deployments. We can achieve this in a "hacky" way by setting the assembly name to deployments.

It's also important that both the Docker based image and the S2I image are in someway compatible so that we don't need to add too many specifics for each use case.

For this case, we've been lucky and most things will work OOTB for both (three in reality) scenarios.

I don't think this will be as easy for other S2I images, I'm still investigating this (which is what takes longer).

@rohanKanojia
Copy link
Member

Which project did you use to test this? I was trying on quickstarts/maven/webapp but somehow my application doesn't seem to be getting exposed:
Screenshot from 2020-05-14 11-31-25

I tried the default URL and also with /webapp but it is giving me 404.
When I'm doing oc:build (I removed buildStrategy=docker from XML config). I get this error:

~/work/repos/jkube/quickstarts/maven/webapp : $ mvn oc:build
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------< org.eclipse.jkube.quickstarts.maven:webapp >-------------
[INFO] Building Eclipse JKube :: Quickstarts :: Maven :: Webapp 1.0.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- openshift-maven-plugin:1.0.0-SNAPSHOT:build (default-cli) @ webapp ---
[INFO] oc: Using OpenShift build with strategy S2I
[INFO] oc: Running in OpenShift mode
[INFO] oc: Running generator webapp
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.447 s
[INFO] Finished at: 2020-05-14T11:30:47+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.jkube:openshift-maven-plugin:1.0.0-SNAPSHOT:build (default-cli) on project webapp: Execution default-cli of goal org.eclipse.jkube:openshift-maven-plugin:1.0.0-SNAPSHOT:build failed: S2I not yet supported for the webapp-generator. Use -Djkube.mode=kubernetes or -Djkube.build.strategy=docker for OpenShift mode. Please refer to the reference manual at https://www.eclipse.org/jkube/docs for details about build modes. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

@manusa
Copy link
Member Author

manusa commented May 14, 2020

Which project did you use to test this? I was trying on quickstarts/maven/webapp but somehow my application doesn't seem to be getting exposed..

webapp-wildfly, the one with the modified pom.xml in this PR that removes any sort of configuration for the image build.

@manusa
Copy link
Member Author

manusa commented May 14, 2020

It's good because you just tested that there is no regression in the WebAppGenerator.

@rohanKanojia
Copy link
Member

okay, it seems to be working for webapp-wildfly

@manusa manusa added this to Review in Sprint #184 May 14, 2020
@rohanKanojia rohanKanojia merged commit 7f3f70b into eclipse-jkube:master May 14, 2020
@rohanKanojia rohanKanojia moved this from Review to Done in Sprint #184 May 14, 2020
@manusa manusa deleted the feature/wildfly-s2i branch May 15, 2020 06:20
@manusa manusa mentioned this pull request May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Sprint #184
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants