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

[incubator-kie-issues-1401] Fix build kogito-examples.build-and-test in kogito nightly.native folder #1987

Merged
Merged
Show file tree
Hide file tree
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
19 changes: 16 additions & 3 deletions .ci/jenkins/Jenkinsfile.setup-branch
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,21 @@ pipeline {
steps {
script {
dir(getRepoName()) {
def oldKogitoVersion = readMavenPom(file: 'pom.xml').version
def pom = readMavenPom(file: 'pom.xml');
def oldKogitoVersion = pom.version
if (oldKogitoVersion == null) {
echo "pom version is null. Using parent pom version"
oldKogitoVersion = pom.parent.version
}
Comment on lines +96 to +101
Copy link
Contributor Author

@tkobayas tkobayas Jul 30, 2024

Choose a reason for hiding this comment

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

I noticed that oldKogitoVersion was null in past logs because readMavenPom cannot resolve the parent version (I cannot find a reason from logs). But locally confirmed that pom.parent.version returns the expected version.

echo "Got old Kogito version ${oldKogitoVersion}"
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
// special case for serverless-workflow-examples-parent
maven.mvnVersionsSet(
getMavenCommand('serverless-workflow-examples/serverless-workflow-examples-parent').withSettingsXmlFile(MAVEN_SETTINGS_FILE),
getKogitoVersion(),
true,
false
)
Comment on lines +104 to +110
Copy link
Contributor Author

@tkobayas tkobayas Jul 30, 2024

Choose a reason for hiding this comment

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

serverless-workflow-examples project versions were not updated by mvnVersionsUpdateParentAndChildModules, because serverless-workflow-examples-parent itself was not updated. So I explicitly call mvnVersionsSet. The project directory is hard-coded, but I couldn't find another approach. Let me know if there is a better way.

maven.mvnVersionsUpdateParentAndChildModules(
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
getKogitoVersion(),
Expand All @@ -119,9 +131,10 @@ pipeline {
}

if (getKogitoVersion() != oldKogitoVersion) {
def status = sh(script: "grep -ir '${oldKogitoVersion}' --include='pom.xml'", returnStatus: true)
def status = sh(script: "grep -ir '>${oldKogitoVersion}<' --include='pom.xml'", returnStatus: true)
Comment on lines -122 to +134
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously 10.0.999-SNAPSHOT may match when oldKogitoVersion is 999-SNAPSHOT. Added > < for precision.

if (status == 0) {
error "Old Kogito version ${oldKogitoVersion} is still present into the project... Please review it..."
// some orphaned projects may still have the old version. not an error
echo "Old Kogito version ${oldKogitoVersion} is still present into the project... Please review it..."
Comment on lines -124 to +137
Copy link
Contributor Author

@tkobayas tkobayas Jul 30, 2024

Choose a reason for hiding this comment

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

we may still have old versions because some projects are orphaned (not associated by <modules>), so mvn setVersion doesn't affect. It's not an error.

15:31:22  + grep -ir '>999-SNAPSHOT<' --include=pom.xml
15:31:22  kogito-quarkus-examples/dmn-tracing-quarkus/pom.xml:    <kogito.bom.version>999-SNAPSHOT</kogito.bom.version>
15:31:22  kogito-quarkus-examples/dmn-tracing-quarkus/pom.xml:    <version.org.kie.kogito>999-SNAPSHOT</version.org.kie.kogito>
15:31:22  kogito-quarkus-examples/trusty-tracing-quarkus-devservices/pom.xml:    <kogito.bom.version>999-SNAPSHOT</kogito.bom.version>
15:31:22  kogito-quarkus-examples/trusty-tracing-quarkus-devservices/pom.xml:    <version.org.kie.kogito>999-SNAPSHOT</version.org.kie.kogito>
15:31:22  serverless-workflow-examples/serverless-workflow-github-showcase/pom.xml:    <version>999-SNAPSHOT</version>
15:31:22  serverless-workflow-examples/serverless-workflow-openvino-quarkus/pom.xml:    <kogito.bom.version>999-SNAPSHOT</kogito.bom.version>
15:31:22  serverless-workflow-examples/serverless-workflow-subflows-event/pom.xml:    <version>999-SNAPSHOT</version>
15:31:22  serverless-workflow-examples/serverless-workflow-subflows-event/pom.xml:        <kogito.bom.version>999-SNAPSHOT</kogito.bom.version>
15:31:22  serverless-workflow-examples/serverless-workflow-subflows-event/pom.xml:        <version.org.kie.kogito>999-SNAPSHOT</version.org.kie.kogito>

Btw, previously, oldKogitoVersion was null, so it didn't hit the error.

}
}
}
Expand Down
2 changes: 0 additions & 2 deletions kogito-quarkus-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
<module>dmn-quarkus-example</module>
<module>dmn-resource-jar-quarkus-example</module>
<module>dmn-multiple-models-quarkus-example</module>
<module>dmn-tracing-quarkus</module>
<module>flexible-process-quarkus</module>
<module>kogito-travel-agency</module>
<module>onboarding-example</module>
Expand Down Expand Up @@ -174,7 +173,6 @@
</property>
</activation>
<modules>
<module>trusty-tracing-quarkus-devservices</module>
</modules>
</profile>

Expand Down
Loading