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
taskcluster d2g subcommand to support yaml #6731
Comments
Hi @petemoore*, I want to pick this bug. Please let me know if it's okay by you. Problem statement[what I have understood, Please correct me If I am wrong]: Also I am referring to this readme: https://github.com/taskcluster/taskcluster/blob/main/dev-docs/development-process.md for setting up and getting started with making changes in taskcluster code. Do let me know if I am referring to the correct doc. PS: This is my first time contributing to any open source project so please forgive me for any silly/basic question. Thank you! |
Hey @anirudh-pandey and thanks for the interest! |
Hey @lotas, I have completed the coding of the issue. But I think maybe I don't have write access to this repo due to which I can't push my branch. It is showing me this error, when trying to push:
I can fetch changes but can't push. Can you please give me access to this? |
hey @anirudh-pandey this is expected. Please create a fork first, and then create a PR from your fork. |
Hi @lotas, Thanks for the comment. I have always worked on a self created repo or a repo where I had write access so missed the forking part 😅. I have created a PR, but there are 2 issues in which I need a little bit of your guidance.
So among these the first one is working properly. So for others now I have 2 doubts, as follows:-
Thank you for your patience. Really appreciate it!! |
Hi @anirudh-pandey, Apologies for not spotting your messages in this issue earlier. Many thanks for your contributions here!
Any json is valid yaml, but not all yaml is valid json. Therefore I would propose first attempting to interpret the input as json. If this succeeds, you know the input is json, and you can generate a json response. If it doesn't, try to interpret it as yaml. If this succeeds, you know you have a yaml input, so generate a yaml output. If it is also not valid yaml, then report that the input is not valid. The ordering is important here. If you were to test for yaml first, all json inputs would be valid yaml, and yaml output would be generated - that would be undesirable. Instead make sure to test with json first. Note, you do not need to write separate code to test if the input is json or yaml. Just assume that it is, and if you get an error, you know that it isn't. Good luck! |
Hi @petemoore, Thank you for the reply. I have pondered hard on your comment but am still slightly confused. I am mostly confused about these two lines: If not every YAML is a valid JSON, how can I interpret it as YAML? without using YAMLToJSON function like I am doing currently. So my current thinking/approach(based on your comment) is like this, please let me know incase of any issues:Let's say we move current(master branch) Now inside my current if PS: Also can you please reply to my first doubt in this comment: #6731 (comment) related to Thank you! 😄 |
Hi @anirudh-pandey |
The An improvement here would be to also detect if just a payload has been passed, or a full task definition, and handle the output accordingly (but leaving the |
We now point users at the d2g subcommand in task logs if they use a docker worker payload. It is likely many users will now look at this utility and start using it, once this lands on firefox-ci.
I suspect several will stumble / give up, when they see that .taskcluster.yml file is yaml, and they need to submit json.
I think it would be reasonable for the d2g subcommand to automatically switch between json/yaml depending on what it receives. If it receives yaml, it outputs yaml back, and vice versa. We could also add a command line option to switch format, but that already might be overkill. Presumably if you have a task definition in one format, and want to change it, you are happy to receive the output in the same format that you sent it, because in all likelihood, you will just replace the input with the output in the original file you got it from. And pretty much that is always yaml, so it would be nice to remove the burden for users to perform this additional translation manually, and just do it in the tool directly.
In Generic Worker we already support converting between yaml and json, so could be some useful code snippets there to see how to implement this.
The text was updated successfully, but these errors were encountered: