Hi, I have a trigger set to start build for a downstream project and my trigger in the parent project is throwing this error Error: unable to get latest build for <xyz_repo>
This is likely an authentication issue. I recommend reading our troubleshooting guide for using secrets, which highlights some common configuration mistakes http://docs.drone.io/secrets-not-working/
There are two issues that I think need to be address:
First this is not valid syntax. You cannot set a yaml attribute to an environment variable using dollar sign syntax.
Second plugins expects the secret to have very specific names. In this case, the dowstream plugin will look for a variable named DOWNSTREAM_TOKEN
This would result in the following change to your yaml, assuming you re-name your secret:
Note that if you do not want to rename your secret, drone supports secret aliasing, so that you can convert the secret to the expected name at runtime:
In your example the repository name is xyz_repository. Can you confirm you are using the correct repository name format, which is {owner}/{name}, for example octocat/hello-world
If you continue to experience issues, please following the usage instructions in the plugin repository to manually test your configuration from the command line. This can help you find and resolve any issues. https://github.com/drone-plugins/drone-downstream#usage
Also please consider stepping through the code, if needed.
The plugin is working (I just tried it) so it is likely a configuration issue.
Hi Brad,
Can {owner}/{name} have special characters like (underscore)’_’ and (hyphen)’-’ ? I have tried using drone-cli as well to set the drone_token. Cross checked with the drone-downstream plugin usage as well. The error still persists.
// get the latest build for the specified repository
build, err := client.BuildLast(owner, name, branch)
if err != nil {
return fmt.Errorf("Error: unable to get latest build for %s.\n", entry)
}
Please note that trigger plugin re-launches an existing build, optionally with a new build number. This error tells me that it cannot find an existing build for your repository and branch.
Hey Brad,
Thanks for the prompt response. I just got it to work .
What I found out with the changed that I made to the drone config was fork option is not working. The moment I removed the fork option the project kicked the downstream project. Also, there was no issue with the repo location. Somehow, fork was the culprit. My final trigger looks like this:
trigger:
image: plugins/downstream
server: link_to_drone_server
secrets: [DOWNSTREAM_TOKEN]
when:
event: push
branch: some-branch
success: true
repositories:
- xyz-repo/some_project
@bradrydzewski@sidhjhawar Hey Guys, I am also facing the same issue and tried the same configuration mentioned by @sidhjhawar, but still getting the “Error: unable to get latest build for **”
This indicates the secret is not being passed into the plugin. This happens when the secret is not properly added to Drone or not properly configured. Please see the following documentation for debugging issues with secrets: