0

In kubernetes environment I placed all liquibase changelog files in ConfigMap which than referenced to volumeMount as follows:

...
          volumeMounts:
            - name: my-vol
              mountPath: /liquibase
...
      volumes:
        - name: my-vol
          configMap:
            name: my-cm

I defined main-changelog.xml with liquibase variable on start and get following error:

Unexpected error running Liquibase: Error Reading Changelog File: Found 2 files that match /liquibase/main-changelog.xml: file:/liquibase/..2023_06_19_03_58_35.3720542680/main-changelog.xml, file:/liquibase/main-changelog.xml

In filesystem of kubernetes pods it looks as follows:

drwxr-xr-x 1 root root 4096 Jun 19 08:16 ..
drwxrwxrwx 3 root root 4096 Jun 19 08:16 .
drwxr-xr-x 2 root root 4096 Jun 19 08:16 ..2023_06_19_08_16_53.3878877458
lrwxrwxrwx 1 root root   32 Jun 19 08:16 ..data -> ..2023_06_19_08_16_53.3878877458
lrwxrwxrwx 1 root root   32 Jun 19 08:16 main-changelog.xml -> ..data/main-changelog.xml

As it can be seen kubernetes creates internally a symlink of files and references with ConfigMap, which I assume liquibase has the problem with. Is there any suggestions to fix this problem?

m19v
  • 1,800
  • 4
  • 11
  • 26
  • I can not use this https://stackoverflow.com/a/50687707/12501050 workaround in kubernetes context as i have many liquibase changelogs and defining all files is very bad option. – m19v Jun 19 '23 at 09:06
  • Can you check the below github information that can be useful to you. https://github.com/liquibase/liquibase/issues/2818#issuecomment-1167873963 – Kiran Kotturi Jun 19 '23 at 11:56
  • 1
    As per the mentioned link https://github.com/liquibase/liquibase/issues/2104 "if a path matches multiple files in the search-path, we fail with an error". The fix for that is to update your searchpath to not include duplicate files, or to use the liquibase.duplicateFileMode setting. – Kiran Kotturi Jun 20 '23 at 04:46
  • Let me know if the provided information was helpful. I am happy to assist you in case of any queries. – Kiran Kotturi Jun 22 '23 at 09:00
  • I used e.g. ```--duplicate-file-mode=WARN``` and getting the following error ```Unexpected argument(s): "--duplicate-file-mode=WARN". For detailed help, try 'liquibase --help' or 'liquibase --help'``` – m19v Jun 22 '23 at 09:16
  • P.S. I use the ```Liquibase Version: 4.9.1``` – m19v Jun 22 '23 at 10:09

0 Answers0