Dynamically change JOB_ID of docker container

Hi All

I’m trying to use our Jenkins to orchestrate running our testporject jobs (We split our tests in multiple jobs to make them more manageable). We have managed to setup the jenkins plugin and can trigger the jobs through (as described here)

However this assumes the AgentId stays the same, which is not the case as we periodically restart our Jenkins.

So I’ve been working on a pipeline to run docker-compose from the steps

stages {
        stage('Automation') {
            steps {
               echo 'Setup TestProject Automation'
               sh 'docker-compose down'
               sh 'docker-compose -f docker_test_project_agent.yml up -d'

however I’m stuck trying to change the JOB_ID and re-running.

Is this the right way or am I making it harder than it should ?

Thanks

Ps: please note I’m not very familiar with Docker and Jenkins so I might be overlooking something obvious :blush:

Hi @jason30mhz,
A much easier solution is to override the agent id using the run a job request.
https://api.testproject.io/docs/v2/#/Jobs/Jobs_RunJobAsync
The endpoint above accepts agent id as an execution parameter, as you can see here:

Let me know if that solved your issue.