Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added the Missing information on how to generate/create yaml file #2471

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions docs/PLUGINS.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ public class ConfigurationAsCodeTest {
Doing so, you will confirm JCasC is able to introspect your plugin and build the expected configuration data model, but also detect
some changes made to your plugin break this configuration model.

**Location of configuration-as-code.yml:**

The `configuration-as-code.yml` file should be located within the test resources directory (`src/test/resources`) of your project repository. Specifically, it should be placed in the same directory where your test classes reside.

You can find some examples here

1. [kubernetes-plugin](https://github.com/jenkinsci/kubernetes-plugin/blob/master/src/test/resources/org/csanchez/jenkins/plugins/kubernetes/casc/configuration-as-code.yaml)
2. [azure-cosmosdb-plugin](https://github.com/jenkinsci/azure-cosmosdb-plugin/blob/main/src/test/resources/io/jenkins/plugins/azurecosmosdb/configuration-as-code.yml)

### Backward compatibility test

About the latter, in case you need to introduce some breaking changes, you can define a backward compatibility test case:
Expand Down Expand Up @@ -297,12 +306,12 @@ public class ConfigurationAsCodeTest {
@ClassRule
@ConfiguredWithCode("configuration-as-code.yml")
public static JenkinsConfiguredWithCodeRule j = new JenkinsConfiguredWithCodeRule();

@Test
public void should_support_configuration_as_code() throws Exception {
...
}

@Test
public void should_support_configuration_export() throws Exception {
...
Expand All @@ -311,7 +320,8 @@ public class ConfigurationAsCodeTest {
```

### JSON Schema Test (Beta)
We generate a JSON schema that users can use to validate their changes and provide IDE assistance,

We generate a JSON schema that users can use to validate their changes and provide IDE assistance,
you can test that your plugin's example yaml file validates correctly by implementing the below test:
`SchemaGenerationTest` provides a abstraction layer to test out the plugins YAML file against the generated schema.

Expand All @@ -321,6 +331,7 @@ Step 1

Create a YAML file for the configurators corresponding to the developed plugin.
For eg: `validJenkinsConfigurator.yml`

```yaml
jenkins:
systemMessage: "Configured by Configuration as Code plugin"
Expand Down
Loading