jenkins.yaml JSON Schemas

Schema Files

Use the following links to download the JSON schemas for use in your IDE or other validation tools.

The ci-file-generator Maven plugin, as of version 1.5.0, includes automatic validation during builds.

Service/Mock/Web Schema

Since the service, mock, and web schemas are equivalent, the service schema is provided below to represent all (the only difference being the $id attribute values)

jenkins-service.schema.json, jenkins-mock.schema.json, jenkins-web.schema.json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://devops.ngss.va.gov/v1/jenkins-service.schema.json",
  "title": "jenkins.yaml",
  "definitions": {
    "PeriodicBuild": {
      "type": "object",
      "properties": {
        "branch": {
          "type": "string",
          "description": "Branch name to build periodically"
        },
        "cron": {
          "type": "string",
          "description": "crontab-formatted value specifying when to periodically build the specified branch"
        }
      }
    },
    "CustomParameter": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the Jenkins build parameter to be created"
        },
        "description": {
          "type": "string",
          "description": "Description of the Jenkins build parameter"
        },
        "type": {
          "enum": [ "string", "booleanParam" ],
          "description": "The Jenkins build parameter type"
        },
        "defaultValue": {
          "type": [ "string", "boolean"],
          "description": "The default value of the parameter, if the configKey isn't set"
        },
        "configKey": {
          "type": "string",
          "description": "The jenkins.yaml property name to be used as the default value"
        },
        "environmentVariable": {
          "type": "string",
          "description": "The environment variable to export with the value provided in the parameter"
        }
      },
      "additionalProperties": false
    },
    "Config": {
      "type": "object",
      "properties": {
        "artifactId": {
          "type": "string"
        },
        "groupId": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "image": {
          "type": "string",
          "default": "/PREFIX/SERVICE_NAME",
          "description": "Image name without the DTR prefix",
          "pattern": "^\\/[a-zA-Z0-9]+\\/[a-zA-Z0-9_-]+",
          "message": {
            "pattern": "'image' must be in the format '/prefix/image_name'"
          }
        },
        "language": {
          "type": "string",
          "enum": [
            "java",
            "go",
            "javascript"
          ]
        },
        "buildTool": {
          "type": "string",
          "enum": [
            "skaffold-maven",
            "helm-maven",
            "skaffold-ko",
            null
          ]
        },
        "imageTool": {
          "type": "string",
          "enum": [
            "skaffold",
            "jib",
            "docker",
            null
          ]
        },
        "moduleDir": {
          "type": "string"
        },
        "mavenBuildCommand": {
          "type": "string",
          "pattern": "mvn .+"
        },
        "enableVV": {
          "type": "boolean"
        },
        "enableSonar": {
          "type": "boolean"
        },
        "sonarMainBranchOnly": {
          "type": "boolean"
        },
        "sonarReportBranch": {
          "type": "string",
          "default": "master"
        },
        "enableQualityGate": {
          "type": "boolean"
        },
        "sonarReportUrl": {
          "type": "string",
          "default": "coderepo.mobilehealth.va.gov/scm/SET_ME/quality-reports.git"
        },
        "postDeployHookCmd": {
          "type": "string"
        },
        "pushAllBranchImages": {
          "type": "boolean"
        },
        "enableManualDeploy": {
          "type": "boolean"
        },
        "enableAutoDeploy": {
          "type": "boolean"
        },
        "enableSlackNotifications": {
          "type": "boolean"
        },
        "slackChannel": {
          "type": "string"
        },
        "slackFailureChannel": {
          "type": "string"
        },
        "vvReportUrl": {
          "type": "string",
          "default": "coderepo.mobilehealth.va.gov/scm/SET_ME/vv-reports.git"
        },
        "publishSnapshots": {
          "type": "boolean"
        },
        "checkImageExists": {
          "type": "boolean"
        },
        "cacheKeyEnabled": {
          "type": "boolean"
        },
        "jiraProject": {
          "type": "string",
          "default": "SET_ME"
        },
        "jiraComponent": {
          "type": "string"
        },
        "enableOisScan": {
          "type": "boolean"
        },
        "branchesOisScanRegex": {
          "type": "string",
          "format": "regex",
          "default": "(?i)(main|release/.*)"
        },
        "deferCodeQLInit": {
          "type": "boolean"
        },
        "buildCommandForCodeQL": {
          "type": "string",
          "default": "'mvn clean install --batch-mode -Dmaven.test.skip -Pskip-all-generation -Dhelm.skip -Ddocker.skip -Djib.skip -Djacoco.skip=true -Djacoco.dump.skip=true -Pjenkins,jenkins-sandbox,'"
        },
        "mavenDeployOptsRelease": {
          "type": "string"
        },
        "mavenDeployOptsSnapshot": {
          "type": "string"
        },
        "branchesToPushImageRegex": {
          "type": "string",
          "format": "regex"
        },
        "deployNamespace": {
          "type": "string"
        },
        "skip": {
          "type": "boolean"
        },
        "runNewman": {
          "type": "boolean"
        },
        "enableTagRelease": {
          "type": "boolean"
        },
        "enableFlexline": {
          "type": "boolean"
        },
        "customParameters": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/CustomParameter"
          }
        }
      }
    }
  },
  "allOf": [
    {"$ref": "#/definitions/Config"},
    {
      "properties": {
        "periodicBuild": {
          "$ref": "#/definitions/PeriodicBuild"
        }
      }
    }
  ],
  "properties": {
    "artifactId": true,
    "groupId": true,
    "version": true,
    "image": true,
    "language": true,
    "buildTool": true,
    "imageTool": true,
    "moduleDir": true,
    "mavenBuildCommand": true,
    "enableVV": true,
    "enableFortify": true,
    "enableReleaseOnlyFortify": true,
    "enableSonar": true,
    "sonarMainBranchOnly": true,
    "sonarReportBranch": true,
    "enableQualityGate": true,
    "sonarReportUrl": true,
    "postDeployHookCmd": true,
    "pushAllBranchImages": true,
    "enableManualDeploy": true,
    "enableAutoDeploy": true,
    "enableSlackNotifications": true,
    "slackChannel": true,
    "slackFailureChannel": true,
    "vvReportUrl": true,
    "publishSnapshots": true,
    "checkImageExists": true,
    "cacheKeyEnabled": true,
    "jiraProject": true,
    "jiraComponent": true,
    "enableOisScan": true,
    "deferCodeQLInit": true,
    "buildCommandForCodeQL": true,
    "branchesOisScanRegex": true,
    "mavenDeployOptsRelease": true,
    "mavenDeployOptsSnapshot": true,
    "branchesToPushImageRegex": true,
    "periodicBuild": true,
    "deployNamespace": true,
    "skip": true,
    "runNewman": true,
    "enableTagRelease": true,
    "runK6": true,
    "customParameters": true,
    "enableFlexline": true,
    "sandbox": {
      "type": "object",
      "$ref": "#/definitions/Config",
      "properties": {
        "periodicBuild": true
      },
      "additionalProperties": false
    },
    "staging": {
      "type": "object",
      "$ref": "#/definitions/Config",
      "additionalProperties": false
    },
    "prod": {
      "type": "object",
      "$ref": "#/definitions/Config",
      "additionalProperties": false
    }
  },
  "required": ["image"],
  "if": {
    "properties": {
      "enableOisScan": {
        "anyOf": [
          {
            "const": null
          },
          {
            "const": true
          }
        ]
      }
    }
  },
  "then": {
    "required": [ "jiraProject" ]
  },
  "additionalProperties": false
}

