Este contenido no está disponible en el idioma seleccionado.
Appendix C. Configuring a Jenkins freestyle project to deploy your Node.js application with nodeshift
Similar to using nodeshift from your local host to deploy a Node.js application, you can configure Jenkins to use nodeshift to deploy a Node.js application.
Prerequisites
- Access to an OpenShift cluster.
- The Jenkins container image running on same OpenShift cluster.
- The Node.js plugin installed on your Jenkins server.
- A Node.js application configured to use nodeshift and the Red Hat base image. - Example using the Red Hat base image with nodeshift - nodeshift --dockerImage=registry.access.redhat.com/rhscl/ubi8/nodejs-12 ... - $ nodeshift --dockerImage=registry.access.redhat.com/rhscl/ubi8/nodejs-12 ...- 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 Environment, make sure Provide Node & npm bin/ folder to PATH is checked and the Node.js environment is configured.
- 
							Under Build, choose Add build step and select Execute Shell.
- Add the following to the Command area: - npm install -g nodeshift nodeshift --dockerImage=registry.access.redhat.com/rhscl/ubi8/nodejs-12 --namespace=MY_PROJECT - npm install -g nodeshift nodeshift --dockerImage=registry.access.redhat.com/rhscl/ubi8/nodejs-12 --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 nodeshift as a global package when configuring the Node.js plugin. This allows you to omit npm install -g nodeshiftwhen adding yourExecute Shellbuild step.
- Consider adding a build step that executes tests before deploying.