I'm trying to trigger jenkins job after deploying a pipeline; I've added this part in .gitlab-ci.yml but I got below error when running the job in the after_script section

"curl: (6) Could not resolve host"

    - echo "Starting regression tests…"
    - curl -i -X POST http://user:token@jenkinsUrl/job/jobname/build?token=tokenName

and the below is working properly from my terminal, triggering the build

curl -i -X POST http://user:token@jenkinsUrl/job/jobname/build?token=tokenName
  • 2
    Is jenkinsUrl a fully qualified name? Mostly if on your gitlab runner you can do a dig jenkinsUrl it will work, you'll have to configure your runners to be able to resolve this name, or to use another name or IP they can resolve – Tensibai Nov 16 '18 at 16:40
  • from my terminal means your dev machine or the server where jenkins is running? Try adding -v switch to curl. But Could not resolve host message is clear enough I think you need to edit /etc/hosts (on remote server) and add the jenkinsUrl there with correct (local) IP or use IP directly. – Kyslik Nov 29 '18 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.