Inject building environment variables into template files.
Drone plugin for injecting building environment variables into template files. For the usage information and a listing of the available options please take a look at the docs.
Build the binary with the following commands:
go build
go test
Build the docker image with the following commands:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo
docker build -t hhxiao/drone-template .
Please note incorrectly building the image for the correct x64 linux and with GCO disabled will result in an error when running the Docker image:
docker: Error response from daemon: Container command
'/bin/drone-template' not found or does not exist..
Execute from the working directory:
Injecting building environment variables into template java files
docker run --rm \
-e DRONE_REPO_OWNER=hhxiao \
-e DRONE_REPO_NAME=drone_template \
-e DRONE_REPO_LINK=https://github.com/hhxiao/drone_template \
-e DRONE_COMMIT_BRANCH=master \
-e DRONE_COMMIT_REF= refs/heads/master \
-e DRONE_COMMIT_AUTHOR=hhxiao \
-e DRONE_COMMIT_AUTHOR_EMAIL=hhxiao@gmail.com \
-e DRONE_COMMIT_MESSAGE="bug fixing" \
-e DRONE_BUILD_NUMBER=1 \
-e DRONE_BUILD_STATUS=success \
-e DRONE_BUILD_LINK=http://beta.drone.io/hhxiao/drone-template/1 \
-e DRONE_TAG=1.0.0 \
-e TEMPLATES=src/main/java/main.java \
hhxiao/drone-template
This plugin references a lot from the official drone-slack plugin