mirror of
https://github.com/kasmtech/workspaces-core-images.git
synced 2024-11-22 07:23:09 +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 }}:
|
manifest_{{ IMAGE.name1 }}_{{ IMAGE.name2 }}:
|
||||||
stage: manifest
|
stage: manifest
|
||||||
when: always
|
when: always
|
||||||
|
variables:
|
||||||
|
SCHEDULED: "{{ SCHEDULED }}"
|
||||||
|
SCHEDULE_NAME: "{{ SCHEDULED_NAME }}"
|
||||||
script:
|
script:
|
||||||
- apk add bash
|
- apk add bash
|
||||||
- bash ci-scripts/manifest.sh "{{ IMAGE.name1 }}" "{{ IMAGE.name2 }}" "multi"
|
- bash ci-scripts/manifest.sh "{{ IMAGE.name1 }}" "{{ IMAGE.name2 }}" "multi"
|
||||||
@ -212,6 +215,9 @@ manifest_{{ IMAGE.name1 }}_{{ IMAGE.name2 }}:
|
|||||||
manifest_{{ IMAGE.name1 }}_{{ IMAGE.name2 }}:
|
manifest_{{ IMAGE.name1 }}_{{ IMAGE.name2 }}:
|
||||||
stage: manifest
|
stage: manifest
|
||||||
when: always
|
when: always
|
||||||
|
variables:
|
||||||
|
SCHEDULED: "{{ SCHEDULED }}"
|
||||||
|
SCHEDULE_NAME: "{{ SCHEDULED_NAME }}"
|
||||||
script:
|
script:
|
||||||
- apk add bash
|
- apk add bash
|
||||||
- bash ci-scripts/manifest.sh "{{ IMAGE.name1 }}" "{{ IMAGE.name2 }}" "single"
|
- bash ci-scripts/manifest.sh "{{ IMAGE.name1 }}" "{{ IMAGE.name2 }}" "single"
|
||||||
|
@ -20,8 +20,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine if this is a rolling build
|
# Determine if this is a rolling build
|
||||||
if [ "${CI_PIPELINE_SOURCE}" == "schedule" ]; then
|
if [[ "${SCHEDULED}" != "NO" ]]; then
|
||||||
if [ -z ${SCHEDULE_NAME+x} ]; then
|
if [[ "${SCHEDULE_NAME}" == "NO" ]]; then
|
||||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
|
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
|
||||||
else
|
else
|
||||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling-${SCHEDULE_NAME}
|
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling-${SCHEDULE_NAME}
|
||||||
@ -29,11 +29,11 @@ if [ "${CI_PIPELINE_SOURCE}" == "schedule" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine if we are doing a reversion
|
# 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
|
# If we are reverting modify the pipeline ID to the one passed
|
||||||
CI_PIPELINE_ID=${REVERT_PIPELINE_ID}
|
CI_PIPELINE_ID=${REVERT_PIPELINE_ID}
|
||||||
if [ "${IS_ROLLING}" == "true" ]; then
|
if [[ "${IS_ROLLING}" == "true" ]]; then
|
||||||
if [ -z ${SCHEDULE_NAME+x} ]; then
|
if [[ "${SCHEDULE_NAME}" == "NO" ]]; then
|
||||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
|
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
|
||||||
else
|
else
|
||||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling-${SCHEDULE_NAME}
|
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling-${SCHEDULE_NAME}
|
||||||
@ -42,9 +42,9 @@ if [ ! -z "${REVERT_PIPELINE_ID}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check test output
|
# Check test output
|
||||||
if [ -z "${REVERT_PIPELINE_ID}" ]; then
|
if [[ -z "${REVERT_PIPELINE_ID}" ]]; then
|
||||||
apk add curl
|
apk add curl
|
||||||
if [ "${TYPE}" == "multi" ]; then
|
if [[ "${TYPE}" == "multi" ]]; then
|
||||||
ARCHES=("x86_64" "aarch64")
|
ARCHES=("x86_64" "aarch64")
|
||||||
else
|
else
|
||||||
ARCHES=("x86_64")
|
ARCHES=("x86_64")
|
||||||
@ -67,12 +67,12 @@ if [ -z "${REVERT_PIPELINE_ID}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Fail job and go no further if tests did not pass
|
# Fail job and go no further if tests did not pass
|
||||||
if [ "${FAILED}" == "true" ]; then
|
if [[ "${FAILED}" == "true" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Manifest for multi pull and push for single arch
|
# Manifest for multi pull and push for single arch
|
||||||
if [ "${TYPE}" == "multi" ]; then
|
if [[ "${TYPE}" == "multi" ]]; then
|
||||||
|
|
||||||
# Pull images from cache repo
|
# Pull images from cache repo
|
||||||
docker pull ${ORG_NAME}/image-cache-private:x86_64-core-${NAME1}-${NAME2}-${PULL_BRANCH}-${CI_PIPELINE_ID}
|
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 yaml
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# Determine if this is a feature branch
|
# Determine if this is a feature branch and what variables to pass
|
||||||
fileLimits = True
|
fileLimits = True
|
||||||
|
scheduled = 'NO'
|
||||||
|
scheduleName = 'NO'
|
||||||
if os.getenv('SANITIZED_BRANCH').startswith('release') or os.getenv('SANITIZED_BRANCH') == 'develop':
|
if os.getenv('SANITIZED_BRANCH').startswith('release') or os.getenv('SANITIZED_BRANCH') == 'develop':
|
||||||
fileLimits = False
|
fileLimits = False
|
||||||
if os.getenv('CI_PIPELINE_SOURCE') == 'schedule':
|
if os.getenv('CI_PIPELINE_SOURCE') == 'schedule':
|
||||||
fileLimits = False
|
fileLimits = False
|
||||||
|
scheduled = 'YES'
|
||||||
|
if 'SCHEDULE_NAME' in os.environ:
|
||||||
|
scheduleName = os.getenv('SCHEDULE_NAME')
|
||||||
|
|
||||||
# Read yaml file with variables
|
# Read yaml file with variables
|
||||||
with open("template-vars.yaml", 'r') as stream:
|
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['TEST_INSTALLER'] = os.getenv('TEST_INSTALLER')
|
||||||
templateVars['SANITIZED_BRANCH'] = os.getenv('SANITIZED_BRANCH')
|
templateVars['SANITIZED_BRANCH'] = os.getenv('SANITIZED_BRANCH')
|
||||||
templateVars['FILE_LIMITS'] = fileLimits
|
templateVars['FILE_LIMITS'] = fileLimits
|
||||||
|
templateVars['SCHEDULED'] = scheduled
|
||||||
|
templateVars['SCHEDULE_NAME'] = scheduleName
|
||||||
|
|
||||||
# Read template file
|
# Read template file
|
||||||
with open("gitlab-ci.template", 'r') as stream:
|
with open("gitlab-ci.template", 'r') as stream:
|
||||||
|
Loading…
Reference in New Issue
Block a user