This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new c88c404dd8 NIFI-9826 Moved build locale settings from Maven to GitHub
Workflow
c88c404dd8 is described below
commit c88c404dd872e159810c60b0e342ce465b284af2
Author: Paul Grey <[email protected]>
AuthorDate: Tue Apr 19 16:35:09 2022 -0400
NIFI-9826 Moved build locale settings from Maven to GitHub Workflow
- Adjusted Java 17 build locale settings
- Added test to verify match between System properties and build
environment variables
This closes #5980
Signed-off-by: David Handermann <[email protected]>
---
.github/workflows/ci-workflow.yml | 46 +++++++++++++-----
nifi-commons/nifi-build/pom.xml | 25 ++++++++++
.../apache/nifi/build/VerifyBuildLocaleTest.java | 55 ++++++++++++++++++++++
nifi-commons/pom.xml | 1 +
pom.xml | 6 ---
5 files changed, 114 insertions(+), 19 deletions(-)
diff --git a/.github/workflows/ci-workflow.yml
b/.github/workflows/ci-workflow.yml
index 107e406294..c3e7ee7728 100644
--- a/.github/workflows/ci-workflow.yml
+++ b/.github/workflows/ci-workflow.yml
@@ -51,7 +51,7 @@ concurrency:
cancel-in-progress: true
jobs:
- ubuntu-build:
+ ubuntu-build-en:
timeout-minutes: 120
runs-on: ubuntu-latest
name: Ubuntu Zulu JDK 17 EN
@@ -88,12 +88,17 @@ jobs:
java-version: '17'
- name: Maven Build
env:
- MAVEN_OPTS: >-
- ${{ env.DEFAULT_MAVEN_OPTS }}
+ NIFI_CI_LOCALE: >-
+ -Duser.language=en
+ -Duser.country=AU
+ SUREFIRE_OPTS: >-
-Duser.language=en
-Duser.country=AU
-Duser.region=AU
-Duser.timezone=Australia/Melbourne
+ MAVEN_OPTS: >-
+ ${{ env.DEFAULT_MAVEN_OPTS }}
+ -DargLine=${env.SUREFIRE_OPTS}
run: >
${{ env.MAVEN_COMMAND }}
${{ env.MAVEN_PROFILES }}
@@ -110,10 +115,10 @@ jobs:
- name: Post Disk Usage
run: df
- ubuntu-build-en:
+ ubuntu-build-hi:
timeout-minutes: 120
runs-on: ubuntu-latest
- name: Ubuntu Zulu JDK 11 EN
+ name: Ubuntu Zulu JDK 11 HI
steps:
- name: System Information
run: |
@@ -147,12 +152,17 @@ jobs:
java-version: '11'
- name: Maven Build
env:
+ NIFI_CI_LOCALE: >-
+ -Duser.language=hi
+ -Duser.country=IN
+ SUREFIRE_OPTS: >-
+ -Duser.language=hi
+ -Duser.country=IN
+ -Duser.region=IN
+ -Duser.timezone=Asia/Kolkata
MAVEN_OPTS: >-
${{ env.DEFAULT_MAVEN_OPTS }}
- -Duser.language=en
- -Duser.country=AU
- -Duser.region=AU
- -Duser.timezone=Australia/Melbourne
+ -DargLine=${env.SUREFIRE_OPTS}
run: >
${{ env.MAVEN_COMMAND }}
${{ env.MAVEN_PROFILES }}
@@ -206,12 +216,17 @@ jobs:
java-version: '8'
- name: Maven Build
env:
- MAVEN_OPTS: >-
- ${{ env.DEFAULT_MAVEN_OPTS }}
+ NIFI_CI_LOCALE: >-
+ -Duser.language=ja
+ -Duser.country=JP
+ SUREFIRE_OPTS: >-
-Duser.language=ja
-Duser.country=JP
-Duser.region=JP
-Duser.timezone=Asia/Tokyo
+ MAVEN_OPTS: >-
+ ${{ env.DEFAULT_MAVEN_OPTS }}
+ -DargLine=${env.SUREFIRE_OPTS}
run: >-
${{ env.MAVEN_COMMAND }}
${{ env.MAVEN_PROFILES }}
@@ -271,12 +286,17 @@ jobs:
java-version: '8'
- name: Maven Build
env:
- MAVEN_OPTS: >-
- ${{ env.DEFAULT_MAVEN_OPTS }}
+ NIFI_CI_LOCALE: >-
+ -Duser.language=fr
+ -Duser.country=FR
+ SUREFIRE_OPTS: >-
-Duser.language=fr
-Duser.country=FR
-Duser.region=FR
-Duser.timezone=Europe/Paris
+ MAVEN_OPTS: >-
+ ${{ env.DEFAULT_MAVEN_OPTS }}
+ -DargLine=${env.SUREFIRE_OPTS}
run: >-
${{ env.MAVEN_COMMAND }}
${{ env.MAVEN_PROJECTS }}
diff --git a/nifi-commons/nifi-build/pom.xml b/nifi-commons/nifi-build/pom.xml
new file mode 100644
index 0000000000..3574a5da4c
--- /dev/null
+++ b/nifi-commons/nifi-build/pom.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-commons</artifactId>
+ <version>1.17.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>nifi-build</artifactId>
+</project>
diff --git
a/nifi-commons/nifi-build/src/test/java/org/apache/nifi/build/VerifyBuildLocaleTest.java
b/nifi-commons/nifi-build/src/test/java/org/apache/nifi/build/VerifyBuildLocaleTest.java
new file mode 100644
index 0000000000..73ad264a44
--- /dev/null
+++
b/nifi-commons/nifi-build/src/test/java/org/apache/nifi/build/VerifyBuildLocaleTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.nifi.build;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+import org.junit.platform.commons.util.StringUtils;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class VerifyBuildLocaleTest {
+
+ /**
+ * Verify that the intended system locale is active for the surefire
invocation.
+ *
+ * NiFi Surefire invocations may be executed in the context of a
particular locale, in order to verify the locale
+ * independence of the code base.
+ *
+ * If "NIFI_CI_LOCALE" is defined, then it must specify each system
property enumerated in this test case.
+ */
+ @Test
+ @EnabledIfEnvironmentVariable(named = "NIFI_CI_LOCALE", matches = ".+",
+ disabledReason = "NiFi CI build sets this environment variable; it
will not normally be set")
+ public void testEnvironmentLocaleMatchesSystemProperties() {
+ final String ciLocale = System.getenv("NIFI_CI_LOCALE");
+ // if the flag variable is set, verify the system locale of the
surefire process against NIFI_CI_LOCALE
+ final String[] systemPropertyKeys = {
+ "user.language",
+ "user.country",
+ };
+ for (String key : systemPropertyKeys) {
+ assertTrue(ciLocale.contains(key));
+ final String value = System.getProperty(key);
+ final String message = String.format(
+ "system property - CI_LOCALE:[%s] ACTUAL:[%s=%s]",
ciLocale, key, value);
+ assertTrue(StringUtils.isNotBlank(value), message);
+ final String expected = String.format("%s=%s", key, value);
+ assertTrue(ciLocale.contains(expected), message);
+ }
+ }
+}
diff --git a/nifi-commons/pom.xml b/nifi-commons/pom.xml
index 0dd5c2b239..0c435cd2fc 100644
--- a/nifi-commons/pom.xml
+++ b/nifi-commons/pom.xml
@@ -24,6 +24,7 @@
<packaging>pom</packaging>
<modules>
<module>nifi-bootstrap-utils</module>
+ <module>nifi-build</module>
<module>nifi-data-provenance-utils</module>
<module>nifi-expression-language</module>
<module>nifi-external-resource-utils</module>
diff --git a/pom.xml b/pom.xml
index ad6c37f439..41cc9c478d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -657,12 +657,6 @@
<exclude>**/*ITSpec.class</exclude>
</excludes>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
- <argLine combine.children="append">-Xmx1g
- -Djava.net.preferIPv4Stack=true
- -Duser.language=${user.language}
- -Duser.country=${user.country}
- -Duser.timezone=${user.timezone}
- -Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
<plugin>