-
-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
depends_on: [] doesn't enable DAG mode #3055
Comments
Should check for |
if we merge #3008 that should be addressed |
I don't think #3008 is really a solution. |
As for go-yaml/yaml#42, as far as I can tell, parsing empty arrays works as expected, the following Go program: package main
import (
"fmt"
"gopkg.in/yaml.v3"
)
type Item struct {
DependsOn []string `yaml:"depends_on"`
}
func main() {
var a Item
yaml.Unmarshal([]byte("{}"), &a)
fmt.Println(a.DependsOn == nil)
out, err := yaml.Marshal(a)
if err != nil {
panic(err)
}
fmt.Println(string(out))
var b Item
yaml.Unmarshal([]byte("depends_on: []"), &b)
fmt.Println(b.DependsOn == nil)
out, err = yaml.Marshal(b)
if err != nil {
panic(err)
}
fmt.Println(string(out))
} Outputs this:
An empty array is not null, unlike an unprovided array. However, it's worth noting that that when marshaled with YAML, However, there is a workaround to make YAML marshaling work as well (not just unmarshaling) of providing the type as package main
import (
"fmt"
"gopkg.in/yaml.v3"
)
type Item struct {
DependsOn *[]string `yaml:"depends_on,omitempty"`
}
func main() {
var a Item
yaml.Unmarshal([]byte("{}"), &a)
fmt.Println(a.DependsOn == nil)
out, err := yaml.Marshal(a)
if err != nil {
panic(err)
}
fmt.Println(string(out))
var b Item
yaml.Unmarshal([]byte("depends_on: []"), &b)
fmt.Println(b.DependsOn == nil)
out, err = yaml.Marshal(b)
if err != nil {
panic(err)
}
fmt.Println(string(out))
} This will output:
This works fine with |
could you create a pull :) |
I agree with @lafriks and don't think an empty |
Component
server
Describe the bug
depends_on: []
like specified in https://github.com/woodpecker-ci/woodpecker/blob/c1a1f7c10b3c0840bad9c0b25fcd7f5ff8b0173b/.woodpecker/securityscan.yml is useless, and doesn't enable DAG mode as documented on https://woodpecker-ci.org/docs/usage/workflow-syntax#depends_on.This is because DAG is only enabled for non-empty lists:
woodpecker/pipeline/frontend/yaml/compiler/dag.go
Lines 44 to 51 in c1a1f7c
System Info
Additional context
No response
Validations
next
version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]The text was updated successfully, but these errors were encountered: