 Okay, hi everyone and welcome to the Jenkins one meetup. Today we have a presentation by Svaden Nunes. He is one of our community bridge mentors who was working on J. Kasky developer tools, in particular visual studio code plugin and YAML configuration validation. So today he will present his work, show the demo and then we will have a lot of time to discuss the project and ask questions. If you have want to ask anything, there is a chat and just ask in the Zoom chat and we will be asking Svaden these questions up to his presentation. So that's it from me and Svaden, the cover is yours. Yeah, okay. So hello everyone, I'm Sladen. I'm an undergraduate student from Umba University here in India and I've been a student with Jenkins as a part of the community bridge initiative and the main aim of my project was to work on the Jenkins configuration as code development tools. So my mentor for the project was Tim. Mani helped me a lot in the project so shout out to him. Okay, so I guess basically I can just dive into the project from the start and then we can maybe go on to questions later on. So if you have any questions you can put it in the chat and we can discuss them later. So I would begin by starting out as to what the project is about. So the main aim of the project was to enable Jenkins developers to validate the YAML files that were written for a Jenkins for Jenkins via jcask. So if you are familiar with configuration as code, the basis of it is to be able to configure your Jenkins via YAML file. So using that YAML file you can load into jcask a basic configuration which then can be applied to your instance. So we sought to make life easier for those users by developing a plugin so that they can while writing the YAML file do not face difficulties. I mean that is basically we are so used to programming that maybe we encounter certain problems while coding. I mean using auto completion or maybe getting red lines onto the editor so that we know that hey there's something wrong with our file. So we plan to bring this feature into Jenkins configuration as code so that when developers write in their own YAML files they are very very comfortable and they can go out of the box and just write stuff and it makes it a seamless experience. So that was part of my project. So what we did we went and made some sort of changes to the configuration, the schema generation so that the schema was previously being generated by a set of scripts which we rewrote in Java so that it made maintainability and modularity out of the box so that we could make it easier for us to debug or test. So that was part one. That was part one of the project and by the end of phase one we had the schema developed and it was time to make the lives of developers a lot more easier. Here comes in the plugin that we wrote for Jenkins configuration as code. So you can find that before I go into the repository I would like to tell the users more about what we thought while developing the plugin. So basically we went and developed the plugin so that it pulls in your latest schema file from your Jenkins instance and then using that schema file it could it helps you in auto completion and validation. So all of the red lines and all of the auto completion features come in with IntelliSense. I mean in VS code so there is no separate language server developed but it helps us write those YAML files. So I would like to show you the repository for the extension. So this is the Jenkins configuration as code extension. This is the source code. I mean if I would come into how to contribute later but if at all you want to I will be publishing these slides later so if you need any links or any sort of documentation resources that would be made available later. So this is the entire source code repository and we have the documentation which explicitly teaches the users how to use it. The user guide I mean some basic schema and what are the features that it provides. How to run the script, how to run the plugin locally and some screenshots and I mean which tell you more about the plugin and how to get it activated. So okay after coming after finishing with the source code we come to the meat of it. Yeah so this is the marketplace for Visual Studio Code. I mean this is the place where you download I mean obviously you can download the plugins inbuilt from your VS code editor but if at all you wanted to visit the plugin site you can do that. So this is the plugin site it's called the JCask plugin. You can I mean you can see the same thing that it's been basically pulled from the repository. So you can find any sort of documentation resources any I mean if you want to install it locally the number of downloads and stuff the latest release as well. So this is the place you want to be if you want to read more about the official plugin development. So yeah so moving on to that what does the plugin do I think I've already explained to you what the plugin does. Basically it doesn't need you to explicitly configure anything apart from a certain username token and a URL and you can find the plugin here. So I've already showed you the VS code marketplace and where exactly can you find all the documentation necessary. Okay so I think we have enough of documentation and enough of resources here to begin with the entire purpose of this online meetup that is the demo. So I guess I can take you straight into it but before that I guess one of the prerequisites you need to have is a Jenkins instance running. So what I have done is just spun up a basic I mean basic Jenkins instance. So with all of the most commonly used plugins so nothing much fancier just basically cloned it and I mean cloned it I'm sorry just downloaded the wire file and just ran the instance so you can do that on your instance as well and with the new schema generation if you have the Jenkins configuration as cloned plugin you can go into configuration as code and you can have a look at the new JSON schema. So here it is so this is my schema if I can I mean I'm not going to scroll down but yeah this is the entire schema so if you have your instance you can check this out. This is your schema file from which in VS code will use this to generate most of the order completion. So yeah let's get right into it then. So with all of this setup you could just jump into your editor. Okay and so one of the steps would be first of all is to obviously have the Jenkins plugin so yeah I'll just so for demo purposes I would install the plugin. Yeah I mean you can reload your file I mean your VS code instance yeah but that's not required here I guess. Okay moving on so I would just follow in with the guide so that if at all you're using if you're all you don't refer to this video anytime in the future you can just refer to the how to use. So what you need basically is inside the settings tab of VS code you find in the plugin so I'll show you how to do that. So you want to find you go into preferences you go into settings and then you search for Jenkins configuration as code yeah so it should I mean apart if you have any other VS code plugin from Jenkins they should show up first. So if you have the matrix authorization or you have any sort of authorization configured it will ask you for a username and a token but for the purposes of this demo I have entered the basic boilerplate I mean configuration user token if at all you it demands for the user token so if at all you have one configured you can I mean you can enter it yeah we are working on making this use experience a bit more seamless which I will discuss later so that's in the future scope. So what you do is basically just pull in your you can go back here. Okay yeah so just get in your local host URL so just copy paste that here and you're good to go. After that so yeah the next step would be to use to activate the extension so on one two so I can use control shift and P that would open up the entire I mean the extension list which I want to access. So Jenkins fetch configuration as code schema shows right up because I recently used it if at all it doesn't show up you can definitely go ahead and type it. Yeah so this probably loads in the configuration you might see a progress bar to your bottom left which will show you the extension getting activated and that would load in I mean you give it a couple of seconds and that should that should probably give you the Jenkins the jcast schema so if you go into your working directory you will notice an entire jcast schema being pulled so the plugin I won't go into the details since it's a more of a hands-on demo but if at all any of the users are concerned with this you will have a jcast schema.json generator and if you want to know more about it you can visit the editor I mean the settings.json which will automatically pull in the that is used to I mean detect.yml file so if at all you want to change that configuration I mean if you wanted to detect some sort of any other file I mean you can use that as well but for the purposes of this demo and since jcast supports by ml we have this already put in so yeah so yeah so I can begin with the demo okay so first of all just give me a second yeah so first of all I would like to I would be putting headings into the demo I mean the headings into the ml file as to what I'm going to be showing you so that you know what features does the plugin provide you out of the box so I would like to begin with the first part that is the correct clues of integers and so I would like to type it out so that if at all I'm going to share I mean you can when you're referring to this video it makes it easier for you so configuration correct documents are correct to your computers okay yeah okay so let's begin so if you hit control p you might once again oh my god that's the terminal sorry for that okay yeah so if you go on right here you can see Jenkins and if you hit control p you can get all of the all of the sort of I mean subcategory that you can configure so for this I've chosen number of executors so if you check it out you can have number of executors so here if I don't know what now my executors is and I just enter hello world it will tell me hey that's not what I'm expecting I'm expecting an integer so yeah that would immediately throw up an error so you can say okay yeah number of executors should be three okay so I'm moving on to system message so hit control p again system message and now hey I don't know maybe I just type in four for some reason it says hey no you can't do that that's not allowed you I'm excited I'm expecting a string here so yeah so that would give you the hello world and for example you might get confused with the scm recount right and maybe I don't know what that is and maybe I just end up some random string value whatever and then it just tells me hey no that's not what I'm expecting I'm expecting an integer so yeah that you can end up and one of the things one of the most important ones here is the the use of enumerations so as a normal user if at all I don't know what mode is I might be tempted to enter something like hey I mean mode something like here and it immediately throws us an error hey value is not accepted your valid values are normal and exclusive so the configuration the plugin automatically tells you that they aren't allowed and it also may tell you in certain instances what kind of values are allowed if they are enumerations so in this case my mode is normal or exclusive any other value won't be accepted so it saves you time writing this yaml file so you can go in with normal and then yeah the the the plugin will tell you hey everything's fine okay so I would like the next part I would like to demo is the use of documentation now this feature is not entirely flawless because we have been working on making documentation more available to the users that there are certain instances where it isn't well documented so certain parts of your code might not have documentation and you might not know what each and every of those values mean but hey we have tried it so far and this part tells us about more about how can you learn more about what configuration we use so just forgive me for the spellings the documentation yeah okay so yeah so if you go into security and you go into api token so it should give us yeah here it is so this should give us creation of legacy token enabled so yeah it tells you more about what it is what legacy token is what new api what what accepts and more about how the developer has written more about it so if you go to see you can have it for usage statistics enabled or token generation on creation or any of this sort now let me tell you there's a disclaimer here that this isn't completely flawless there are certain times where you may not get this feature but we have tried our utmost best at including it wherever possible or where there is an open issue in jcatz to be able to include more of this so that we can i mean get this more out of the box so that users can know i mean what what to what what are they writing exactly and what each what each sub configuration does mean so yeah this would this would demonstrate more of the documentation aspect of it i've chosen this you can choose you can by writing your files if you don't get documentation you can open up an issue and maybe look into it okay so for the purposes of this demo these are the two main uses of it i mean since that isn't i mean explicitly any use case which we would like to demo but what we were trying to overcome is the nesting of nesting of configuration so that has been well achieved here and here so you can enter whatever is your value so for the purpose of this demo i've chosen the git scm plugin so one of the most common use cases for for it i mean most used plugin configuration and i wanted to take you through how you can write a configuration file using this i mean i've not cleared the above but you can definitely i mean write a new file from from stats so yeah you can join into me so if i was a developer and i wanted to write maybe a configuration file for the git scm i would just jump into it directly and just begin i mean so so yeah so as a developer maybe i know that there is one option okay sorry for that yeah there is a something called as unclassified so hey so that it has me okay unclassified and now i i would like to choose what is the next value so i realize okay i need git scm so yeah git scm oh hey yeah so that shows me git scm and now i would like to know what other fields i can configure under it so if you if you were probably writing this email file before this plugin was developed you would probably have to look up the documentation or look up the demo but hey we've solved all of that so no hands so yeah basically you can use the global config email and enter your email and then you can okay so after ending the email you say hey i need maybe a global configuration name and yeah that there it is so yeah i mean you can enter that so there isn't any magic search here so just for purposes of this demo and okay so then i realize create account based on email now if maybe if i don't know what the value is and i enter something yes and then i realize no hey i mean it requires a boolean so yeah so yeah that would accept it okay yeah and if i wanted any other use case such as use existing account with email and it would tell me i need a boolean again so yeah so you can just enter that or for also whatever so yeah that would probably give you the entire git scm configuration right of the box and hey so it's validated and you load it into your jcask and boom you have a running Jenkins instance and that saves us a lot of time i mean rather reloading it again and again so yeah so this was the entire demo section i mean where i take in some um files and i've written it out um yeah so this was basically the entire um the entire i mean meat of the demo if you could say uh that is about it but um moving on from that i mean i would like to tell users about what's next for the plugin but just before i get into what's next for the plugin i would like to tell users how they could basically contribute to this plugin so i would be including links in the online meat in the meat uh i mean in the uh slide deck and i would be polishing the side deck so you can have a look at it later on um but yeah this is the the vs code extension uh source code and basically you can open any of the issues here we have some um good first issues um you can search then we haven't any um i mean we have we don't have a lot of issues here but if at all you have any feature requests or any sort of um issues that you would like to raise feel free to just jump in and open a new issue and we'll definitely look into it and so this is how we would love to accept we would love to see some pull requests from you on some of the most uh desired features for this plugin um we have our uh kit a channel as well which will be linked into the online meetup size you can jump in there and i mean ask questions request for features and we would definitely look into it apart from that um i mean just before i jump into this this is more of a open discussion but i included a what's next for the plugin um so we wanted to address some of the existing issues and bugs that we have with the plugin like said it doesn't provide some user feedback on certain cases and uh there was a common configuration for re-use by other vs code plugins open and we could be more having a look at this so this is i mean this is the direction we want to take the plugin into and it's more of an open focus on new features i mean if at all we could develop some sort of an interface where we can where users don't have to configure their settings again and again for different vs code plugin uh we would be working on that um so if at all you have any idea suggestions feel free to join in the get a chat or feel free to um i mean free free to open issues apart from that what's next on the plugin is more of a community discussion um love to hear from you and um uh thanks for yeah listening to my demo um so i would give the stage back to Oleg thanks a lot for your presentation it was really interesting so one comment mostly for the record that uh we apparently go to duplication of meetings so we had something like 15 to 20 people stranded at another call with the same URL and basically we were unable to do anything with that uh so we will be publishing the recording of this meetup and uh we will do a recap if needed so my apologies to everyone who was affected uh yeah sorry for this uh yeah so let's go to the presentation yeah i think it was a really really good feature and thanks a lot to Sladin for his work as you welcome the beginning sorry yeah welcome yeah as i we said in the beginning it was our first experiment with community bridge mentorship so just to explain uh Jenkins gets funding and we facilitate funding for donations and uh we used this money to run a project on our own and uh it worked pretty well so we hope to keep doing it so and yeah thanks Sladin for all your hard work it's not only related to jcask Sladin also helped us to stuff some things for google summer of code for plugin documentation migration and for many other areas so yeah thanks a lot for all your contributions unfortunately team jackamp is also on another call so he's unable to join but yeah maybe we could get a follow up from him later meanwhile does anybody have any questions about the presentation about the features created by Sladin so we can discuss these features and answer questions if you want to ask something you can just unmute yourself and ask anyone okay then i'll ask a question so regarding the current implementation are there any limitations users should be aware of i guess apart from apart from nesting in certain cases there are a few areas to expand upon i mean there is um there is some issues with the nesting of schema so if you are probably uh i mean if you are probably writing a uh a configuration file and you realize that underrun classified there's a git scm and there's a there's a global config email and maybe there are a few more nested fields you might not get uh the autocomplete feature for that because we haven't been able to completely perfect uh the nesting of the schema because it requires a lot of um a lot of um i mean generation issues i mean with the with respect to the nesting so i mean if there are some if the schema is very very nested you might fail you might run into issues that you might not get the autocomplete or validation feature i mean with deli sense might not just recognize the nesting of the schema it might not give you the feedback that you acquire so that would be one limitation and i mean the other limitation is the documentation so if you're expecting the schema to throw up documentation for every single configuration file that you write uh you might be disappointed to see that it isn't included because that is that is an area that we found out why development that there isn't enough documentation for uh the part of the fields i mean so we have we have open issues regarding the same so we have we have been working on them and probably in some time maybe when we have that feature rolled out you might have documentation for each and every uh configuration field that you write in jcasc so yeah that's the those are the only two limitation i mean limitations that are uh currently affecting you writing schemas okay so if somebody hits any other limitations what would be the best way to report issues yeah so the best way if you have any other limitations the best way to report issues is on um the the jcasc rescode extension i mean the source code repository or if you aren't much of um i mean if you aren't comfortable with uh reporting issues here you can definitely drop into our gitter chat so if once i publish these slides you can definitely look into our gitter chat just hop in there ask questions uh report issues throw up throw up any i mean anything that you want to know about it or want to contribute or whatever feel free to jump in we would love your contribution um so yeah that's that's the best way i mean to get involved with the plugin development if you have any more new ideas you can definitely uh post it on the jenkins developers group or even come to come visit our gitter chat we would be really excited to meet you yeah plus for the future we can have more features for example uh yeah the general sound specification which is generated is just the first step and it can be consumed not only by jcasc plugin for visual studio code but by other plugins or maybe somebody would like to create an online service which validates the configs maybe as a part of the jenkins instance so there is still a lot of opportunities to contribute if you're interested in such topics yeah okay any other questions if now i think we could close down the meet up shortly are you thinking about doing a second presentation about uh read only system configurations so the feature which was just released in this weekly okay since the team jackam also is unable to connect to the call we will have to postpone this to the next meet up yeah okay so then thanks everyone for joining this session and we are sorry for all the technical issues we can forward to see you at the next meetups and we will make sure that everything works well yeah thank you everyone for attending and listening really appreciate it okay thank you like hosting the meeting as well happy to do that okay thanks so yeah bye bye everyone