Making Jenkins (Hudson) job depend on another job

前端 未结 4 692
遇见更好的自我
遇见更好的自我 2021-02-12 07:58

I have two jobs:

  1. Upload
  2. Launch-instance

I want to make Launch-instance dependent on the other one, so that trig

4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-12 08:32

    Aha, found it! Here I'm building on miki's answer which showed the way but didn't fully solve this for me.

    As it says in the Spanish-language article about launching Hudson builds which was linked to from the comments of Hudson's Remote access API page that miki linked to:

    En la sección "Build Triggers" [...] marcamos la opción "Trigger builds remotely (e.g., from scripts)". Al marcar esta opción vemos como aparece el cuadro de texto "Authentication Token". Aquí pondremos el nombre del token de autenticación.


    (source: adictosaltrabajo.com)

    (It seems the benefits of knowing Spanish are starting to materialise... :-)

    So, turns out Hudson provides a handy built-in option for triggering builds remotely. In Build Triggers section (of Upload job in my case) you can enable remote builds and set an auth token (see screenshot above). Then you can launch a build by accessing a certain URL containing that token. In my case, the first build step of Launch-instance looks like:

    wget http://[hudson-url]/job/Upload/build?token=TEST
    sleep 10
    

    This works even if anonymous builds are disabled and simply trying to access the build URL would yield "403 Forbidden".

提交回复
热议问题