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:
parent
f5d142a4b5
commit
4333d62c37
@ -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 = `
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user