mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-06-30 11:10:48 +00:00
Integrated clean task
This commit is contained in:
parent
d1b36e868a
commit
7e21566af3
42
make.go
42
make.go
|
@ -34,6 +34,7 @@ var steps = map[string]step{
|
||||||
"build": build,
|
"build": build,
|
||||||
"test": test,
|
"test": test,
|
||||||
"image": image,
|
"image": image,
|
||||||
|
"clean": clean,
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -170,6 +171,47 @@ func image() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func clean() error {
|
||||||
|
err := filepath.Walk(".", func(path string, f os.FileInfo, err error) error {
|
||||||
|
suffixes := []string{
|
||||||
|
".out",
|
||||||
|
"_bindata.go",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, suffix := range suffixes {
|
||||||
|
if strings.HasSuffix(path, suffix) {
|
||||||
|
if err := os.Remove(path); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
files := []string{
|
||||||
|
"bin/drone",
|
||||||
|
"bin/drone-agent",
|
||||||
|
"bin/drone-build",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, file := range files {
|
||||||
|
if _, err := os.Stat(file); err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.Remove(file); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// trace is a helper fucntion that writes a command
|
// trace is a helper fucntion that writes a command
|
||||||
// to stdout similar to bash +x
|
// to stdout similar to bash +x
|
||||||
func trace(args []string) {
|
func trace(args []string) {
|
||||||
|
|
Loading…
Reference in a new issue