Making DEPLOY_ID available via env variable

Hello,
I previously posted a question regarding updating GitHub Deployment status(thread)

I wanted to trigger webhook within pipeline step rather than using global webhook, but I found identifier of GitHub Deployment is missing as an environment variables.
Since deployment_id is already captured as deploy_id and stored in builds table, I’m wondering if it would be possible to expose deploy_id as environment variable like DRONE_DEPLOY_TO.

For example, I’m thinking of doing some thing like this:

  - name: webhook
    image: plugins/webhook
    settings:
      urls: http://external-service/webhooks/${DRONE_DEPLOY_TO}
      content_type: application/json
      template: |
        {
          "image_tag": "${DRONE_COMMIT_SHA}",
          "ref": "{{ build.ref }}",
          "environment": "${DRONE_DEPLOY_TO}",
          "deploy_id": "${DRONE_DEPLOY_ID}"
        }

Thanks!

This would be possible by updating the below libraries to include this field. We generally try to have an environment variable for every corresponding field in our database, so I think this makes sense.

1 Like

Nice, could I send a PR for this?

sure, that would be great :slight_smile: