Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle an asynchronous request/response as part of a Gitlab CI/CD test

I am looking to migrate from Jenkins to GitLab CI/CD. We currently use the BlazeMeter plugin for Jenkins to run GUI Functional tests on Blazemeter as part of a Jenkins job.

Unfortunately BlazeMeter doesn't have a plugin for GitLab but they do have a simple JSON API to start tests.

Because the tests can be long-running the Blazemeter API is asynchronous. One cUrl endpoint is used to start a test and another is used to poll and get the results (passing an ID returned in the first call).

What is the best way to handle this asynchronous process as part of a GitLab CI Pipeline job and what is the sample gitlab yaml?

like image 983
Fred Avatar asked Nov 06 '22 10:11

Fred


1 Answers

GitLab has webhook or pipeline trigger feature where you can invoke from where ever you want. Also blazemeter has notification via webhooks. By combining these two will solve your problem without having long running one job until test completion.

test-trigger:
  stage: test
  script:
    - # curl command to invoke test
  except:
    - triggers

test-completion:
  stage: test
  script:
    - # reporting script
  only:
   - triggers

Following resources will help you to get started.

  • https://docs.gitlab.com/ee/ci/triggers/
  • https://guide.blazemeter.com/hc/en-us/articles/360001859058-Notifications-Overview-Notifications-Overview#webhook
  • https://blog.runscope.com/posts/how-to-send-runscope-webhook-notifications-to-google-hangouts-chat-with-eventn
like image 131
Ruwanka Madhushan Avatar answered Nov 22 '22 10:11

Ruwanka Madhushan