Pipeline. Trigger job from another project (OD-1837)
Konstantin opened 2 years ago

I want to link two projects. The first project is assembling a docker image and downloading it in the package onedev. I did special job for this. I want the job of the second project to begin if the job of the first project has worked and completed its execution successfully. Help me do this. Thanks!

  • Robin Shen commented 2 years ago

    You may add a step in the first project to trigger job of another project via restful api:

    https://code.onedev.io/~help/api/io.onedev.server.rest.resource.TriggerJobResource

  • Konstantin commented 2 years ago

    Big thanks! Can you write some simple examle .onedev-buildspec.yml to sent by api?

  • Robin Shen commented 2 years ago

    No need to write this file manually. Just add a command build step from GUI running in a docker image with curl, and then call curl to do the job as demonstrated in the api doc.

  • Konstantin commented 2 years ago

    No need to write this file manually. Just add a command build step from GUI running in a docker image with curl, and then call curl to do the job as demonstrated in the api doc.

    Can i do this with step "Execute Commands" , past in to a curl command?

  • Robin Shen commented 2 years ago

    Yes course

  • Konstantin commented 2 years ago

    I have this error : This step can only be executed by server shell executor or remote shell executorScreenshot from 2024-04-09 14-22-21.png

  • Robin Shen commented 2 years ago

    Your job is currently executed by a docker executor, and all command steps need to be executed inside a container. Please turn on the option "Run In Container", and specify an image with curl pre-installed, or simply specify as "ubuntu", and run below commands:

    apt update
    apt install -y curl
    curl -G -X ...
    
  • Konstantin commented 2 years ago

    Thanks i made it work with alphina linux.

  • Konstantin changed state to 'Closed' 2 years ago
    Previous Value Current Value
    Open
    Closed
  • Konstantin commented 2 years ago

    I get it work.

issue 1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
OD-1837
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover