Why integrate Jenkins and Codefresh?
Many development shops have made a big investment in Jenkins for their CI, but with the growing popularity of containers such as Docker, there is a need for a new kind of CI/CD platform, one that is container-native.
That said, not all of the software components in a typical build process are whole applications that can be packaged and delivered in a Docker container. Instead, they are external components, such as libraries, modules, drivers, etc. For these components we actually need to use a traditional CI server.
The result is a need to combine a traditional CI server, such as Jenkins, for non-containerized components, together with a container-native CI tool for the final application images.
How to get started
- Install the plugin from the official Jenkins plugin repository using the Jenkins ‘Manage Plugins’ interface (as described here). Search for ‘Codefresh’ in the list of available plugins.
- Define the connection to Codefresh in Jenkins system configuration (Manage Jenkins->Configure system-> scroll down to find ‘Define Codefresh Integration‘). This requires filling out your user name and Codefresh authentication token. You can verify the authentication by using the ‘Test Connection‘ button. To find your authentication token:
- Log in to Codefresh and then open https://g.codefresh.io/
api/ in another tab of the same browser - Copy your token from the right-hand text field on the Swagger header
- Log in to Codefresh and then open https://g.codefresh.io/
- Trigger Codefresh pipeline execution from your freestyle Jenkins jobs:
- ‘Add Build Step’ -> ‘Codefresh Integration’
- ‘Launch Codefresh build’ is checked by default and will trigger the pipeline that corresponds to the Git repo defined in the job’s SCM configuration
- If there’s no SCM defined for the current job, or you would like to trigger a different service pipeline, check the ‘Select Codefresh Service’ option. This will present you with a drop-down list of all your defined Codefresh services.
Once configured, the plugin will trigger Codefresh to run your Docker build+tests and report the results.
Upcoming features
- Add the option to launch a service/composition
- Return environment URL and make available as Jenkins environment variable (for subsequent testing)
- Display environment status (running/stopped) and link on Jenkins UI
We hope this plugin will make it even easier to integrate Codefresh into your existing continuous delivery pipeline. Please send us your feedback and suggestions regarding the Codefresh + Jenkins integration. We’d love to help with anything that can streamline your day-to-day development and testing flows.