Developing Using DevPods
Jenkins X allows you to edit app code by using a Kubernetes Pod which we call
DevPod. This helps you develop inside the cloud with the same software tools, platform, container images and pod templates as the CI/CD pipelines. This helps keep everyone in the team and your CI/CD pipelines using the same platform and tools all the time to reduce waste and avoid those pesky ‘it works on my laptop but not in production’ issues.
There are a couple of ways that you as a developer can quickly become productive when editing an app, and add value ultra fast.
There are specific steps for each approach, and we provide you a visual representation of each workflow, as well as the specific steps to quickly get started.
Develop Using DevPods and a desktop IDE
In this scenario, you are using a desktop IDE such as VS Code or Intellij which in fact have a plugin for
Jenkins X. You are making iterative changes using your IDE and said changes are reflected immediately when you open the
url assigned to your
To get started using this approach, simply execute the following command in the root of your app directory. We are using a
NodeJS app for this example, therefore we specify the language using the
jx create devpod -l nodejs --reuse --sync
A successful execution will ensures the following happened:
- Output the
URLsavailable to access the
- App folder will sync with the
- An ssh session is initiated to the
Once this happens, you must execute one more command within your ssh session to the Pod to ensure any changes are synchronized.
Once you are happy with changes to your app, you go to (step 2 in diagram) and check-in your code, create a
Pull Request at which point a
Jenkins X Pipeline is triggered immediately to promote your changes to
Develop Using DevPods and a Web-based IDE
If you prefer not to use an IDE on your desktop using a similar workflow as above. To edit the app code, you use the well known Theia IDE.
Using this approach, you execute the following on your terminal.
jx create devpod --verbose true # some output us removed for brevity Creating a DevPod of label: nodejs Created pod me-nodejs - waiting for it to be ready... Using helmBinary helm with feature flag: none Updating Helm repository... Helm repository update done. ... Pod me-nodejs is now ready! You can open other shells into this DevPod via jx create devpod You can edit your app using Theia (a browser based IDE) at http://me-nodejs-theia.jx.yourdomain.com Attempting to install Bash Completion into DevPod Running command: kubectl exec -it -n jx -c theia me-nodejs -- /bin/sh -c mkdir -p /workspace cd /workspace ... [root@me-nodejs node-app]#
--syncflag because we plan on using the web based IDE
A succesful execution of the command above, will ensure the following has happened:
- DevPod is created, and exposed for you to access app via URL
- Theia Docker container is running
- App folder is mounted to Theia Docker container at
- You have a terminal session into the
To see your changes in real-time, you must also execute the following command within your terminal session connected to the Pod:
Promote to Staging
Once you are happy with the changes you made to the app, you can simply check-in your code and create a
pull request. This will trigger the pipeline to promote your changes to the
Staging environment (Step 2 and 3 in diagram)
Promote to Production
Most of the time,the Production environment in Jenkins X will have its
Promote setting set to
MANUAL. Therefore, promoting your app can happen manually after stakeholders have reviewed the staging envionment, for example.
To promote the app to production, you can execute the following commands:
first get the app version from this output
jx get apps
promote app version 0.0.2 from staging to production
jx promote --version 0.0.2 --env production
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.