Variables in plugin args

I’d like to update GitHub status via API. So I tried to use webhook plugin like this:

- name: set-pending
  image: plugins/webhook
  settings:
    urls: https://api.github.com/repos/$CI_REPO_NAME/statuses/$CI_COMMIT_SHA
    content_type: application/json
    username:
      from_secret: GITHUB_USERNAME
    password:
      from_secret: GITHUB_TOKEN
    template: |
       {
         "status": "pending"
         "description": "from hook"
       }

It failed because variables are not expanded. Is there any way to use plugins with variables ? If no it would be very nice to have. If it’s hard to use regular bash-like interpolation template syntax would also suffice, something like

urls:
 template:  |
   https://api.github.com/repos/{{ env.CI_REPO_NAME}}/statuses/{{ env.CI_COMMIT_SHA }}

see https://docs.drone.io/pipeline/environment/substitution/

1 Like

Is there any way to set plugin option from previous step ?

There is no generic way to set plugin variables from previous steps. A plugin could choose to read parameters from disk, but that would be the responsibility of the plugin.