XebiaLabs DevOps as Code is designed to work with any continuous integration tool that can run commands. By using specifications defined in the XL YAML format and a simple XL CLI utility to execute them, DevOps as Code offers a lightweight but powerful integration for deploying your applications using common CI tools.

To simplify your integration, you can utilize a wrapper script to bootstrap the XL CLI commands on your Unix or Windows-based Continuous Integration (CI) servers without having to install the XL CLI executable itself. The script is stored with your project YAML files and you can execute XL CLI commands from within your CI tool scripts.

Wrapper advantages

The DevOps as Code functionality and the use of a wrapper with your CI tool will enable you to automatically fetch a specific version of the XL CLI binary file. You can:

  • Store YAML files in source control.
  • Create CIs in XL Deploy and start a release in XL Release with a single command.
  • Eliminate the need to install a XebiaLabs plugin in your CI tool.

Add a wrapper script to your project

To add a wrapper script to your project, execute the xl wrapper command from the project root and then continue to develop the XL YAML files for your project. When you store project files in your source code repository, the wrapper script will be included and can then be invoked within your CI tool.

The following sections provide examples of how to utilize this configuration in common CI tools (Jenkins, Travis CI and Microsoft Azure DevOps).

Jenkins

To execute XL CLI commands from within your Jenkinsfile:

  1. Depending on your CI server OS, define a sh (Linux or macOS) or bat (Windows) step in your Jenkinsfile.

    For Windows:

       ....
       stages {
           stage("Apply xebialabs.yaml") {
               steps {
                   bat "xlw.bat apply -v -f xebialabs.yaml"
               }
           }
       }
    
    

    For Linux/macOS:

       ....
       stages {
           stage("Apply xebialabs.yaml") {
               steps {
                   sh "./xlw apply -v -f xebialabs.yaml"
               }
           }
       }
    
  2. When the steps defined in the Jenkinsfile are executed, the XL CLI commands also will be executed using your XL YAML file(s).

  3. You can configure additional bat or sh calls by adding desired XL CLI commands and parameters.

Travis CI

To execute XL CLI commands from within your .travis.yml file:

  1. Define a script step in your .travis.yml file. For example:

    ./xlw apply -f xebialabs.yml

  2. When the steps defined in the .travis.yml file are executed, the XL CLI commands also will be executed using your XL YAML file(s).

  3. You can configure additional script calls by adding desired XL CLI commands and parameters.

DevOps Azure

On DevOps Azure you can define your build pipeline using a YAML file which is typically called azure-pipeline.yml and located in the root of the repository.

To execute XL CLI commands from within your azure-pipeline.yml file:

  1. Depending on your CI server OS, define a sh (Linux or macOS) or bat (Windows) step in your azure-pipeline.yml file.

    For Windows:

     os: windows
     script:
       - cmd.exe /c "xlw.bat apply -f xebialabs.yaml"
    

    For Linux/macOS:

     os: linux
     script:
     - ./xlw apply -f xebialabs.yaml
    
  2. When the steps defined in the azure-pipeline.yml file are executed, the XL CLI commands also will be executed using your XL YAML file(s).

  3. You can configure additional bat or sh calls by adding desired XL CLI commands and parameters.