-
Notifications
You must be signed in to change notification settings - Fork 183
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
add workaround to support yaml anchors #103
Conversation
I wonder if we apply this patch to go-yaml if it will work?
|
also just a heads up that the CLI in master changed to support 0.9 (some deprecated API calls were removed, some structures changed). So we probably need to branch 0.8.6 and update. |
You think the issue is with that package? I'm not sure since I'm using that package to "fix" this. And yes, would love to be able to fix in 0.8.6 also. The "patch" I PM'd you earlier was against the 0.8.6 code. |
I think it could be at the package level. This is the particular issue that seems similar to what you are describing: go-yaml/yaml#91 |
So I added the following to
And did a I then ran and got:
So it didn't seem happy ... |
data, err = yamlv2.Marshal(anyJSON) | ||
if err != nil { | ||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.9 supports multi-document yaml files which would be problematic here. But we can definitely backport this to 0.8. I will create an 0.8 branch tomorrow morning that we can use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there documentation around that so I can try to understand the issue. Looking at the cli source it seems it looks for a single file, defaulting to .drone.yml
, and reads the file and starts using it.
Thanks for the help on this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the yaml.Unmarshal
will not work with a multi-document yaml like this https://github.com/drone/drone-git/blob/master/.drone.yml :)
Adding a workaround to allow yaml anchors to work with drone-cli. They have been working fine with Drone 0.8.6 server/agents.
This works by unmarshalling from
[]byte
yaml to amap[string]interface{}
and then back to a[]byte
yaml. During this process the anchors are "compiled". SoThen becomes: