Skip to content

Commit f4ec030

Browse files
Merge pull request #3 from dschwartznyc/cdm-deployment
Merge CDM deployment changes
2 parents cfcfb2b + a57fda0 commit f4ec030

File tree

6 files changed

+70
-20
lines changed

6 files changed

+70
-20
lines changed

.github/workflows/build-and-tag-release-rosetta-bundle.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Build and Tag with Rosetta Bundle Version
22

33
on:
44
workflow_dispatch:
5-
# Optionally, you can trigger on push to main or other events
65

76
jobs:
87
build:
@@ -35,24 +34,17 @@ jobs:
3534
run: |
3635
curl -L -o cdm-pom.xml https://raw.githubusercontent.com/finos/common-domain-model/main/pom.xml
3736
38-
- name: Extract rosetta.bundle.version from external POM
37+
- name: Extract rosetta.bundle.version from external POM using Maven
3938
id: extract_version
4039
run: |
41-
# Try to extract from <properties> first, fallback to profile if needed
42-
version=$(xmllint --xpath "string(//properties/rosetta.bundle.version)" cdm-pom.xml)
43-
if [ -z "$version" ]; then
44-
version=$(xmllint --xpath "string(//profile/properties/rosetta.bundle.version)" cdm-pom.xml)
45-
fi
40+
version=$(mvn -f cdm-pom.xml help:evaluate -Dexpression=rosetta.bundle.version -q -DforceStdout)
4641
echo "rosetta.bundle.version=$version"
4742
echo "version=$version" >> $GITHUB_OUTPUT
4843
49-
- name: Override rosetta.bundle.version in local pom.xml
44+
- name: Update all rosetta.bundle.version properties in local pom.xml using Maven
5045
run: |
5146
version="${{ steps.extract_version.outputs.version }}"
52-
# Replace in <properties>
53-
sed -i "s|<rosetta.bundle.version>.*</rosetta.bundle.version>|<rosetta.bundle.version>${version}</rosetta.bundle.version>|" pom.xml
54-
# Replace in <profile> (if present)
55-
sed -i "s|<rosetta.bundle.version>.*</rosetta.bundle.version>|<rosetta.bundle.version>${version}</rosetta.bundle.version>|" pom.xml
47+
mvn versions:set-property -Dproperty=rosetta.bundle.version -DnewVersion=$version -DprocessAllModules=true
5648
5749
- name: Set POM version to rosetta.bundle.version
5850
run: |
@@ -63,8 +55,8 @@ jobs:
6355
- name: Build with Maven
6456
run: mvn -B package
6557

66-
- name: Revert POM changes
67-
run: git checkout -- pom.xml
58+
- name: Revert POM property changes
59+
run: mvn versions:revert
6860

6961
- name: Upload JAR files
7062
uses: actions/upload-artifact@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ __pycache__
5757
**/test/serialization_tests/rune-common
5858
**/build/common-domain-model
5959
**/build/resources/serialization
60+
src/generated/

