Quantcast
Channel: Jenkins Blog
Viewing all articles
Browse latest Browse all 1087

Windows Service Wrapper : YAML Configuration Support - GSoC Phase - 02 Updates

$
0
0

Hello, world! GSoC 2020 Phase 2 has ended now and it was a great period for WinSW - YAML Configuration support project. In this blog post, I will announce the updates during the GSoC 2020 - Phase 2. If you are not already aware of this project, I would recommend reading this blog post which was published after GSoC 2020 - Phase 1.

Project Scope

  • Windows Service Wrapper - YAML configuration support

  • New CLI

  • Support for XML Schema validation

  • Support for YAML Schema validation

YAML Configuration Support

Under WinSW - YAML configurations support, these tasks will be done.

YAML to Object mapping

At the moment YAML object mapping is finished and merged. You can find all the implementations in this Pull Request.

Extend WinSW to support both XML and YAML

This task is already done and merged. Find the implementation in this Pull Request.

Validate Configurations on Startup

In the current implementation, configurations are validated on demand. So there may be failures due to bad configurations at the runtime. In this project, I will update WinSW to validate configurations at the startup. It is not implemented yet and will be in phase 3.

YAML Configuration support for Extensions

At the moment there are 2 internal plugins in WinSW. RunAwayProcessKiller and SharedDirectoryMapper. We allow users to provide configurations for those plugins in the same XML and YAML configuration file which is used to configure WinSW. At the moment XML is implemented. I have started working on YAML configuration support for extensions and it will be finished by the end of phase 3.

Key updates in Phase 2

  • YAML Configuration structure

    • Environment variables

      • Now users can provide environment variables as a sequence of dictionaries that contains name and value for environment variables.

    • TimeStamp values

      • Users can specify timestamp values in the same manner used in XML (e.g. 10 ms, 5 sec, 3 min)

  • YAML configuration document was published. YAML Configuration Specification

  • Extend the WinSW to support both XML and YAML

Sample YAML Configuration File

id: jenkinsname: Jenkinsdescription: This service runs Jenkins automation server.env:
    - name: JENKINS_HOMEvalue: '%LocalAppData%\Jenkins.jenkins'
    - name: LM_LICENSE_FILEvalue: host1;host2executable: javaarguments: >-
    -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle
    -jar "E:\Winsw Test\yml6\jenkins.war" --httpPort=8081log:mode: rotateonFailure:
    - action: restartdelay: 10 sec
    - action: rebootdelay: 1 hour

New CLI

Let me explain in brief, why we need a new CLI. In WinSW, we will keep both XML and YAML configuration support. But according to the current implementation, the user can’t specify the configurations file explicitly. Also, we want to let the user skip the schema validation as well. So We decided to move into new CLI which is more structured with commands and options. Please read my previous blog post to learn more about commands and options in the new CLI.

Key updates in phase 2

  • Remove the /redirect command

  • testwait command was removed and add the wait option to the test command.

  • stopwait command was removed and add the wait option to the stop command.

How to try

User can configure the Windows Service Wrapper by both XML and YAML configuration files using the following steps.

  1. Create the configuration file (XML or YAML).

  2. Save it with the same name as the Windows Service Wrapper executable name.

  3. Place the configuration file inside the directory(or in a parent directory), where the Windows Service Wrapper executable is located.

If there are both XML and YAML configuraiton files, Windows Service Wrapper will be configured by the XML configuration file.

GSoC 2020 Phase 2 Demo

Future Works

  • YAML schema validation

    • YAML Configuration file will be validated with the JSON schema file.

  • XML Schema validation

    • XML configuration file will be validated with the XSD file. I have started working on this feature and you can find the implementation in this Pull Request.

  • YAML Configuration validate on startup

  • YAML support for Extensions

How to contribute

You can find the GitHub repository in this link. Issues and Pull requests are always welcome. Also, you can communicate with us in the WinSW Gitter channel, which is a great way to get in touch and there are project sync up meetings every Tuesday at 13:30 UTC on the Gitter channel.


Viewing all articles
Browse latest Browse all 1087

Trending Articles