Dont create license_management build when not included in license

This improves CI performance since we do not create a whole new job that
just exits quickly. This is important based on
https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/4907#note_104742212
This commit is contained in:
Dylan Griffith 2018-09-27 15:06:02 +03:00
parent 7c1cfd0bf5
commit df796a4212
2 changed files with 12 additions and 8 deletions

View File

@ -0,0 +1,5 @@
---
title: Dont create license_management build when not included in license
merge_request: 21958
author:
type: performance

View File

@ -122,6 +122,9 @@ license_management:
paths: [gl-license-management-report.json]
only:
- branches
only:
variables:
- $GITLAB_FEATURES =~ /\blicense_management\b/
except:
variables:
- $LICENSE_MANAGEMENT_DISABLED
@ -484,15 +487,11 @@ rollout 100%:
}
function license_management() {
if echo $GITLAB_FEATURES |grep license_management > /dev/null ; then
# Extract "MAJOR.MINOR" from CI_SERVER_VERSION and generate "MAJOR-MINOR-stable"
LICENSE_MANAGEMENT_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
# Extract "MAJOR.MINOR" from CI_SERVER_VERSION and generate "MAJOR-MINOR-stable"
LICENSE_MANAGEMENT_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
docker run --volume "$PWD:/code" \
"registry.gitlab.com/gitlab-org/security-products/license-management:$LICENSE_MANAGEMENT_VERSION" analyze /code
else
echo "License management is not available in your subscription"
fi
docker run --volume "$PWD:/code" \
"registry.gitlab.com/gitlab-org/security-products/license-management:$LICENSE_MANAGEMENT_VERSION" analyze /code
}
function sast() {