KASM-5423 update schedule logic to pass variables properly and use bash comparison operators

This commit is contained in:
ryan.kuba
2024-02-06 07:30:25 -08:00
parent 13c85726b2
commit dc57f4eca8
3 changed files with 23 additions and 10 deletions

View File

@ -4,12 +4,17 @@ from jinja2 import Template
import yaml
import os
# Determine if this is a feature branch
# Determine if this is a feature branch and what variables to pass
fileLimits = True
scheduled = 'NO'
scheduleName = 'NO'
if os.getenv('SANITIZED_BRANCH').startswith('release') or os.getenv('SANITIZED_BRANCH') == 'develop':
fileLimits = False
if os.getenv('CI_PIPELINE_SOURCE') == 'schedule':
fileLimits = False
scheduled = 'YES'
if 'SCHEDULE_NAME' in os.environ:
scheduleName = os.getenv('SCHEDULE_NAME')
# Read yaml file with variables
with open("template-vars.yaml", 'r') as stream:
@ -18,6 +23,8 @@ with open("template-vars.yaml", 'r') as stream:
templateVars['TEST_INSTALLER'] = os.getenv('TEST_INSTALLER')
templateVars['SANITIZED_BRANCH'] = os.getenv('SANITIZED_BRANCH')
templateVars['FILE_LIMITS'] = fileLimits
templateVars['SCHEDULED'] = scheduled
templateVars['SCHEDULE_NAME'] = scheduleName
# Read template file
with open("gitlab-ci.template", 'r') as stream: