1

I have one stage and one job in that stage in my pipeline. I am running the script by going into the project location and then entering "mvn clean test"

script:
- echo "starting maven compile"
- cd "Desktop\automated-test-scripts\mavenAutomatedSetupTesting"
- "mvn clean test"

it starts the job displays the first echo message and my testng.xml file gets triggered everything looks good so far but then the pipeline never stops even on build failure (my maven project finishes the test execution and tells me how many test cases passed or failed) but the pipeline is still on-going and keeps running until the runner times out then it shows this message

see this image the execution took less than 2 mins but the pipeline went on until runner timed out (set to 15 mins)

the same file runs perfectly fine when I run it through Command prompt from my pc and finishes automatically how it is supposed to finish but when ran from a gitlab pipeline it never terminates the job

5
  • I'm having the exact same problem. Are you use the shell gitlab runner? Commented Sep 21, 2023 at 6:37
  • My problem was that I had background processes spawn in the before_script section that were still alive after the script finished. It is a GitLab issue gitlab.com/gitlab-org/gitlab-runner/-/issues/3228. My solution was to kill the background processes myself before the end of the script section. Commented Sep 21, 2023 at 9:01
  • @GuilhermeFerreira I am using shell executor and running the command "mvn test" in Gitlab-ci.yml file script portion . It starts the test but then keeps waiting and eventually job times out. How can I check if there are any background processes running. if there are any then which command you used to kill them. Thanks Commented Sep 21, 2023 at 15:19
  • You can use "ps aux | grep gitlab-runner" to list the processes created by the shell executor, assuming it runs with gitlab-runner user. Once identified, you might use killall in the script section of yml. Commented Sep 22, 2023 at 19:16
  • @GuilhermeFerreira "ps aux | grep gitlab-runner" is giving error [grep : The term 'grep' is not recognized as the name of a cmdlet] Commented Sep 22, 2023 at 20:18

0

Browse other questions tagged or ask your own question.