CDM-Build-Integration.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## Feature Request - CDM Python Generator Integration
2+
3+
### Description of Problem:
4+
With the Python generator now a standalone component, its integration with the CDM build needs to be updated. This presents two main challenges:
5+
6+
1. **Consistency with CDM's Rosetta Bundle Version:**
7+
To keep CDM in sync with all elements of the Rune DSL infrastructure (rosetta-common, rosetta-testing, rosetta-code-generators, rosetta-ingest), the CDM build specifies which version to use. Previously, the Python generator was kept in sync as part of the rosetta-code-generators repository, with updates whenever there was an update to the version in that repository. While the generated Python code does not directly depend on the Rune bundle, coordinating updates across all elements of the Rune infrastructure helps prevent inconsistencies in enterprise production enviroments — especially if a bundle update addresses a defect or changes behavior in a way that impacts the generators.
8+
9+
2. **Invocation of the standalone Python generator**:
10+
The CDM build now needs to explicitly invoke the unbundled Python generator.
11+
12+
---
13+
### Potential Solutions:
14+
15+
Below are both a target state and interim steps to enable integration before the target state is fully realized.
16+
17+
### Target state:
18+
19+
#### Assumptions:
20+
- The generator includes an executable Main class that accepts a Rune source and a target folder for the generated Python.
21+
- The Rune Python Runtime is available via PyPI.
22+
23+
#### Process:
24+
1. An update to the Rosetta Bundle Version triggers a rebuild of the generator. If successful, a release tagged with the bundle version is generated.
25+
- Question: What is a viable source for the trigger? Rosetta-Common?
26+
- Question: Is the generator uploaded to a central Maven repository or is it solely an artifact of the generator repository.
27+
2. The CDM build sources a generator version that matches its Rosetta Bundle Version. The sequence is:
28+
29+
1. Source the generator
30+
2. If found:
31+
1. Generate Python by invoking the new Main class using the source CDM Rune files.
32+
2. Package the resultung Python.
33+
3. Upload the package to PyPI.
34+
35+
Question: Should the package also be made available as a Maven artifact?
36+
3. If not found: fail gracefully generating notice of the error.
37+
38+
### Interim state:
39+
40+
#### Assumptions:
41+
- The generator is invoked using the current mechanism.
42+
- Python artifacts are distributed via the CDM Maven Repository.
43+
44+
1. A scheduled action rebuilds the generator if the Rosetta Bundle Version used in CDM does not match any of tagged versions. If successful, a release tagged with the bundle version is generated and stored as a repo artifact.
45+
46+
_Note: The downside of this approach is that there will be CDM builds that will not find a matching generator._
47+
48+
2. The CDM build sources a generator that matches its Rosetta Bundle Version by querying the generator repo. The sequence is:
49+
1. Source the generator
50+
2. If found:
51+
1. Generate Python by executing:
52+
```sh
53+
mvn clean install -DskipTests -P python
54+
```
55+
2. Package the Python.
56+
3. Upload the package to the Maven repository.
57+
3. If not found: fail gracefully generating notice of the error.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
191191
<maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
192192
<!-- Used by the Python generator -->
193-
<cdm.rosetta.source.path>/Users/dls/projects/cdm/common-domain-model/trade-header/common-domain-model/rosetta-source/src/main/rosetta</cdm.rosetta.source.path>
193+
<cdm.rosetta.source.path>[path to rosetta files]</cdm.rosetta.source.path>
194194
<cdm.python.output.path>target/python-cdm</cdm.python.output.path>
195195
<unittest.rosetta.source.path>test/python_unit_tests/rosetta</unittest.rosetta.source.path>
196196
<unittest.python.output.path>target/python-tests/unit_tests</unittest.python.output.path>

src/test/java/com/regnosys/rosetta/generator/python/PythonFilesGeneratorTest.xtend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PythonFilesGeneratorTest {
3737
/*
3838
* generate CDM from Rosetta files. Should be disabled for releases
3939
*/
40-
// @Disabled
40+
@Disabled
4141
@Test
4242
def void generateCDMPythonFromRosetta() {
4343
try {

test/python_unit_tests/rosetta/BinaryOp.rosetta

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace rosetta_dsl.test.semantic.binary_op : <"generate Python unit tests from Rosetta.">
22

3-
type EqualsTest: <" Test equals operation condition">
3+
type EqualsTest: <"Test equals operation condition">
44
aValue int (1..1)
55
target int (1..1)
66
condition TestCond: <"Test condition">
@@ -9,7 +9,7 @@ type EqualsTest: <" Test equals operation condition">
99
else
1010
False
1111

12-
type NotEqualsTest: <" Test not equals operation condition">
12+
type NotEqualsTest: <"Test not equals operation condition">
1313
aValue int (1..1)
1414
target int (1..1)
1515
condition TestCond: <"Test condition">
@@ -18,7 +18,7 @@ type NotEqualsTest: <" Test not equals operation condition">
1818
else
1919
False
2020

21-
type ContainsTest: <" Test contains operation condition">
21+
type ContainsTest: <"Test contains operation condition">
2222
aValue string (1..*)
2323
target string (1..1)
2424
condition TestCond: <"Test condition">
@@ -27,7 +27,7 @@ type ContainsTest: <" Test contains operation condition">
2727
else
2828
False
2929

30-
type DisjointTest: <" Test disjoint operation condition">
30+
type DisjointTest: <"Test disjoint operation condition">
3131
aValue string (1..*)
3232
target string (1..*)
3333
condition TestCond: <"Test condition">

0 commit comments

Comments
 (0)