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

Configuration-as-Code compatibility #23

Merged
merged 13 commits into from
May 13, 2019
Merged

Configuration-as-Code compatibility #23

merged 13 commits into from
May 13, 2019

Conversation

cpoenisch
Copy link
Contributor

@cpoenisch cpoenisch commented Feb 26, 2019

Resolves #20

@cpoenisch cpoenisch added feature New feature request ecu-test labels Feb 26, 2019
@cpoenisch cpoenisch added this to the 2.7.0 milestone Feb 26, 2019
@cpoenisch cpoenisch self-assigned this Feb 26, 2019
- add migration routine from previous ATXPublisher configuration
- fix serialization of custom settings
- adapted tests
@cpoenisch
Copy link
Contributor Author

cpoenisch commented Apr 2, 2019

@jetersen
Copy link
Member

jetersen commented Apr 5, 2019

Thanks for using the GitHub tracking issue. Means I can avoid JIRA 😊

Copy link
Member

@jetersen jetersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pom.xml Outdated
<dependency>
<groupId>io.jenkins</groupId>
<artifactId>configuration-as-code</artifactId>
<version>1.7</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider updating the version and include the tests classifer

ConfigurationAsCode.get().export(outputStream);

ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
Map<String, Object> yamlConfig = new Yaml().load(inputStream);
Copy link
Member

@jetersen jetersen Apr 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public void testImportConfiguration() throws Exception {
final URL yamlConfig = this.getClass().getResource("configuration-as-code.yml");
System.out.println(yamlConfig);
ConfigurationAsCode.get().configure(yamlConfig.toString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the annotation @ConfiguredWithCode("configuration-as-code.yml") which the tests classifier includes.

- use settings list and deprecate config map due to incompatibility with CasC
- save name-value pairs for each setting only
- group association, descriptions and default values are synchronized with config.xml at plugin startup
- ensure backward compatibility with previous configuration
@jetersen
Copy link
Member

Tests are looking good! A lot cleaner now that you are not using the YAML load method 😅

@cpoenisch
Copy link
Contributor Author

Yep thanks for your hints!

public void testExportConfiguration() throws Exception {
final ETInstallation.DescriptorImpl etDescriptor = jenkins.jenkins
.getDescriptorByType(ETInstallation.DescriptorImpl.class);
etDescriptor.setInstallations(new ETInstallation("ECU-TEST", "C:\\ECU-TEST",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure you need to override the configuration, could validate the config loaded in from @ConfiguredWithCode("configuration-as-code.yml") 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right! I'll fix it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great now your fully validating the YAML config 🐑

@cpoenisch cpoenisch merged commit c36459a into master May 13, 2019
@cpoenisch cpoenisch mentioned this pull request May 13, 2019
@cpoenisch cpoenisch deleted the i20-casc branch May 17, 2019 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[JENKINS-57571] Configuration-as-Code compatibility
2 participants