From bade6e0b0c68841ea0b1c001bd453e38d27a6f98 Mon Sep 17 00:00:00 2001 From: Konrad Botor <kbotor@syncad.com> Date: Thu, 27 Jul 2023 15:47:23 +0200 Subject: [PATCH] Moved default job configuration to a separate YAML file and added default job timeout - ref. #1 --- .gitlab-ci.yml | 1 + templates/base.gitlab-ci.yml | 10 ++++++++++ templates/docker_image_jobs.gitlab-ci.yml | 9 +++++---- templates/test_jobs.gitlab-ci.yml | 12 ++++++------ 4 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 templates/base.gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aa18301..d8ce86d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,6 +19,7 @@ include: - local: templates/test_jobs.gitlab-ci.yml .validation_job: + extends: .job-defaults stage: validation artifacts: name: validation-results diff --git a/templates/base.gitlab-ci.yml b/templates/base.gitlab-ci.yml new file mode 100644 index 0000000..7809a7e --- /dev/null +++ b/templates/base.gitlab-ci.yml @@ -0,0 +1,10 @@ +default: + timeout: 1 hour + artifacts: + when: always + expire_in: 6 hours + +# Necessary due to a bug. +# See https://gitlab.com/gitlab-org/gitlab/-/issues/418003 for details. +.job-defaults: + timeout: 1 hour diff --git a/templates/docker_image_jobs.gitlab-ci.yml b/templates/docker_image_jobs.gitlab-ci.yml index d3727e4..5193e16 100644 --- a/templates/docker_image_jobs.gitlab-ci.yml +++ b/templates/docker_image_jobs.gitlab-ci.yml @@ -3,12 +3,11 @@ variables: DOCKER_DIND_TAG: "latest" IMAGE_REMOVER_TAG: "latest" -.artifact_policy: - artifacts: - when: always - expire_in: 6 hours +include: + - local: templates/base.gitlab-ci.yml .docker_image_builder_job_template: + extends: .job-defaults variables: DOCKER_DRIVER: overlay2 DOCKER_TLS_CERTDIR: "/certs" @@ -25,6 +24,7 @@ variables: alias: docker .docker_image_cleanup_job_template: + extends: .job-defaults image: registry.gitlab.syncad.com/hive/common-ci-configuration/image-remover:${IMAGE_REMOVER_TAG} interruptible: true variables: @@ -48,3 +48,4 @@ variables: rules: - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' when: manual + allow_failure: true diff --git a/templates/test_jobs.gitlab-ci.yml b/templates/test_jobs.gitlab-ci.yml index 6a860fe..ea6b1a1 100644 --- a/templates/test_jobs.gitlab-ci.yml +++ b/templates/test_jobs.gitlab-ci.yml @@ -3,11 +3,12 @@ variables: TOX_IMAGE_TAG: "latest" APP_PORT: 0 +include: + - local: templates/base.gitlab-ci.yml + .jmeter_benchmark_job: + extends: .job-defaults image: registry.gitlab.syncad.com/hive/common-ci-configuration/benchmark-test-runner:${BENCHMARK_IMAGE_TAG} - artifacts: - when: always - expire_in: 6 hours .jmeter_benchmark_with_haf_job: extends: .jmeter_benchmark_job @@ -25,6 +26,7 @@ variables: alias: app .pytest_based_template: + extends: .job-defaults variables: FF_NETWORK_PER_BUILD: 1 JUNIT_REPORT: "report.xml" # should be ovverided by derived jobs @@ -104,10 +106,8 @@ variables: .tox_test_job: + extends: .job-defaults image: registry.gitlab.syncad.com/hive/common-ci-configuration/tox-test-runner:${TOX_IMAGE_TAG} - artifacts: - when: always - expire_in: 6 hours .pattern_tests_template: extends: .tox_test_job -- GitLab