mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-30 10:11:23 +02:00
moved environment variables from Dockerfile to build script
This commit is contained in:
parent
8767edd37a
commit
f5d142a4b5
@ -443,21 +443,6 @@ 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")
|
||||
|
||||
@ -471,6 +456,19 @@ func (b *Builder) writeDockerfile(dir string) error {
|
||||
func (b *Builder) writeBuildScript(dir string) error {
|
||||
f := buildfile.New()
|
||||
|
||||
// add environment variables about the build
|
||||
f.WriteEnv("CI", "true")
|
||||
f.WriteEnv("DRONE", "true")
|
||||
f.WriteEnv("DRONE_BRANCH", b.Repo.Branch)
|
||||
f.WriteEnv("DRONE_COMMIT", b.Repo.Commit)
|
||||
f.WriteEnv("DRONE_PR", b.Repo.PR)
|
||||
f.WriteEnv("DRONE_BUILD_DIR", b.Repo.Dir)
|
||||
|
||||
// add /etc/hosts entries
|
||||
for _, mapping := range b.Build.Hosts {
|
||||
f.WriteHost(mapping)
|
||||
}
|
||||
|
||||
// if the repository is remote then we should
|
||||
// add the commands to the build script to
|
||||
// clone the repository
|
||||
|
Loading…
Reference in New Issue
Block a user