mirror of
https://github.com/kasmtech/workspaces-core-images.git
synced 2024-11-21 23:13:08 +01:00
KASM-5423 update schedule logic to pass variables properly and use bash comparison operators
This commit is contained in:
parent
13c85726b2
commit
dc57f4eca8
@ -187,6 +187,9 @@ scan_{{ IMAGE.name1 }}_{{ IMAGE.name2 }}:
|
||||
manifest_{{ IMAGE.name1 }}_{{ IMAGE.name2 }}:
|
||||
stage: manifest
|
||||
when: always
|
||||
variables:
|
||||
SCHEDULED: "{{ SCHEDULED }}"
|
||||
SCHEDULE_NAME: "{{ SCHEDULED_NAME }}"
|
||||
script:
|
||||
- apk add bash
|
||||
- bash ci-scripts/manifest.sh "{{ IMAGE.name1 }}" "{{ IMAGE.name2 }}" "multi"
|
||||
@ -212,6 +215,9 @@ manifest_{{ IMAGE.name1 }}_{{ IMAGE.name2 }}:
|
||||
manifest_{{ IMAGE.name1 }}_{{ IMAGE.name2 }}:
|
||||
stage: manifest
|
||||
when: always
|
||||
variables:
|
||||
SCHEDULED: "{{ SCHEDULED }}"
|
||||
SCHEDULE_NAME: "{{ SCHEDULED_NAME }}"
|
||||
script:
|
||||
- apk add bash
|
||||
- bash ci-scripts/manifest.sh "{{ IMAGE.name1 }}" "{{ IMAGE.name2 }}" "single"
|
||||
|
@ -20,8 +20,8 @@ else
|
||||
fi
|
||||
|
||||
# Determine if this is a rolling build
|
||||
if [ "${CI_PIPELINE_SOURCE}" == "schedule" ]; then
|
||||
if [ -z ${SCHEDULE_NAME+x} ]; then
|
||||
if [[ "${SCHEDULED}" != "NO" ]]; then
|
||||
if [[ "${SCHEDULE_NAME}" == "NO" ]]; then
|
||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
|
||||
else
|
||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling-${SCHEDULE_NAME}
|
||||
@ -29,11 +29,11 @@ if [ "${CI_PIPELINE_SOURCE}" == "schedule" ]; then
|
||||
fi
|
||||
|
||||
# Determine if we are doing a reversion
|
||||
if [ ! -z "${REVERT_PIPELINE_ID}" ]; then
|
||||
if [[ ! -z "${REVERT_PIPELINE_ID}" ]]; then
|
||||
# If we are reverting modify the pipeline ID to the one passed
|
||||
CI_PIPELINE_ID=${REVERT_PIPELINE_ID}
|
||||
if [ "${IS_ROLLING}" == "true" ]; then
|
||||
if [ -z ${SCHEDULE_NAME+x} ]; then
|
||||
if [[ "${IS_ROLLING}" == "true" ]]; then
|
||||
if [[ "${SCHEDULE_NAME}" == "NO" ]]; then
|
||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
|
||||
else
|
||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling-${SCHEDULE_NAME}
|
||||
@ -42,9 +42,9 @@ if [ ! -z "${REVERT_PIPELINE_ID}" ]; then
|
||||
fi
|
||||
|
||||
# Check test output
|
||||
if [ -z "${REVERT_PIPELINE_ID}" ]; then
|
||||
if [[ -z "${REVERT_PIPELINE_ID}" ]]; then
|
||||
apk add curl
|
||||
if [ "${TYPE}" == "multi" ]; then
|
||||
if [[ "${TYPE}" == "multi" ]]; then
|
||||
ARCHES=("x86_64" "aarch64")
|
||||
else
|
||||
ARCHES=("x86_64")
|
||||
@ -67,12 +67,12 @@ if [ -z "${REVERT_PIPELINE_ID}" ]; then
|
||||
fi
|
||||
|
||||
# Fail job and go no further if tests did not pass
|
||||
if [ "${FAILED}" == "true" ]; then
|
||||
if [[ "${FAILED}" == "true" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Manifest for multi pull and push for single arch
|
||||
if [ "${TYPE}" == "multi" ]; then
|
||||
if [[ "${TYPE}" == "multi" ]]; then
|
||||
|
||||
# Pull images from cache repo
|
||||
docker pull ${ORG_NAME}/image-cache-private:x86_64-core-${NAME1}-${NAME2}-${PULL_BRANCH}-${CI_PIPELINE_ID}
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user