Skip to main content
In this guide, we’ll extend our GitLab CI pipeline by adding an integration testing job. After deploying to Kubernetes, we’ll extract the Ingress host URL, save it as a dotenv report, and consume it in downstream tests to verify our service endpoints.

1. Define the Integration Testing Job

Begin by declaring a k8s_dev_integration_testing job in the dev-deploy stage. This job installs curl and jq, then probes the /live and /ready endpoints to confirm service health:

2. Capture the Ingress Host URL in CI

After your application manifests are applied, list the Ingress resource to confirm its host:
Extract the hostname via JSONPath:
Automate this in your deploy job and append the result to a dotenv file:
By registering app_ingress_url.env as a dotenv report, GitLab exposes INGRESS_URL as a CI variable for subsequent jobs.
The image shows a GitLab documentation page about artifacts:reports:dotenv, detailing how environment variables are collected and used in CI/CD pipelines. The page includes rules and exceptions for handling .env files.

3. Consume the Ingress URL in Integration Tests

Now update the integration testing job to depend on the deploy job. This ensures that INGRESS_URL is available:

4. Visualize the Pipeline

After committing your .gitlab-ci.yml, your pipeline in the dev-deploy stage will include two sequential jobs:
The image shows a GitLab Pipeline Editor interface with a successful pipeline visualization, including stages for containerization and deployment.
Upon completion, both jobs report success:
The image shows a GitLab CI/CD pipeline interface for a NodeJS project called "Solar System," displaying successful stages for containerization and deployment.

References

Watch Video