#1837  Pipeline. Trigger job from another project
Closed
Konstantin opened 3 weeks 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 3 weeks 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 3 weeks ago

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

Robin Shen commented 3 weeks 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 3 weeks 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 3 weeks ago

Yes course

Konstantin commented 3 weeks 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 3 weeks 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 3 weeks ago

Thanks i made it work with alphina linux.

Konstantin changed state to 'Closed' 3 weeks ago
Previous Value Current Value
Open
Closed
Konstantin commented 3 weeks ago

I get it work.

issue 1 of 1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
onedev/server#1837
Please wait...
Page is in error, reload to recover