I have write a drone plugin https://github.com/lizheming/drone-telegram-node . It’s a telegram plugin for drone made by node.
I know there has appleboy/drone-telegram in market, but it can’t config telegram api proxy url. So I write this similar plugin with node.js.
as README.md write, I run plugin with docker run, it runs well.
docker run --rm \
-e PLUGIN_TOKEN=xxxxxxx \
-e PLUGIN_TO=xxxxxxx \
-e PLUGIN_MESSAGE=test \
-e PLUGIN_BASE_API_URL=xxxx \
Everything looks be ok. But when I add it into .drone.yml pipline, it runs nothing happen. Here is my simple .drone.yml file:
Documentation tell us we can use docker run to debug, but it doesn’t work for me now. What problem I missed? And how can I get plugin output in
drone exec progress?
have you tried setting the HTTPS_PROXY and HTTP_PROXY variables? The telegram plugin is written in Go and therefore will respect these environment variables.
Please make sure you are using version 0.8 of the CLI for testing. Older versions of the CLI did not execute plugins by default, and required a special flag. The latest version of the CLI does not have this requirement. https://github.com/drone/drone-cli/releases
Note that once the plugin executes, drone exec will stream the plugin output (stdout/stderr) to the console.
http_proxy souds great! But I don’t know how set it in drone ci, could you tell me? Thank you~
Sorry I have not tell you some info. Yes, my drone cli version is 0.8.
$ drone --version
drone version 0.8.0
As you said when I change pipeline as
- echo hello
I can show hello in console, but I can’t see plugin output and I have no idea about it.
You do not need to do anything special to display plugin output in the terminal. If your plugin writes to stdout / stderr, drone will automatically stream stdout / stderr using
docker logs and will copy the stream to the terminal.
If you do not see anything in the terminal, maybe your plugin is failing? Did you check the exit code of
drone exec to see if it returns a non-zero exit code? Also check your docker daemon logs to make sure the plugin container is successfully created and run.
Note that you cannot use commands with a plugin. If you declare commands with a plugin, it will override the default entrypoint and the plugin will not execute.
http_proxy souds great! But I don’t know how set it in drone ci, could you tell me?
you just set the environment variables, like this:
http_proxy=… https_proxy=… no_proxy=… drone exec
commands just for my test, I have not set it in my yaml. I want to check docker daemon logs, but plugin runs too quick that container destroy too fast. I’ll try plugin again later, Thank you.
By the way, I can set shell variable http_proxy when run
drone exec command. But how can I set it in drone ci during triggered by git commit? can I config all plugins like this without develop?
- http_proxy: xxx
- https_proxy: xxx
I have fixed it. The reason why it doesn’t work seems drone run change plugin workdir parameter, so docker can’t find my entrypoint file with relative path. Then no log output because plugin run empty script.