ROS and GitlabCI - Pipeline crash during run_tests

Hello! I have been integrating rostests into my GitLab CI pipeline and I can’t seem to solve this error. My .gitlab-ci.yaml file essentially looks like this:

image: ros:kinetic-robot

stages:
  - build
  - test
  - analyze

cache:
  paths:
    - ccache/

before_script:
  - git clone https://gitlab.com/VictorLamoine/ros_gitlab_ci.git
  - source ros_gitlab_ci/gitlab-ci.bash >/dev/null

catkin_build:
  stage: build
  script:
    - catkin build --summarize --no-status --force-color
  artifacts:
    paths:
      - 'catkin_workspace/build'
      - 'catkin_workspace/devel'
    expire_in: 4 hrs

catkin_run_tests:
  stage: test
  script:
    - source devel/setup.bash
    - catkin run_tests --no-status --force-color
    - catkin_test_results
  needs:
    - job: catkin_build
      artifacts: true

When the pipeline runs, it builds successfully but returns an error during the catkin_run_tests stage. Here’s the output:

Restoring cache 
 Checking cache for default-3...
 Downloading cache.zip from https://storage.googleapis.com/gitlab-com-runners-cache/project/14940826/default-3
 Successfully extracted cache

Downloading artifacts 
 Downloading artifacts for catkin_build (530204007)...
 Downloading artifacts from coordinator... ok        id=530204007 responseStatus=200 OK token=WTr7-nYD

Running before_script and script
$ git clone https://gitlab.com/VictorLamoine/ros_gitlab_ci.git
   Cloning into 'ros_gitlab_ci'...
$ source ros_gitlab_ci/gitlab-ci.bash >/dev/null
   Warning: running 'rosdep update' as root is not recommended.
   You should run 'sudo rosdep fix-permissions' and invoke 'rosdep update' again without sudo.
   Extracting templates from packages: 100%
   Extracting templates from packages: 100%
   Extracting templates from packages: 100%
$ source devel/setup.bash 

Running after_script 
Uploading artifacts for failed job 
ERROR: Job failed: exit code 1

I can’t figure out why it’s having difficulty sourcing devel/setup.bash. And if I remove the command, I get an error regarding ROS package path not found for some dependencies.

Thanks in advance!