Skip to content
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

Enable comments in .jenkins file #26

Open
szalapski opened this issue Aug 27, 2018 · 7 comments
Open

Enable comments in .jenkins file #26

szalapski opened this issue Aug 27, 2018 · 7 comments
Labels

Comments

@szalapski
Copy link

Could you somehow enable us to add comments in the .jenkins file? Currently, it seems like any invalid characters cause Jenkins Status to fail silently.

@alefragnani
Copy link
Owner

Hi @szalapski ,

To read the .jenkins file, and easily convert it to an Object, I use JSON.parse(), which does not support comments. If you know a stable library that support that, I'll be glad to use it.

Thanks for your help

@szalapski
Copy link
Author

szalapski commented Sep 17, 2018 via email

@alefragnani
Copy link
Owner

Do you mean as a "new attribute", like:

{
    "url": "http://127.0.0.1:8080/job/myproject",
    "username": "jenkins_user",
    "password": "jenkins_password_or_token",
    "comment": "Any comment we want"
}

That would be easy to do, but I don't think this would be effective.

I'm thinking that move from JSON to YAML files would be a better approach. YAML allows comments, and is better suited for configuration files, like below. Maybe #11 and #16 would also benefit from this.

# Any comment we want
url: http://127.0.0.1:8080/job/myproject
username: jenkins_user
password: jenkins_password_or_token

I don't remember why I decided to use JSON in the first place. Probably because the simplicity of JSON.parse 🤔 .

What do you think?

@pmartindev
Copy link

One reason to use JSON would be that the settings file in VSCode uses JSON. I don't see the files conflicting in any way, but I do think it's a benefit to have the same markup language used across the board.

@alefragnani
Copy link
Owner

Yep, probably that, but once JSON does not support comments, we are out of luck.

I'll do that, I just have to decide if I support a file named .jenkins as JSON or YAML, or add support to another file named .jenkins.yml for the YAML format. I'll see 😄

Thank you

@szalapski
Copy link
Author

szalapski commented Nov 1, 2018 via email

@redrails
Copy link

You can also use comment-json library. It is able to parse commented JSON files. It also has a fairly small dependency tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants