WoozyMasta / archimate-ci-image

Archi container image for use in continuous integration pipelines
https://woozymasta.github.io/archimate-ci-image-example/?view=6213
MIT License
40 stars 23 forks source link

Generation fails with specializations #7

Closed Damounet closed 1 year ago

Damounet commented 1 year ago

Hello,

I have been using this image since the beginning of the year with success but I stumbled on an error since I started to work with Specialization yesterday.

I am using archi 4.9.2 build 202201131438 with a build on a gitlab ci pipeline.

Here is the gitlab-ci file (taken from your doc)

pages:
  stage: build
  image:
    name: woozymasta/archimate-ci-image:4.9.2-1.0.3
    entrypoint: [""]

  script:
    - /opt/Archi/entrypoint.sh

  variables:
    ARCHI_PROJECT_PATH: $CI_PROJECT_DIR
    ARCHI_HTML_REPORT_ENABLED: "true"
    ARCHI_JASPER_REPORT_ENABLED: "true"
    ARCHI_JASPER_REPORT_FORMATS: "PDF,DOCX"
    ARCHI_CSV_REPORT_ENABLED: "false"
    ARCHI_EXPORT_MODEL_ENABLED: "true"

  artifacts:
    name: "$CI_JOB_NAME from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
    expire_in: 30d
    paths:
      - public

This is the result of my build:

Running with gitlab-runner 14.8.2 (c6e7e194)
  on group_tma_runner1 siL-o4mT
Resolving secrets
00:00
Preparing the "docker" executor
00:[2](https://xxx/archi/archimate/-/jobs/194581#L2)5
Using Docker executor with image woozymasta/archimate-ci-image:4.9.2-1.0.[3](https://xxx/archi/archimate/-/jobs/194581#L3) ...
Pulling docker image woozymasta/archimate-ci-image:4.9.2-1.0.3 ...
Using docker image sha2[5](https://xxx/archi/archimate/-/jobs/194581#L5)[6](https://xxx/archi/archimate/-/jobs/194581#L6):5[7](https://xxx/archi/archimate/-/jobs/194581#L7)06da2[8](https://xxx/archi/archimate/-/jobs/194581#L8)994eec7f11284dac7afb6796515102c9aa93d59ea546a49478cdf53e for woozymasta/archimate-ci-image:4.9.2-1.0.3 with digest woozymasta/archimate-ci-image@sha256:9a7013c5f1843362d25d13324ad8f9fb781e754a8a9520bb671c47b257474a21 ...
Preparing environment
00:03
Running on runner-sil-o4mt-project-549-concurrent-0 via frahqapp715...
Getting source from Git repository
00:03
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/xxx/archi/archimate/.git/
Created fresh repository.
Checking out b87a0d35 as master...
Skipping Git submodules setup
Executing "step_script" stage of the job script
Using docker image sha256:5706da28994eec7f11284dac7afb6796515102c9aa93d59ea546a49478cdf53e for woozymasta/archimate-ci-image:4.9.2-1.0.3 with digest woozymasta/archimate-ci-image@sha256:9a7013c5f1843362d25d13324ad8f9fb781e754a8a9520bb671c47b257474a21 ...
$ /opt/Archi/entrypoint.sh
Run Archi report generation in GitLab CI
Render ArchiMate report
01:07
[LoadModelFromRepositoryProvider] Loading model at /builds/xxx/archi/archimate
[LoadModelFromRepositoryProvider] Loaded model: 'TDNG - Architecture'
[Jasper Reports] Creating Jasper Reports from 'TDNG - Architecture' to /builds/xxx/archi/archimate/public
[Jasper Reports] Generating Image for View 1 of 72
[Jasper Reports] Generating Image for View 2 of 72
[Jasper Reports] Generating Image for View 3 of 72
[Jasper Reports] Generating Image for View 4 of 72
[Jasper Reports] Generating Image for View 5 of 72
[Jasper Reports] Generating Image for View 6 of 72
[Jasper Reports] Generating Image for View 7 of 72
[Jasper Reports] Generating Image for View 8 of 72
[Jasper Reports] Generating Image for View 9 of 72
[Jasper Reports] Generating Image for View [10](https://xxx/archi/archimate/-/jobs/194581#L10) of 72
[Jasper Reports] Generating Image for View [11](https://xxx/archi/archimate/-/jobs/194581#L11) of 72
[Jasper Reports] Generating Image for View 12 of 72
[Jasper Reports] Generating Image for View [13](https://xxx/archi/archimate/-/jobs/194581#L13) of 72
[Jasper Reports] Generating Image for View [14](https://xxx/archi/archimate/-/jobs/194581#L14) of 72
[Jasper Reports] Generating Image for View [15](https://xxx/archi/archimate/-/jobs/194581#L15) of 72
[Jasper Reports] Generating Image for View [16](https://xxx/archi/archimate/-/jobs/194581#L16) of 72
[Jasper Reports] Generating Image for View [17](https://xxx/archi/archimate/-/jobs/194581#L17) of 72
[Jasper Reports] Generating Image for View [18](https://xxx/archi/archimate/-/jobs/194581#L18) of 72
[Jasper Reports] Generating Image for View 19 of 72
[Jasper Reports] Generating Image for View [20](https://xxx/archi/archimate/-/jobs/194581#L20) of 72
[Jasper Reports] Generating Image for View [21](https://xxx/archi/archimate/-/jobs/194581#L21) of 72
[Jasper Reports] Generating Image for View [22](https://xxx/archi/archimate/-/jobs/194581#L22) of 72
[Jasper Reports] Generating Image for View [23](https://xxx/archi/archimate/-/jobs/194581#L23) of 72
[Jasper Reports] Generating Image for View [24](https://xxx/archi/archimate/-/jobs/194581#L24) of 72
[Jasper Reports] Generating Image for View [25](https://xxx/archi/archimate/-/jobs/194581#L25) of 72
[Jasper Reports] Generating Image for View [26](https://xxx/archi/archimate/-/jobs/194581#L26) of 72
[Jasper Reports] Generating Image for View [27](https://xxx/archi/archimate/-/jobs/194581#L27) of 72
[Jasper Reports] Generating Image for View [28](https://xxx/archi/archimate/-/jobs/194581#L28) of 72
[Jasper Reports] Generating Image for View [29](https://xxx/archi/archimate/-/jobs/194581#L29) of 72
[Jasper Reports] Generating Image for View [30](https://xxx/archi/archimate/-/jobs/194581#L30) of 72
[Jasper Reports] Generating Image for View [31](https://xxx/archi/archimate/-/jobs/194581#L31) of 72
[Jasper Reports] Generating Image for View [32](https://xxx/archi/archimate/-/jobs/194581#L32) of 72
[Jasper Reports] Generating Image for View [33](https://xxx/archi/archimate/-/jobs/194581#L33) of 72
[Jasper Reports] Generating Image for View [34](https://xxx/archi/archimate/-/jobs/194581#L34) of 72
[Jasper Reports] Generating Image for View [35](https://xxx/archi/archimate/-/jobs/194581#L35) of 72
[Jasper Reports] Generating Image for View [36](https://xxx/archi/archimate/-/jobs/194581#L36) of 72
[Jasper Reports] Generating Image for View [37](https://xxx/archi/archimate/-/jobs/194581#L37) of 72
[Jasper Reports] Generating Image for View [38](https://xxx/archi/archimate/-/jobs/194581#L38) of 72
[Jasper Reports] Generating Image for View [39](https://xxx/archi/archimate/-/jobs/194581#L39) of 72
[Jasper Reports] Generating Image for View [40](https://xxx/archi/archimate/-/jobs/194581#L40) of 72
[Jasper Reports] Generating Image for View [41](https://xxx/archi/archimate/-/jobs/194581#L41) of 72
[Jasper Reports] Generating Image for View [42](https://xxx/archi/archimate/-/jobs/194581#L42) of 72
[Jasper Reports] Generating Image for View [43](https://xxx/archi/archimate/-/jobs/194581#L43) of 72
[Jasper Reports] Generating Image for View [44](https://xxx/archi/archimate/-/jobs/194581#L44) of 72
[Jasper Reports] Generating Image for View [45](https://xxx/archi/archimate/-/jobs/194581#L45) of 72
[Jasper Reports] Generating Image for View [46](https://xxx/archi/archimate/-/jobs/194581#L46) of 72
[Jasper Reports] Generating Image for View [47](https://xxx/archi/archimate/-/jobs/194581#L47) of 72
[Jasper Reports] Generating Image for View [48](https://xxx/archi/archimate/-/jobs/194581#L48) of 72
[Jasper Reports] Generating Image for View [49](https://xxx/archi/archimate/-/jobs/194581#L49) of 72
[Jasper Reports] Generating Image for View [50](https://xxx/archi/archimate/-/jobs/194581#L50) of 72
[Jasper Reports] Generating Image for View [51](https://xxx/archi/archimate/-/jobs/194581#L51) of 72
[Jasper Reports] Generating Image for View [52](https://xxx/archi/archimate/-/jobs/194581#L52) of 72
[Jasper Reports] Generating Image for View [53](https://xxx/archi/archimate/-/jobs/194581#L53) of 72
[Jasper Reports] Generating Image for View [54](https://xxx/archi/archimate/-/jobs/194581#L54) of 72
[Jasper Reports] Generating Image for View [55](https://xxx/archi/archimate/-/jobs/194581#L55) of 72
[Jasper Reports] Generating Image for View [56](https://xxx/archi/archimate/-/jobs/194581#L56) of 72
[Jasper Reports] Generating Image for View [57](https://xxx/archi/archimate/-/jobs/194581#L57) of 72
[Jasper Reports] Generating Image for View [58](https://xxx/archi/archimate/-/jobs/194581#L58) of 72
[Jasper Reports] Generating Image for View [59](https://xxx/archi/archimate/-/jobs/194581#L59) of 72
[Jasper Reports] Generating Image for View [60](https://xxx/archi/archimate/-/jobs/194581#L60) of 72
[Jasper Reports] Generating Image for View [61](https://xxx/archi/archimate/-/jobs/194581#L61) of 72
[Jasper Reports] Generating Image for View [62](https://xxx/archi/archimate/-/jobs/194581#L62) of 72
[Jasper Reports] Generating Image for View [63](https://xxx/archi/archimate/-/jobs/194581#L63) of 72
[Jasper Reports] Generating Image for View [64](https://xxx/archi/archimate/-/jobs/194581#L64) of 72
[Jasper Reports] Generating Image for View [65](https://xxx/archi/archimate/-/jobs/194581#L65) of 72
[Jasper Reports] Generating Image for View [66](https://xxx/archi/archimate/-/jobs/194581#L66) of 72
[Jasper Reports] Generating Image for View [67](https://xxx/archi/archimate/-/jobs/194581#L67) of 72
[Jasper Reports] Generating Image for View [68](https://xxx/archi/archimate/-/jobs/194581#L68) of 72
[Jasper Reports] Generating Image for View [69](https://xxx/archi/archimate/-/jobs/194581#L69) of 72
[Jasper Reports] Generating Image for View [70](https://xxx/archi/archimate/-/jobs/194581#L70) of 72
[Jasper Reports] Generating Image for View [71](https://xxx/archi/archimate/-/jobs/194581#L71) of [72](https://xxx/archi/archimate/-/jobs/194581#L72)
[Jasper Reports] Generating Image for View 72 of 72
[Jasper Reports] Creating Jasper Print...
[Jasper Reports] Compiling...
[Jasper Reports] Filling...
[Jasper Reports] Generating PDF...
[Jasper Reports] Generating DOCX...
[Jasper Reports] Cleaning up...
[Jasper Reports] Reports Created!
[HTMLReport] Creating report from 'TDNG - Architecture' to /builds/xxx/archi/archimate/public
[HTMLReport] Copying files...
[HTMLReport] Copying hints...
[HTMLReport] Creating files...
[HTMLReport] Generating image for View 1 of 72
[HTMLReport] Generating image for View 2 of 72
[HTMLReport] Generating image for View 3 of 72
[HTMLReport] Generating image for View 4 of 72
[HTMLReport] Generating image for View 5 of 72
[HTMLReport] Generating image for View 6 of 72
[HTMLReport] Generating image for View 7 of 72
[HTMLReport] Generating image for View 8 of 72
[HTMLReport] Generating image for View 9 of 72
[HTMLReport] Generating image for View 10 of 72
[HTMLReport] Generating image for View 11 of 72
[HTMLReport] Generating image for View 12 of 72
[HTMLReport] Generating image for View 13 of 72
[HTMLReport] Generating image for View 14 of 72
[HTMLReport] Generating image for View 15 of 72
[HTMLReport] Generating image for View 16 of 72
[HTMLReport] Generating image for View 17 of 72
[HTMLReport] Generating image for View 18 of 72
[HTMLReport] Generating image for View 19 of 72
[HTMLReport] Generating image for View 20 of 72
[HTMLReport] Generating image for View 21 of 72
[HTMLReport] Generating image for View 22 of 72
[HTMLReport] Generating image for View 23 of 72
[HTMLReport] Generating image for View 24 of 72
[HTMLReport] Generating image for View 25 of 72
[HTMLReport] Generating image for View 26 of 72
[HTMLReport] Generating image for View 27 of 72
[HTMLReport] Generating image for View 28 of 72
[HTMLReport] Generating image for View 29 of 72
[HTMLReport] Generating image for View 30 of 72
[HTMLReport] Generating image for View 31 of 72
[HTMLReport] Generating image for View 32 of 72
[HTMLReport] Generating image for View 33 of 72
[HTMLReport] Generating image for View 34 of 72
[HTMLReport] Generating image for View 35 of 72
[HTMLReport] Generating image for View 36 of 72
[HTMLReport] Generating image for View 37 of 72
[HTMLReport] Generating image for View 38 of 72
[HTMLReport] Generating image for View 39 of 72
[HTMLReport] Generating image for View 40 of 72
[HTMLReport] Generating image for View 41 of 72
[HTMLReport] Generating image for View 42 of 72
[HTMLReport] Generating image for View 43 of 72
[HTMLReport] Generating image for View 44 of 72
[HTMLReport] Generating image for View 45 of 72
[HTMLReport] Generating image for View 46 of 72
[HTMLReport] Generating image for View 47 of 72
[HTMLReport] Generating image for View 48 of 72
[HTMLReport] Generating image for View 49 of 72
[HTMLReport] Generating image for View 50 of 72
[HTMLReport] Generating image for View 51 of 72
[HTMLReport] Generating image for View 52 of 72
[HTMLReport] Generating image for View 53 of 72
[HTMLReport] Generating image for View 54 of 72
[HTMLReport] Generating image for View 55 of 72
[HTMLReport] Generating image for View 56 of 72
[HTMLReport] Generating image for View 57 of 72
[HTMLReport] Generating image for View 58 of 72
[HTMLReport] Generating image for View 59 of 72
[HTMLReport] Generating image for View 60 of 72
[HTMLReport] Generating image for View 61 of 72
[HTMLReport] Generating image for View 62 of 72
[HTMLReport] Generating image for View 63 of 72
[HTMLReport] Generating image for View 64 of 72
[HTMLReport] Generating image for View 65 of 72
[HTMLReport] Generating image for View 66 of 72
[HTMLReport] Generating image for View 67 of 72
[HTMLReport] Generating image for View 68 of 72
[HTMLReport] Generating image for View 69 of 72
[HTMLReport] Generating image for View 70 of 72
[HTMLReport] Generating image for View 71 of 72
[HTMLReport] Generating image for View 72 of 72
[HTMLReport] Creating files...
[HTMLReport] Finalising...
context [/modelreport /expandFolder /_sub1 /expandFolder /_sub2 /classesFromProperties /_sub3] 1:25 no such template: /IGNORE_ERROR_
[HTMLReport] Report generated!
[Core] Saved model to '/builds/xxx/archi/archimate/public/XXX - Architecture
Green Check
Red Cross
Warning.archimate'
Done. Reports saved to /builds/xxx/archi/archimate/public
sed: -e expression #1, char 56: extra characters after command
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

What I find odd is that the name of the model seems to be named XXX - Architecture Green Check Red Cross Warning.archimate (the return to the lines included), altough it is really named XXX - Architecture.archimate and the 3 Green Check and so on are the name of the specialization I created.

And thus it seems to give an error later on a sed (this one it seems: https://github.com/WoozyMasta/archimate-ci-image/blob/master/entrypoint.sh#L122).

Any Help would be appreciated :)

On monday I'll try to remove my specializations to validate this comes from here if you need.

Damounet commented 1 year ago

I think I found the issue.

My model/folder.xml file looks like that :

<archimate:ArchimateModel
    xmlns:archimate="http://www.archimatetool.com/archimate"
    name="XXX - Architecture"
    id="id-ffb32890d4aa4878b41d5c1008e6e7ac"
    purpose="blablabla
    version="4.9.0">
  <profiles
      name="Green Check"
      id="id-6e7c7ca4b1ff4524abcb283baae6147e"
      imagePath="images/_URqlEDUGEe2dvvIRZDxT8g.png"
      conceptType="Goal"/>
  <profiles
      name="Red Cross"
      id="id-6462ae50b65e4fdd96e2a5560373f25e"
      imagePath="images/_xIat8DUGEe2dvvIRZDxT8g.png"
      conceptType="Goal"/>
  <profiles
      name="Warning"
      id="id-56b807ae9b9c44a98e1403dc4870c602"
      imagePath="images/_kKPnUDUGEe2dvvIRZDxT8g.png"
      conceptType="Goal"/>
</archimate:ArchimateModel>

So when your script tries to retrieve the name of the archimate model here https://github.com/WoozyMasta/archimate-ci-image/blob/master/entrypoint.sh#L156 it greps all lines with the name attribute in it.

I propose to add yq to your image and replace the line 156 with this command :

yq -p=xml '.ArchimateModel.+name' ./model/folder.xml
XXX - Architecture

which gets the attribute name in the tag ArchimateModel of the folder.xml file.