cosmere icon indicating copy to clipboard operation
cosmere copied to clipboard

Option to compare the current document with document rendered in Confluence

Open hudrid opened this issue 10 months ago • 6 comments

Hello! If possible, please implement a setting in cosmere.json to be able to compare the current document with a document already rendered in Confluence. And if both documents are the same, then stop rendering for the current document.

hudrid avatar Apr 16 '24 09:04 hudrid

Hey there, can you explain your use case a bit more to understand this? If I'm understanding you correctly, than this is kind of already possible by just looking at the cached files.

mihaeu avatar Apr 16 '24 17:04 mihaeu

Thanks for the quick response! Our company has a monorepository, where documents (our documents are full of tables and different styles) are collected via pipeline from different repositories. Then the documents are published on our website and in Confluence. We have implemented a check that identical documents should not be published, but the publication of documents in Confluence is always performed, regardless of whether the documents are identical or not. Thus, the last date of changes is different for the document on the site and the document in Confluence.

an example of a document that will always be published
# AdminGuide

### **Document card**

<table>
<tr>
<td> <div style="width:200px"> <b> Doc version </b></div> </td>
<td> <div style="width:300px"> 1.0 </div> </td>
</tr>
<tr>
<td> <b> Date: </b> </td>
<td> 16.08.2028 </td>
</tr>
<tr>
<td> <b> Version </b> </td>
<td> 2.0 </td>
</tr>
<tr>
<td> <b> Document type </b> </td>
<td> AdminGuide </td>
</tr>
<tr>
<td> <b> Customer </b> </td>
<td> Cust </td>
</tr>
<tr>
<td> <b> Document Status </b> </td>
<td> <span style="background-color: #DEEBFF; color: #0747A6"> <b> Validation </b> </span></td>
</tr>
</table>

hudrid avatar Apr 16 '24 20:04 hudrid

Are you using and persisting the cache in your pipelines?

El mar, 16 abr 2024 22:31, hudrid @.***> escribió:

Thanks for the quick response! Our company has a monorepository, where documents (our documents are full of tables and different styles) are collected via pipeline from different repositories. Then the documents are published on our website and in Confluence. We have implemented a check that identical documents should not be published, but the publication of documents in Confluence is always performed, regardless of whether the documents are identical or not. Thus, the last date of changes is different for the document on the site and the document in Confluence.

— Reply to this email directly, view it on GitHub https://github.com/mihaeu/cosmere/issues/47#issuecomment-2059875020, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQRO7M5Z3ZEIB7CQ2XIXJDY5WDCNAVCNFSM6AAAAABGI6GTQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJZHA3TKMBSGA . You are receiving this because you commented.Message ID: @.***>

mihaeu avatar Apr 17 '24 05:04 mihaeu

The cache is not used.

What value should be specified for the paths parameter in pipeline? Maybe:

paths:
      - node_modules/

Сan you provide an example?

hudrid avatar Apr 17 '24 10:04 hudrid

This looks like GitLab pipelines if I'm not mistaken. The default cache path is build unless you specified another one in your comere.json configuration. If you add the cache to the cache layer/artifact of your build step/action cosmere will check the cache before doing anything and if things match, won't do any work on Confluence.

paths:
      - node_modules/
      - build/

In case you are using GitLab pipelines make sure to consider which steps write and read from and to your cache. E.g. an npm install step should write to the cache, all other steps should only read from that folder. The step in which cosmere converts and publishes the information has to both read and write,

mihaeu avatar Apr 17 '24 14:04 mihaeu

gitlab-ci.yml:
confluence:
  image: ...
  stage: publish
  tags:
    - pages
  cache:
    paths:
      - node_modules/
      - build/
  before_script:
    - rm -rf $DOCS_DIR
    - cp -R $CI_PROJECT_DIR/release/ $DOCS_DIR
    - ls -la $DOCS_DIR
  script:
    - npm install
    #- npm run lint
    - npm run publish
  artifacts:
    paths:
      - build
  only:
    - master
  needs:
    - job: collect_docs
      artifacts: true

Works only for documents without pictures.

Job Information

image

hudrid avatar Apr 18 '24 12:04 hudrid