Skip to content

Commit

Permalink
separate infra tests from pre-commit in GitLab (demisto#34142)
Browse files Browse the repository at this point in the history
* separate infra tests from pre-commit in GitLab

* separate infra tests from pre-commit in GitLab

* add stage

* fix
  • Loading branch information
dorschw authored May 15, 2024
1 parent 814e751 commit a3db541
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 25 deletions.
19 changes: 12 additions & 7 deletions .gitlab/ci/.gitlab-ci.global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,10 @@
- .default-job-settings


.run-pre-commit:
cache:
policy: pull-push
.test-infrastructure:
stage: unittests-and-validations
extends:
- .pre-commit-settings
variables:
KUBERNETES_MEMORY_REQUEST: 8Gi
KUBERNETES_MEMORY_LIMIT: 16Gi
- .default-job-settings
script:
- section_start "Test Infrastructure"
- python3 -m pytest ./Tests/scripts/infrastructure_tests/ -v --disable-warnings
Expand All @@ -443,6 +439,15 @@
fi
- section_end "Test Infrastructure"

.run-pre-commit:
cache:
policy: pull-push
extends:
- .pre-commit-settings
variables:
KUBERNETES_MEMORY_REQUEST: 8Gi
KUBERNETES_MEMORY_LIMIT: 16Gi
script:
- section_start "Revoking GCP Auth and Configure Docker"
# we need to configure the docker with the registry in order to be able to pull the images
- gcloud auth revoke "${GCS_ARTIFACTS_ACCOUNT_NAME}" >> "${ARTIFACTS_FOLDER}/logs/gcloud_auth.log" 2>&1
Expand Down
44 changes: 26 additions & 18 deletions .gitlab/ci/.gitlab-ci.on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@
- !reference [.filter-non-nightly-docker-updates-rule, rules]
- if: '$CI_PIPELINE_SOURCE =~ /^(push|contrib)$/'

.infrastructure-rules:
rules:
- if: '$BUCKET_UPLOAD == "true"'
when: never
- if: '$SECURITY_SCANS == "true"'
when: never
- if: '$BUILD_MACHINES_CLEANUP == "true"'
when: never
- if: '$FORCE_BUCKET_UPLOAD == "true"'
when: never
- if: '$DEMISTO_TEST_NATIVE_CANDIDATE == "true"'
when: never
- if: '$TRIGGER_CONTRIBUTION_BUILD == "true"'
when: never
- if: '$SDK_RELEASE == "true"'
when: never
# In sdk nighly we run this separately
- if: '$DEMISTO_SDK_NIGHTLY != "true"'
- if: '$CI_PIPELINE_SOURCE =~ /^(push|contrib)$/'

.create-release-notes-and-common-docs:
- section_start "Create Release Notes and Common Server Documentation" --collapsed
- echo "Creating Release Notes and Content Descriptor"
Expand Down Expand Up @@ -53,29 +73,17 @@ stop-running-pipelines:
- section_end "Stop running pipelines on current branch"
- job-done

test-infrastructure:
extends:
- .infrastructure-rules
- .test-infrastructure

run-pre-commit:
extends:
- .infrastructure-rules
- .run-pre-commit
cache:
policy: pull-push
rules:
- if: '$BUCKET_UPLOAD == "true"'
when: never
- if: '$SECURITY_SCANS == "true"'
when: never
- if: '$BUILD_MACHINES_CLEANUP == "true"'
when: never
- if: '$FORCE_BUCKET_UPLOAD == "true"'
when: never
- if: '$DEMISTO_TEST_NATIVE_CANDIDATE == "true"'
when: never
- if: '$TRIGGER_CONTRIBUTION_BUILD == "true"'
when: never
- if: '$SDK_RELEASE == "true"'
when: never
# In sdk nighly we run this separately
- if: '$DEMISTO_SDK_NIGHTLY != "true"'
- if: '$CI_PIPELINE_SOURCE =~ /^(push|contrib)$/'

# runs in gitlab for the on-push flow (except for contributors)
run-validations:
Expand Down

0 comments on commit a3db541

Please sign in to comment.