CI log artifact
This commit is contained in:
parent
5e4767c2d5
commit
7d672a905b
5 changed files with 37 additions and 3 deletions
|
|
@ -56,11 +56,19 @@ test:
|
|||
- echo "Copying jar files to clearing-all/bin" && cp -r /builds/mfd/clearing/z-distr/target/clearing/bin ./clr_test/clearing-all/bin
|
||||
- echo "Copying DDL.sql to db directory" && cp /builds/mfd/clearing/z-distr/target/clearing/db/DDL.sql ./clr_test/db/
|
||||
- python3 clr_test/run_test_docker_containers.py
|
||||
- mkdir -p artifacts/logs
|
||||
- echo "copying logs"
|
||||
- pwd
|
||||
- ls -al
|
||||
- docker run --rm -v clr_test_logs_volume:/logs alpine tar -C /logs -cf - . | tar -C artifacts/logs -xf -
|
||||
- ls -la artifacts/logs
|
||||
- echo "Cleaning up log volume"
|
||||
- docker volume rm clr_test_logs_volume
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
when: always
|
||||
paths:
|
||||
- $CI_PROJECT_DIR/clr_test/mnt
|
||||
- artifacts/logs
|
||||
only:
|
||||
- dev
|
||||
- /^dev_.*$/
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ RUN mkdir -p $CLEARING_HOME/files/xml/importer/in
|
|||
RUN mkdir -p $CLEARING_HOME/files/xml/importer/out
|
||||
RUN mkdir -p $CLEARING_HOME/files/xml/importer/error
|
||||
RUN mkdir -p $CLEARING_HOME/files/xml/exporter
|
||||
#ARG CLR_TEST_NAME
|
||||
#RUN mkdir -p $CLEARING_HOME_BIN/log/$CLR_TEST_NAME
|
||||
RUN mkdir -p $CLEARING_HOME_BIN/log_artifacts
|
||||
|
||||
WORKDIR $CLEARING_HOME
|
||||
RUN sed -i 's/\r$//' $CLEARING_HOME/*.sh
|
||||
|
|
|
|||
|
|
@ -16,6 +16,18 @@ sleep 30
|
|||
echo Run clearing-tester
|
||||
sh ./clearing_testing_utils/clearing-tester/clearing-tester.sh
|
||||
|
||||
if [ -n "$CLR_TEST_NAME" ] && [ -d "./bin/log" ]; then
|
||||
echo "Copying logs to ./bin/log_artifacts/${CLR_TEST_NAME}"
|
||||
# Copy all contents from ./bin/log to tmp dir
|
||||
mkdir -p "./bin/tmp_log_artifact"
|
||||
cp -a ./bin/log/. "./bin/tmp_log_artifact/"
|
||||
# Move the copied logs into the artifact location
|
||||
mkdir -p "./bin/log_artifacts/${CLR_TEST_NAME}"
|
||||
mv ./bin/tmp_log_artifact/* "./bin/log_artifacts/${CLR_TEST_NAME}"
|
||||
else
|
||||
echo "CLR_TEST_NAME is not set or ./bin/log does not exist. Skipping log copy."
|
||||
fi
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "Tests passed successfully"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,12 @@ services:
|
|||
retries: 100
|
||||
|
||||
clearing_system:
|
||||
build: ./clearing-all
|
||||
build:
|
||||
context: ./clearing-all
|
||||
args:
|
||||
CLR_TEST_NAME: ${CLR_TEST_NAME}
|
||||
environment:
|
||||
- CLR_TEST_NAME=${CLR_TEST_NAME}
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
|
@ -35,7 +40,7 @@ services:
|
|||
- "8080:8080"
|
||||
volumes:
|
||||
- ./mnt/results:/opt/clearing/clearing_testing_utils/store/results
|
||||
- ./mnt/logs/clearing:/opt/clearing/bin/log
|
||||
- logs_volume:/opt/clearing/bin/log_artifacts
|
||||
- ./mnt/logs/tester:/opt/clearing/clearing_testing_utils/clearing-tester/logs
|
||||
- ./mnt/logs/converter:/opt/clearing/clearing_testing_utils/clearing-converter/logs
|
||||
# - ./mnt/dbfout:/opt/clearing/files/dbf/exporter/
|
||||
|
|
@ -89,6 +94,8 @@ volumes:
|
|||
driver: local
|
||||
kafka_data:
|
||||
driver: local
|
||||
logs_volume:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
clearing-net:
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ RESULT_FILES_DIR = os.environ['RESULT_FILES_DIR']
|
|||
|
||||
def run_docker(folder_name):
|
||||
logging.info(f"Running docker-compose for {folder_name}")
|
||||
os.environ['CLR_TEST_NAME'] = folder_name
|
||||
os.chdir("clr_test")
|
||||
subprocess.call('docker rm -f $(docker ps --all -q --filter ancestor=clr_test-db)', shell=True)
|
||||
subprocess.call('docker rm -f $(docker ps --all -q --filter ancestor=clr_test-clearing_system)', shell=True)
|
||||
|
|
@ -107,6 +108,9 @@ def main():
|
|||
change_date(folder)
|
||||
run_docker(folder)
|
||||
|
||||
os.chdir("clr_test")
|
||||
subprocess.call('docker compose down', shell=True)
|
||||
os.chdir("..")
|
||||
|
||||
if __name__=='__main__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue