Script execution with GitLab pipeline

Hi,

I am trying to learn script execution with the help of GitLab pipeline by following the instructions mentioned at GitLab Integration | Katalon Docs

After doing configuration as mentioned in the doc, I am getting an error like this in job logs

Start activating online...
Katalon TestOps: Unexpected response, URL: https://admin.katalon.com/oauth/token, Status: 400, Response: {"error":"invalid_grant","error_description":"Authentication failed."}
Authentication failed.
Online activation for console mode failed.

When I click on the URL mentioned in above text, it said

{"error":"method_not_allowed","error_description":"Request method 'GET' not supported"}

I am running my tests with one month trial licenses. I am not finding enogh info on this error and particulary how to fix it?

Here are the complete logs of the job

Running with gitlab-runner 15.7.1 (6d480948)
  on Primary-Shared qSohhN5_
Preparing the "docker" executor
00:36
Using Docker executor with image katalonstudio/katalon ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Using docker image sha256:cd27a71ea4555b89fda3a6fd0118200e247b9f05cd07d3c16c58e67bee7c290d for docker:dind with digest docker@sha256:3cf33ff6e893a39262bd9f6b85ff46e068fa2a98d201326e9c3058a22a21a6bb ...
Waiting for services to be up and running (timeout 30 seconds)...
*** WARNING: Service runner-qsohhn5-project-534-concurrent-0-1c6e7518dc0217c0-docker-0 probably didn't start properly.
Health check error:
service "runner-qsohhn5-project-534-concurrent-0-1c6e7518dc0217c0-docker-0-wait-for-service" timeout
Health check container logs:
Service container logs:
2023-03-01T13:53:20.161766216Z Certificate request self-signature ok
2023-03-01T13:53:20.161814609Z subject=CN = docker:dind server
2023-03-01T13:53:20.187324954Z /certs/server/cert.pem: OK
2023-03-01T13:53:21.933959949Z Certificate request self-signature ok
2023-03-01T13:53:21.933998450Z subject=CN = docker:dind client
2023-03-01T13:53:21.961700116Z /certs/client/cert.pem: OK
2023-03-01T13:53:22.797090968Z time="2023-03-01T13:53:22.796776339Z" level=info msg="Starting up"
2023-03-01T13:53:22.800240009Z time="2023-03-01T13:53:22.800081791Z" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
2023-03-01T13:53:22.800357658Z failed to load listeners: can't create unix socket /var/run/docker.sock: device or resource busy
*********
Pulling docker image katalonstudio/katalon ...
Using docker image sha256:b1b382d16c3c76aa13bf52b5f694e5cdcaac547a0843d90c40760e2a64e0335c for katalonstudio/katalon with digest katalonstudio/katalon@sha256:f38539714c2ecf20a08df244333d7a2439e0e30d90ddecac1aca2ceb8b55ad00 ...
Preparing environment
00:00
Running on runner-qsohhn5-project-534-concurrent-0 via vmi758837.contaboserver.net...
Getting source from Git repository
00:02
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/qa/test_project_2/.git/
Created fresh repository.
Checking out 1f697ef5 as main...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:07
Using docker image sha256:b1b382d16c3c76aa13bf52b5f694e5cdcaac547a0843d90c40760e2a64e0335c for katalonstudio/katalon with digest katalonstudio/katalon@sha256:f38539714c2ecf20a08df244333d7a2439e0e30d90ddecac1aca2ceb8b55ad00 ...
Entrypoint
+ echo Entrypoint
+ '[' -z '' ']'
+ exec sh -c 'if [ -x /usr/local/bin/bash ]; then
	exec /usr/local/bin/bash 
elif [ -x /usr/bin/bash ]; then
	exec /usr/bin/bash 
elif [ -x /bin/bash ]; then
	exec /bin/bash 
elif [ -x /usr/local/bin/sh ]; then
	exec /usr/local/bin/sh 
elif [ -x /usr/bin/sh ]; then
	exec /usr/bin/sh 
elif [ -x /bin/sh ]; then
	exec /bin/sh 
elif [ -x /busybox/sh ]; then
	exec /busybox/sh 
else
	echo shell not found
	exit 1
fi
'
$ katalonc.sh -projectPath=$KATALON_PROJECT_DIR -apiKey=$KATALON_API_KEY -browserType="Chrome" -retry=0 -statusDelay=20 -testSuitePath="Test Suites/TS_RegressionTest"
+ echo 'Starting Katalon Studio'
+ cat /katalon/version
Starting Katalon Studio
Mozilla Firefox 107.0
Google Chrome 108.0.5359.94 
Microsoft Edge 108.0.1462.42 
Katalon Studio 
+ args=("$KATALON_KATALON_INSTALL_DIR/katalonc" "$@")
+ xvfb-run -s '-screen 0 1024x768x24' /opt/katalonstudio/katalonc -projectPath=/builds/qa/test_project_2 -apiKey= -browserType=Chrome -retry=0 -statusDelay=20 '-testSuitePath=Test Suites/TS_RegressionTest'
Katalon workspace folder is set to default location: /tmp/session-88e0e7e4
Starting Groovy-Eclipse compiler resolver. Specified compiler level: unspecified
139 org.codehaus.groovy_2.4.20.v202009301404-e2006-RELEASE ACTIVE
Activating...
Start getting machine ID on Linux
End getting machine ID on Linux f65c27a93a6238c9028ce1df638ee760
Start appending additional signatures
hardwareSerialNumber 
osDependentUsername root
End appending additional signatures f65c27a93a6238c9028ce1df638ee760__root
Start activating offline...
Search for valid offline licenses in folder: /root/.katalon/license
The number of valid offline licenses: 0
Start activating online...
Katalon TestOps: Unexpected response, URL: https://admin.katalon.com/oauth/token, Status: 400, Response: {"error":"invalid_grant","error_description":"Authentication failed."}
Authentication failed.
Online activation for console mode failed.
Activation failed. Please make sure you are using a valid license.
All launchers terminated
+ ret_code=3
+ exit 3
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 1

Hi em, can you take a look at this error? Thanks em

So, I managed to find solution to this problem

Basically, if you are following GitLab Integration | Katalon Docs guide to configure Katalon with GitaLab, at the time of variable creation on GitLab, there is a check box ‘Protect variable’ shows.

By default, it is checked and if you save variable with this flag ON, it means the branch for which you are configuring pipleline should also be configured as ‘Protected’ to avoid authentication error (Project settings → Repository → Protected branches) in GitLab.

The reason for this, the variable value will be passed to protected branch only if this flag is on. You can

or

  • set this flag OFF if your branch is not protetced.

I opted first option and now the error is gone. Though, I started seeing another issue during script execution which I will ask in seperate thread.

BTW, a one liner statement for this flag can be added in GitLab Integration | Katalon Docs to save time for those who are not much familiar with GitLab :slightly_smiling_face:

Thanks,

1 Like