Search code examples
jenkinstestinggoogle-cloud-platformautomated-testsgoogle-cloud-run

Jenkins - use cloud run as an agent


I have a Jenkins setup on a compute engine, and I don't use any agents for executing the jobs. However, as I have more and more jobs, the queue is becoming a problem, especially for a particular pipeline that takes a long time to execute. The pipeline follows these steps:

  1. Download repository_1 from bitbucket and start it in a Docker container.
  2. Download repository_2 from bitbucket, start sending requests to repository_1, and verify responses.
  3. Send a message with success or error log to Slack.

This pipeline involves approximately 100,000 requests and takes around 17 minutes to run. On my local PC, which is more powerful than the compute engine, it only takes around 2 minutes. Therefore, my question is: Is it possible to add Cloud Run as an agent for Jenkins and deploy this job there? If I understand correctly, I only pay for the time I use on Cloud Run, and I could have a high vCPU and memory instance that can handle the tests in a shorter amount of time. Alternatively, if you have any other suggestions, I'm open to them.


Solution

  • Because Jenkins use TCP protocol to communicate with its agents, you can't use Cloud Run which only support HTTP.

    You can use spot/preemtible VM, less expensive.