Utility for quickly adding Drone.io to projects
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hamcha d2e268dc39
ACTUALLY process env vars
3 years ago
.gitignore First version 3 years ago
README.md Add sprig 3 years ago
go.mod Add sprig 3 years ago
go.sum Add sprig 3 years ago
main.go ACTUALLY process env vars 3 years ago
template.yml Add sprig 3 years ago

README.md

drone-add

Easily add Drone.io to projects using Drone APIs and YAML templates.

Getting started

Install drone-add

go get -u git.fromouter.space/Hamcha/drone-add

or, if you have cloned the project locally, just cd to it and:

go install .

Set environment variables

To authenticate with Drone you'll need to get your user token. If you have the drone CLI tool, the environment variables are the same (DRONE_SERVER / DRONE_TOKEN).

If you have drone secret you want to add, set them as environment variables using this format:

DRONE_SECRET_SECRET_NAMEsecret_name

You can use template literals in your secrets, for example:

DRONE_SECRET_DOCKER_REPO = "my-custom-registry.tld/{{.Namespace}}/{{.Name}}" with project testorg/my-repo will create a secret called docker_repo with value my-custom-registry.tld/testorg/my-repo

Change the template

If you have not downloaded the project locally, download the template file from here.

Change the template to fit what a starting .drone.yml for your projects would be like. Usually this means just populating common steps (like publish and deployment steps).

You can also use template literals in the template.

Run the tool

Usage:

drone-add [-t template.yml] [-o .drone.yml] namespace/repository

Templating powered by Sprig

Need more control? You can use sprig functions in your templated code!