Library Schema

jenkins-library.schema.json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://devops.ngss.va.gov/v1/jenkins-library.schema.json",
  "title": "jenkins.yaml",
  "definitions": {
    "PeriodicBuild": {
      "type": "object",
      "properties": {
        "branch": {
          "type": "string"
        },
        "cron": {
          "type": "string"
        }
      }
    },
    "properties": {
      "mavenBuildCommand": {
        "type": "string"
      },
      "enableSonar": {
        "type": "boolean"
      },
      "sonarMainBranchOnly": {
        "type": "boolean"
      },
      "sonarReportBranch": {
        "type": "string",
        "default": "master"
      },
      "enableQualityGate": {
        "type": "boolean"
      },
      "sonarReportUrl": {
        "type": "string",
        "default": "coderepo.mobilehealth.va.gov/scm/SET_ME/quality-reports.git"
      },
      "publishSnapshots": {
        "type": "boolean"
      },
      "checkImageExists": {
        "type": "boolean"
      },
      "cacheKeyEnabled": {
        "type": "boolean"
      },
      "enableOisScan": {
        "type": "boolean"
      },
      "deferCodeQLInit": {
        "type": "boolean"
      },
      "enableFlexline": {
        "type": "boolean"
      },
      "periodicBuild": {
        "$ref": "#/definitions/PeriodicBuild"
      }
    }
  },
  "additionalItems": false
}