Utility for quickly adding Drone.io to projects
Find a file
2019-10-28 15:12:19 +01:00
.gitignore First version 2019-10-28 14:31:40 +01:00
go.mod Add sprig 2019-10-28 15:05:33 +01:00
go.sum Add sprig 2019-10-28 15:05:33 +01:00
main.go ACTUALLY process env vars 2019-10-28 15:12:19 +01:00
README.md Add sprig 2019-10-28 15:05:33 +01:00
template.yml Add sprig 2019-10-28 15:05:33 +01:00

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!