Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Oct 18, 2023
2 parents 9c00173 + aff5e5d commit a0301b3
Show file tree
Hide file tree
Showing 20 changed files with 166,319 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [11, 17]
java: [11, 17, 21]
os: [ubuntu-latest]
distribution: [temurin]
include:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure GIT
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-from-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ncipollo/release-action@v1
with:
body: 'Changes: https://devops.wcm.io/conga/changes-report.html'
Expand Down
6 changes: 6 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 https://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="1.16.4" date="2023-10-18">
<action type="fix" dev="sseifert" issue="47">
Increase SnakeYAML codepoint limit to 64MB (from default 3MB).
</action>
</release>

<release version="1.16.2" date="2023-08-31">
<action type="fix" dev="sseifert">
conga-maven-plugin: Eliminate warning "Parameter 'repoSession' (user property 'repositorySystemSession') is read-only, must not be used in configuration".
Expand Down
4 changes: 2 additions & 2 deletions generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>io.wcm.devops.conga</groupId>
<artifactId>io.wcm.devops.conga.parent</artifactId>
<version>1.16.2</version>
<version>1.16.4</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

Expand All @@ -44,7 +44,7 @@
<dependency>
<groupId>io.wcm.devops.conga</groupId>
<artifactId>io.wcm.devops.conga.model</artifactId>
<version>1.16.2</version>
<version>1.16.4</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package io.wcm.devops.conga.generator.util;

import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -186,7 +187,7 @@ private Object resolveSingle(Matcher matcher, Map<String, Object> variables, int
// resolve variable
if (variableMatcher.matches()) {
String valueProviderName = variableMatcher.group(VARIABLE_POS_VALUE_PROVIDER_NAME);
String variable = StringUtils.defaultString(variableMatcher.group(VARIABLE_POS_VARIABLE_1), variableMatcher.group(VARIABLE_POS_VARIABLE_2));
String variable = Objects.toString(variableMatcher.group(VARIABLE_POS_VARIABLE_1), variableMatcher.group(VARIABLE_POS_VARIABLE_2));
String defaultValueString = variableMatcher.group(VARIABLE_POS_DEFAULT_VALUE);

Object valueObject = variableResolver.resolve(valueProviderName, variable, defaultValueString, variables);
Expand Down Expand Up @@ -241,7 +242,7 @@ private Object resolveMulti(Matcher matcher, Map<String, Object> variables, int
// resolve variable
if (variableMatcher.matches()) {
String valueProviderName = variableMatcher.group(VARIABLE_POS_VALUE_PROVIDER_NAME);
String variable = StringUtils.defaultString(variableMatcher.group(VARIABLE_POS_VARIABLE_1), variableMatcher.group(VARIABLE_POS_VARIABLE_2));
String variable = Objects.toString(variableMatcher.group(VARIABLE_POS_VARIABLE_1), variableMatcher.group(VARIABLE_POS_VARIABLE_2));
String defaultValueString = variableMatcher.group(VARIABLE_POS_DEFAULT_VALUE);

Object valueObject = variableResolver.resolve(valueProviderName, variable, defaultValueString, variables);
Expand Down
4 changes: 2 additions & 2 deletions model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>io.wcm.devops.conga</groupId>
<artifactId>io.wcm.devops.conga.parent</artifactId>
<version>1.16.2</version>
<version>1.16.4</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

Expand All @@ -40,7 +40,7 @@
<dependency>
<groupId>io.wcm.devops.conga</groupId>
<artifactId>io.wcm.devops.conga.resource</artifactId>
<version>1.16.2</version>
<version>1.16.4</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
*/
package io.wcm.devops.conga.model.reader;

import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;

import io.wcm.devops.conga.model.environment.Environment;
import io.wcm.devops.conga.model.util.YamlUtil;

/**
* Reads environment definitions.
Expand All @@ -38,7 +38,7 @@ public EnvironmentReader() {
}

private static Yaml getYaml() {
Constructor constructor = new Constructor(Environment.class, new LoaderOptions());
Constructor constructor = new Constructor(Environment.class, YamlUtil.createLoaderOptions());
return new Yaml(constructor);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
*/
package io.wcm.devops.conga.model.reader;

import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;

import io.wcm.devops.conga.model.role.Role;
import io.wcm.devops.conga.model.util.YamlUtil;

/**
* Reads role definitions.
Expand All @@ -38,7 +38,7 @@ public RoleReader() {
}

private static Yaml getYaml() {
Constructor constructor = new Constructor(Role.class, new LoaderOptions());
Constructor constructor = new Constructor(Role.class, YamlUtil.createLoaderOptions());
return new Yaml(constructor);
}

Expand Down
48 changes: 48 additions & 0 deletions model/src/main/java/io/wcm/devops/conga/model/util/YamlUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* #%L
* wcm.io
* %%
* Copyright (C) 2023 wcm.io
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package io.wcm.devops.conga.model.util;

import org.yaml.snakeyaml.LoaderOptions;

/**
* Helper methods for SnakeYAML.
*/
public final class YamlUtil {

/*
* Increase default codepoint limit from 3MB to 64MB.
*/
private static final int YAML_CODEPOINT_LIMIT = 64 * 1024 * 1024;

private YamlUtil() {
// static methods only
}

/**
* Create a new loader options instances with default configuration.
* @return SnakeYAML loader option.s
*/
public static LoaderOptions createLoaderOptions() {
LoaderOptions options = new LoaderOptions();
options.setCodePointLimit(YAML_CODEPOINT_LIMIT);
return options;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* #%L
* wcm.io
* %%
* Copyright (C) 2023 wcm.io
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package io.wcm.devops.conga.model.util;

import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.io.IOException;
import java.io.InputStream;

import org.junit.jupiter.api.Test;
import org.yaml.snakeyaml.Yaml;

class YamlUtilTest {

@Test
void testLoadSmallYamlFile() throws IOException {
Yaml yaml = new Yaml(YamlUtil.createLoaderOptions());
try (InputStream is = YamlUtilTest.class.getResourceAsStream("/role.yaml")) {
assertNotNull(yaml.load(is));
}
}

@Test
void testLoadHugeYamlFile() throws IOException {
Yaml yaml = new Yaml(YamlUtil.createLoaderOptions());
try (InputStream is = YamlUtilTest.class.getResourceAsStream("/hugefile.yaml")) {
assertNotNull(yaml.load(is));
}
}

}
Loading

0 comments on commit a0301b3

Please sign in to comment.