From 6781ace3a107414da66e89108a4049df72e0d7bf Mon Sep 17 00:00:00 2001 From: aykut-bozkurt <51649454+aykut-bozkurt@users.noreply.github.com> Date: Fri, 2 Dec 2022 18:04:29 +0300 Subject: [PATCH] find core files from correct path on CI (#6535) Finds core files from correct path on CI. According to default core pattern on CI, core is generated at the location relative to binary is executed. It can be safe to set core pattern before running binary but to change a kernel param(in our case kernel.core_pattern), you need related privilege in docker container. Or you have to change it at image build. But, by default, on CI machines, kernel pattern contains a relative path to binary + pid + process name, so we do not need to set it explicitly for now. (Example core file name on CI machine: `core.2559.!usr!lib!postgresql!14!bin!postgres`) --- .circleci/config.yml | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e952b470..2cebd86ec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -167,8 +167,9 @@ jobs: name: 'Copy coredumps' command: | mkdir -p /tmp/core_dumps - if ls core.* 1> /dev/null 2>&1; then - cp core.* /tmp/core_dumps + core_files=( $(find . -type f -regex .*core.*\d*.*postgres) ) + if [ ${#core_files[@]} -gt 0 ]; then + cp "${core_files[@]}" /tmp/core_dumps fi when: on_fail - run: @@ -258,8 +259,9 @@ jobs: name: 'Copy coredumps' command: | mkdir -p /tmp/core_dumps - if ls core.* 1> /dev/null 2>&1; then - cp core.* /tmp/core_dumps + core_files=( $(find . -type f -regex .*core.*\d*.*postgres) ) + if [ ${#core_files[@]} -gt 0 ]; then + cp "${core_files[@]}" /tmp/core_dumps fi when: on_fail - store_artifacts: @@ -339,8 +341,9 @@ jobs: name: 'Copy coredumps' command: | mkdir -p /tmp/core_dumps - if ls core.* 1> /dev/null 2>&1; then - cp core.* /tmp/core_dumps + core_files=( $(find . -type f -regex .*core.*\d*.*postgres) ) + if [ ${#core_files[@]} -gt 0 ]; then + cp "${core_files[@]}" /tmp/core_dumps fi when: on_fail - store_artifacts: @@ -405,8 +408,9 @@ jobs: name: 'Copy coredumps' command: | mkdir -p /tmp/core_dumps - if ls core.* 1> /dev/null 2>&1; then - cp core.* /tmp/core_dumps + core_files=( $(find . -type f -regex .*core.*\d*.*postgres) ) + if [ ${#core_files[@]} -gt 0 ]; then + cp "${core_files[@]}" /tmp/core_dumps fi when: on_fail - store_artifacts: @@ -483,8 +487,9 @@ jobs: name: 'Copy coredumps' command: | mkdir -p /tmp/core_dumps - if ls core.* 1> /dev/null 2>&1; then - cp core.* /tmp/core_dumps + core_files=( $(find . -type f -regex .*core.*\d*.*postgres) ) + if [ ${#core_files[@]} -gt 0 ]; then + cp "${core_files[@]}" /tmp/core_dumps fi when: on_fail - store_artifacts: @@ -600,8 +605,9 @@ jobs: name: 'Copy coredumps' command: | mkdir -p /tmp/core_dumps - if ls core.* 1> /dev/null 2>&1; then - cp core.* /tmp/core_dumps + core_files=( $(find . -type f -regex .*core.*\d*.*postgres) ) + if [ ${#core_files[@]} -gt 0 ]; then + cp "${core_files[@]}" /tmp/core_dumps fi when: on_fail - store_artifacts: