Este conteúdo não está disponível no idioma selecionado.
Appendix C. Configuring a Jenkins freestyle project to deploy your application with the Fabric8 Maven Plugin
Similar to using Maven and the Fabric8 Maven Plugin from your local host to deploy an application, you can configure Jenkins to use Maven and the Fabric8 Maven Plugin to deploy an application.
Prerequisites
- Access to an OpenShift cluster.
- The Jenkins container image running on same OpenShift cluster.
- A JDK and Maven installed and configured on your Jenkins server.
- An application configured to use Maven, the Fabric8 Maven Plugin in the - pom.xml, and built using a RHEL base image.Note- For building and deploying your applications to OpenShift, Eclipse Vert.x 3.9 only supports builder images based on OpenJDK 8 and OpenJDK 11. Oracle JDK and OpenJDK 9 builder images are not supported. - Example - pom.xml- <properties> ... <fabric8.generator.from>registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift:latest</fabric8.generator.from> </properties> - <properties> ... <fabric8.generator.from>registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift:latest</fabric8.generator.from> </properties>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- The source of the application available in GitHub.
Procedure
- Create a new OpenShift project for your application: - Open the OpenShift Web console and log in.
- Click Create Project to create a new OpenShift project.
- Enter the project information and click Create.
 
- Ensure Jenkins has access to that project. - For example, if you configured a service account for Jenkins, ensure that account has - editaccess to the project of your application.
- Create a new freestyle Jenkins project on your Jenkins server: - Click New Item.
- Enter a name, choose Freestyle project, and click OK.
- Under Source Code Management, choose Git and add the GitHub url of your application.
- 
							Under Build, choose Add build step and select Invoke top-level Maven targets.
- Add the following to Goals: - clean fabric8:deploy -Popenshift -Dfabric8.namespace=MY_PROJECT - clean fabric8:deploy -Popenshift -Dfabric8.namespace=MY_PROJECT- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Substitute - MY_PROJECTwith the name of the OpenShift project for your application.
- Click Save.
 
- Click Build Now from the main page of the Jenkins project to verify your application builds and deploys to the OpenShift project for your application. - You can also verify that your application is deployed by opening the route in the OpenShift project of the application. 
Next steps
- 
					Consider adding GITSCM polling or using the Poll SCMbuild trigger. These options enable builds to run every time a new commit is pushed to the GitHub repository.
- Consider adding a build step that executes tests before deploying.