There are two methods to run the assembly remotely in Jenkins, which I have successfully used. (Examples for shell script)
One of them is using the URL and start PARTIAL OPERATION:
Method 1:
WGET="/usr/bin/wget" JENKINS_JOB="Your-Job-Name" $WGET http://ip:port/job/$JENKINS_JOB/build?token=sampletocken
If you are trying to run a task parameterized, you can specify the parameters this way (otherwise the task will not start):
$WGET http://ip:port/job/$JENKINS_JOB/buildWithParameters?param-name=param-value&token=sampletocken
The token part = sampletocken is not required, but it adds a bit of security. You can configure the token in your work configuration in the "Trigger assemblies remotely" section.
Another method is to use the Jenkins disruptive API:
Method 2:
For all this to work, you had to grant the rights to an anonymous user in Jenkins. However, this may be something you do not want to do, as this causes security problems.
Authentication
To make it more secure, you can create a separate user that will be used in the script to authenticate Jenkins. Configure this user to have an "API tag" that you intend to use in the script. (do not forget to remove all rights for an anonymous user)
Then you need to add the following to the wget command:
wget --auth-no-challenge --http-user=user --http-password=apiToken
"-auth-no-challenge" is used to avoid the "403 forbidden" error. You can also add another token to the URL, as in the previous example.
This last part was problematic for me, so it could go through trial and error ...