diff --git a/.gitlab/ci/.containerlab-ci.yml b/.gitlab/ci/.containerlab-ci.yml index 7123202ce1f3e02e744ef925e4c141d256ae4843..6eeea4f8f9d0712098f275e6e06835ce3e215ef7 100644 --- a/.gitlab/ci/.containerlab-ci.yml +++ b/.gitlab/ci/.containerlab-ci.yml @@ -4,6 +4,15 @@ variables: CLAB_DIR: "/mnt" CLAB_NAME: "clab${CI_PIPELINE_IID}" +.integration_test_conditions: + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: always + - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"' + when: always + - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"' + when: always + # Templates for Job Types .containerlab_deploy: &containerlab_deploy stage: apply @@ -65,6 +74,9 @@ containerlab:deploy:integration: artifacts: reports: dotenv: ${CI_PROJECT_DIR}/build.env + rules: + - !reference [.integration_test_conditions, rules] + containerlab:destroy: @@ -79,7 +91,8 @@ containerlab:destroy: - docker volume rm -f ${CLAB_NAME}-volume - docker image rm -f ${GOSDN_CONTAINER_IMAGE} allow_failure: true - when: always + rules: + - !reference [.integration_test_conditions, rules] #containerlab:template:develop: