1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-11-30 08:06:52 +02:00

added yml config for custom /etc/hosts entries

This commit is contained in:
Brad 2014-03-04 11:08:13 -08:00
parent f5d142a4b5
commit 4333d62c37
2 changed files with 6 additions and 6 deletions

View File

@ -46,6 +46,12 @@ func (b *Buildfile) WriteEnv(key, value string) {
b.WriteString(fmt.Sprintf("export %s=%s\n", key, value))
}
// WriteHost adds an entry to the /etc/hosts file.
func (b *Buildfile) WriteHost(mapping string) {
b.WriteCmdSilent(fmt.Sprintf("[ -f /usr/bin/sudo ] || echo %q | tee -a /etc/hosts", mapping))
b.WriteCmdSilent(fmt.Sprintf("[ -f /usr/bin/sudo ] && echo %q | sudo tee -a /etc/hosts", mapping))
}
// every build script starts with the following
// code at the start.
var base = `

View File

@ -112,12 +112,6 @@ func (b *Build) WriteBuild(f *buildfile.Buildfile) {
f.WriteEnv(parts[0], parts[1])
}
// add hostfile definitions
//for _, mapping := range b.Hosts {
// f.WriteCmdSilent(fmt.Sprintf("[ -f /usr/bin/sudo ] || echo %q | tee -a /etc/hosts", mapping))
// f.WriteCmdSilent(fmt.Sprintf("[ -f /usr/bin/sudo ] && echo %q | sudo tee -a /etc/hosts", mapping))
//}
// append build commands
for _, cmd := range b.Script {
f.WriteCmd(cmd)