TestProject Forum

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 ?


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