Jenkins

This chapter shows how to integrate with FeaturePeek when using the Jenkins continuous integration service.

Prerequisite: You should create a FeaturePeek account and configure your peek.yml file before following the steps in this chapter.

Example Jenkinsfile config

If you already have your Jenkinsfile set up, simply add a phase including the FeaturePeek CI command after your build phase.

If you don't have your Jenkinsfile set up yet, take a look at these examples provided by Jenkins to get started.

If your frontend pushes to the Google Container Registry, your Jenkinsfile file would look something like this (using the withCredentials plugin):

pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
stage('Ping FeaturePeek') {
steps {
withCredentials([
string(credentialsId: "GOOGLE_COMPUTE_ZONE", variable: 'GOOGLE_COMPUTE_ZONE'),
string(credentialsId: "GOOGLE_PROJECT_ID", variable: 'GOOGLE_PROJECT_ID'),
string(credentialsId: "GCLOUD_SERVICE_KEY", variable: 'GCLOUD_SERVICE_KEY'),
]) {
env.GOOGLE_COMPUTE_ZONE = "${GOOGLE_COMPUTE_ZONE}"
env.GOOGLE_PROJECT_ID = "${GOOGLE_PROJECT_ID}"
env.GCLOUD_SERVICE_KEY = "${GCLOUD_SERVICE_KEY}"
sh "curl -s https://peek.run/ci | bash -s -- -p gcr.io/${GOOGLE_PROJECT_ID}/my-project:latest"
}
}
}
}
}

Sample code repo

You can search the FeaturePeek org on GitHub to find sample repos of frontends that integrate FeaturePeek with Jenkins. Be sure to visit the open pull requests to find links to running public FeaturePeek deployments.

Additionally, the repo that powers this documentation builds with Jenkins — you can view the real-world code to see how easy it is to integrate with FeaturePeek. Be sure to take a look at the Jenkinsfile and any open pull requests to see links to running public FeaturePeek deployments.

Try it out

Try opening a new pull request that contain the changes in this chapter. When your CI finishes successfully, you should see the FeaturePeek bot comment a link on your pull request. If not, consult our Troubleshooting section.