Reputation: 34099
I am trying to write my first custom plugin for drone ci that will change git tag
and push back to repository.
The plugin will be written in GO. My question is, how to feed https://docs.drone.io/pipeline/environment/reference/ inside the GO application.
Do you I have to pass it like this:
kind: pipeline
type: docker
name: default
steps:
- name: custom/plugin
image: custom/tag
settings:
url: $DRONE_GIT_HTTP_URL`
and access in the GO application as follows:
func main() {
url := os.GetEnv("URL")
Upvotes: 1
Views: 2703
Reputation: 56
The standard Drone environment variables are always injected into all steps within all pipelines, so generally it would be better if you check for the regular names of the environment variables.
Specific to your use case, you should change the code to url := os.GetEnv("PLUGIN_URL")
as Drone automatically prefixes all settings with the PLUGIN_
prefix.
Upvotes: 2