diff --git a/pkg/build/build.go b/pkg/build/build.go index f5e73ecf8..812844521 100644 --- a/pkg/build/build.go +++ b/pkg/build/build.go @@ -412,6 +412,21 @@ func (b *Builder) writeDockerfile(dir string) error { dockerfile.WriteRun("echo 'StrictHostKeyChecking no' > /root/.ssh/config") } + dockerfile.WriteEnv("CI", "true") + dockerfile.WriteEnv("DRONE", "true") + if b.Repo.Branch != "" { + dockerfile.WriteEnv("DRONE_BRANCH", b.Repo.Branch) + } + if b.Repo.Commit != "" { + dockerfile.WriteEnv("DRONE_COMMIT", b.Repo.Commit) + } + if b.Repo.PR != "" { + dockerfile.WriteEnv("DRONE_PR", b.Repo.PR) + } + if b.Repo.Dir != "" { + dockerfile.WriteEnv("DRONE_BUILD_DIR", b.Repo.Dir) + } + dockerfile.WriteAdd("proxy.sh", "/etc/drone.d/") dockerfile.WriteEntrypoint("/bin/bash -e /usr/local/bin/drone")