...

/

Extending Environment Pipelines

Extending Environment Pipelines

This lesson explains how to extend the environment pipelines to add integration tests.

Where to add integration tests?

We could add integration tests in the pipelines of our applications, but that’s probably not the right place. The idea behind integration tests is to validate whether the system is integrated (hence the name). So, pipelines used to deploy to environments are probably better candidates for such tests. We already did a similar change with the static Jenkins X by modifying Jenkinsfile in staging and production repositories. Let’s see how we can accomplish a similar effect through the new format introduced in serverless Jenkins X.

⚠️ Please replace [...] with your GitHub user before executing the commands that follow.

Press + to interact
cd ..
GH_USER=[...]
git clone \
https://github.com/$GH_USER/environment-jx-rocks-staging.git
cd environment-jx-rocks-staging

We cloned the environment-jx-rocks-staging repository that contains the always-up-to-date definition of our staging environment.

Inspecting jenkins-x.yml

Let’s take a look at the jenkins-x.yml file that controls the processes executed whenever a change is pushed to that repo.

Press + to interact
cat jenkins-x.yml

The output is as follows.

Press + to interact
env:
- name: DEPLOY_NAMESPACE
value: jx-staging
pipelineConfig:
agent: {}
env:
- name: DEPLOY_NAMESPACE
value: jx-staging
pipelines: {}

This pipeline might be a bit ...