class MultiPlatformValidator extends Object
Validates platforms, lifecycles, and toolchains for multiple operating systems; and their unstable counterparts; as a whole collection. This helps guarantee, for a given platforms file, lifecycles and toolchains are loaded for mult-platform matrix support.
To run this example, clone Jervis and execute ./gradlew console to bring up a Groovy Console with the classpath set up.
import net.gleske.jervis.beta.MultiPlatformValidator
MultiPlatformValidator platforms = new MultiPlatformValidator()
platforms.loadPlatformsString(new File('resources/platforms.yaml').text)
platforms.getToolchainFiles().each { String fileName ->
if(!new File("resources/${fileName}.yaml").exists()) { return }
platforms.loadToolchainsString(fileName, new File("resources/${fileName}.yaml").text)
}
platforms.getLifecycleFiles().each { String fileName ->
if(!new File("resources/${fileName}.yaml").exists()) { return }
platforms.loadLifecyclesString(fileName, new File("resources/${fileName}.yaml").text)
}
platforms.getGeneratorFromJervis(yaml: 'language: shell')
| Type | Name and description |
|---|---|
List |
known_operating_systemsAll known operating systems across all platforms. |
List |
known_platformsAll known platforms. |
List |
known_toolchainsAll known toolchains across all operating systems. |
Map<String, LifecycleValidator> |
lifecyclesA mapping of known operating systems and their associated lifecycles of supported languages. |
PlatformValidator |
platform_objAn instance of the PlatformValidator class which as loaded a platforms file. |
Map<String, ToolchainValidator> |
toolchainsA mapping of known operating systems and their associated toolchains of supported languages. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
LifecycleGenerator |
getGeneratorFromJervis(Map options)Creates a LifecycleGenerator object out of provided options. |
|
List<String> |
getLifecycleFiles()Returns a list of file names without the extension in which to search for lifecycle files. |
|
PipelineGenerator |
getPipelineGeneratorForJervis(Map options) |
|
List<String> |
getToolchainFiles()Returns a list of file names without the extension in which to search for toolchain files. |
|
void |
loadLifecyclesString(String fileName, String yaml)Load a lifecycles YAML String so that default scripts can be generated. |
|
void |
loadPlatformsString(String yaml)Load a platforms YAML String so that advanced labels can be generated for multiple platforms. |
|
void |
loadToolchainsString(String fileName, String yaml)Load a toolchains YAML String so that default scripts can be generated. |
|
void |
validate()validate checks all supported operating systems and platforms to ensure that there's none missing. |
|
void |
validateJervisYaml(Map jervis_yaml)If given a .jervis.yml file, validate it against the known platforms and operating systems. |
All known operating systems across all platforms.
All known platforms.
All known toolchains across all operating systems.
A mapping of known operating systems and their associated lifecycles of supported languages.
An instance of the PlatformValidator class which as loaded a platforms file.
A mapping of known operating systems and their associated toolchains of supported languages.
Creates a LifecycleGenerator object out of provided options. Example with all options getGeneratorFromJervis(yaml: '', folder_listing: []
Returns a list of file names without the extension in which to search for lifecycle files.
Returns a list of file names without the extension in which to search for toolchain files.
Load a lifecycles YAML String so that default scripts can be generated. Lifecycles provide the build portions of the script.
yaml - A String containing YAML which is from a lifecycles file.Load a platforms YAML String so that advanced labels can be generated for multiple platforms. A platform could be a local datacenter or a cloud providor. The platforms file allows labels to be generated which include stability, sudo access, and even operating system. This could be used to load lifecycles and toolchains by platform and OS.
yaml - A String containing YAML which is from a platforms file.Load a toolchains YAML String so that default scripts can be generated. Toolchains provide the default tool setup of the script (e.g. what version of Java will be used).
fileName - The file name without the extension.yaml - A String containing YAML which is from a toolchains file.validate checks all supported operating systems and platforms to ensure that there's none missing. It will also check for some invalid configurations.
If given a .jervis.yml file, validate it against the known platforms and operating systems. This will check the configuration against the loaded platforms, lifecycles, and toolchains for supported languages. It will throw errors for misconfiguration provided in the .jervis.yml file.
jervis_yaml - A POJO created from a parsed .jervis.yml
file.