Digital.ai Release and Deploy Community Plugins

View on GitHub

Welcome to the Digital.ai Plugin Community

This page describes how you can contribute to the Digital.ai Release and Deploy community plugins, with supplemental information around continuous integration and versioning/release details.

To join the xebialabs-community organization, create a GitHub account and request to join the organization by sending an email to rbroker@xebialabs.com and amohleji@xebialabs.com.

Quickstart for Existing Plugins

If you want to contribute to an existing repository, simply fork the repository, make your changes, and send a pull request. If you need help with this, contact an existing plugin contributor - for example the person who last committed to that repository.

Plugin Setup

License

Digital.ai requires that each plugin use the MIT license:

Copyright <YEAR> <COPYRIGHT HOLDER>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Licensing can be easily handled using the Gradle license plugin:

plugins {
    id "com.github.hierynomus.license" version "0.13.1"
}
...
license {
  header rootProject.file('License.md')
  strictCheck false
  ext.year = Calendar.getInstance().get(Calendar.YEAR)
  ext.name = 'XEBIALABS'
}

Dependencies

We have a public artifact repository which Gradle or Maven can use to fetch dependencies. It is located at https://dist.xebialabs.com/public/maven2. A Gradle configuration which uses the repository would look like this:

repositories {
  ...
  maven {
    url 'http://dist.xebialabs.com/public/maven2'
  }
}

Gradle Wrapper

Using a Gradle wrapper ensures that the same Gradle version is used for all builds (including on Travis CI). An example Gradle wrapper can be found in the xld-openshift-plugin repository. You can copy the example wrapper or create one yourself using gradle wrapper.

Builds should typically be ran with ./gradlew build.

Releases and Versioning

Versioning - Manual/Basic Option

Versioning - Automated Option

Nebula eliminates the need to set and/or change the version number in the Gradle file. The CI build will use the version number set in the commit tag. The tags in the repository must be set appropriately by the developer for a major, minor, or patch release using the Nebula conventions.

Gradle Config

if (!project.hasProperty('release.scope')) {
  project.ext['release.scope'] = 'patch'
}
if (!project.hasProperty('release.useLastTag')) {
  project.ext['release.useLastTag'] = true
}

Nebula Compatibility of Existing Tags

Check that existing tags meet Nebula conventions. The tag format should be vx.y.z, where x = major release number, y = minor release number, z = patch level. See the Semantic Versioning reference at https://semver.org.

Releases

  1. Confirm a successful build in your local directory.
  2. Commit the code changes in your local directory, then push them to the GitHub repository.
  3. Set the appropriate tag, e.g., git tag -a "v1.3.0" -m "Version 1.3.0" for the last commit.
  4. Execute git push --follow-tags.
  5. Each push will trigger a Travis job; the second job will add the files listed to the repository's Releases page.
  6. Consider editing the release notes in GitHub to provide better insight into what's included/important for this release.

Continuous Integration

GitHub Actions

GitHub Actions is the default and recommended option for continuous integration after December 1, 2020. Minimal configuration is required to setup a GitHub Actions CI workflow. Two files should be defined at $REPO/.github/workflows/build.yaml and $REPO/.github/workflows/release.yaml. Examples for copy and paste are shown below:

For build.yaml:
name: "build"

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8
      - name: Build with Gradle
        run: ./gradlew clean build
This build ensures every commit results in a plugin which can be successfully compiled. The three automated steps in this workflow are:
  1. Check out the repository
  2. Install Java 1.8
  3. Run the Gradle build
For release.yaml
name: "release"

on:
  push:
    tags:
      - "v*"

jobs:
  release:
    runs-on: "ubuntu-latest"
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8
      - name: Build with Gradle
        run: ./gradlew clean build
      - uses: "marvinpinto/action-automatic-releases@latest"
        with:
          repo_token: "${{ secrets.GITHUB_TOKEN }}"
          prerelease: false
          files: |
            ./build/libs/xlr-jenkins-multibranch-plugin-*.jar
This workflow will only run on tagged commits. It builds the plugin, then creates a new versioned release. Replace the files: value of ./build/libs/xlr-jenkins-multibranch-plugin-*.jar with a value for your specific plugin. Note that the secret value in this config is automatically provided by GitHub Actions, and does not need to be manually configured. Again, setting up these two files should be all that is needed for GitHub Actions CI setup. The four automated steps in this workflow are:
  1. Check out the repository
  2. Install Java 1.8
  3. Run the Gradle build
  4. Create a release based on the tag

Travis CI

Some plugins use Travis CI for continuous integration. Go to Travis CI and log in with your GitHub account. After you log in, you'll see the community plugins being built. The build configuration is provided by the .travis.yml file in each repository. More information is available at the Travis CI documentation site.

When creating the .travis.yml file, please configure Slack notifications as described here and GitHub releases as described here. Use the XebiaLabsCommunityCI system account for GitHub keys.

Travis Config

Edit the .travis.yml file:

on:
  all_branches: true
  tags: true
  repo: repo-owner/repo-name

Example:

deploy:
  provider:  releases
  api_key:
    secure:  ...
  file_glob:  true
  file:  build/distributions/*
  skip_cleanup:  true
  on:
    all_branches:  true
    tags:  true
    repo:  repo-owner/repo-name

Definition of Done

  1. Each repository must include the MIT license.
  2. Each repository must have a description.
  3. Each repository must have one or more GitHub topics defined.
  4. If your repository is a plugin, the repository name should end with plugin.
  5. If your repository is a plugin for XL Deploy, the repository name should start with xld.
  6. If your repository is a plugin for XL Release, the repository name should start with xlr.
  7. Each repository must have public CI enabled (GitHub Actions, TravisCI, or other) and the corresponding badge in the README.md file.

Extra Information