All repos need run a same script in a org,but I don’t want to put the same script in each repos,how to do this with drone?can drone store a script for share?
Off the top of my head, there’s two approaches you could use.
-
Use a Docker container, and pass environment variables to it through the
settings
option in your pipeline. The plugin page in the docs has some info if you’d like to try it. -
Import a script as a secret. This approach would involve registering the file as a secret (would be easiest from the CLI program), and just calling the secret in your pipeline with something like this:
echo $${SECRET_VALUE} | bash
To register the secret from the command line, something like this should work:
drone secret add username/repo secret_name @/path/to/script.sh
If you want the secret to be organization wide, just replace secret
with orgsecret
, and username/repo
with just username
.
That’s great.thanks,I will tiry
1 Like