Resolve KASM-5423 "Feature/ named schedules"

This commit is contained in:
Ryan Kuba 2024-02-06 20:34:25 +00:00 committed by Justin Travis
parent fb8a62165b
commit f609fe0fb5
4 changed files with 29 additions and 13 deletions

View File

@ -10,11 +10,6 @@ if [ ${USE_PRIVATE_IMAGES} -eq 1 ]; then
BASE=${BASE}-private BASE=${BASE}-private
fi fi
# Determine if this is a rolling build
if [ "${CI_PIPELINE_SOURCE}" == "schedule" ]; then
BASE_TAG=${BASE_TAG}-rolling
fi
## Build/Push image to cache endpoint by pipeline ID ## ## Build/Push image to cache endpoint by pipeline ID ##
docker build \ docker build \
-t ${ORG_NAME}/image-cache-private:$(arch)-${NAME}-${SANITIZED_BRANCH}-${CI_PIPELINE_ID} \ -t ${ORG_NAME}/image-cache-private:$(arch)-${NAME}-${SANITIZED_BRANCH}-${CI_PIPELINE_ID} \

View File

@ -136,6 +136,9 @@ test_{{ IMAGE.name }}:
manifest_{{ IMAGE.name }}: manifest_{{ IMAGE.name }}:
stage: manifest stage: manifest
when: always when: always
variables:
SCHEDULED: "{{ SCHEDULED }}"
SCHEDULE_NAME: "{{ SCHEDULE_NAME }}"
script: script:
- apk add bash tar - apk add bash tar
- bash ci-scripts/manifest.sh "{{ IMAGE.name }}" "multi"{% if IMAGE.singleapp %} - bash ci-scripts/manifest.sh "{{ IMAGE.name }}" "multi"{% if IMAGE.singleapp %}
@ -162,6 +165,9 @@ manifest_{{ IMAGE.name }}:
manifest_{{ IMAGE.name }}: manifest_{{ IMAGE.name }}:
stage: manifest stage: manifest
when: always when: always
variables:
SCHEDULED: "{{ SCHEDULED }}"
SCHEDULE_NAME: "{{ SCHEDULE_NAME }}"
script: script:
- apk add bash tar - apk add bash tar
- bash ci-scripts/manifest.sh "{{ IMAGE.name }}" "single"{% if IMAGE.singleapp %} - bash ci-scripts/manifest.sh "{{ IMAGE.name }}" "single"{% if IMAGE.singleapp %}

View File

@ -19,23 +19,31 @@ 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
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling if [[ "${SCHEDULE_NAME}" == "NO" ]]; then
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
else
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling-${SCHEDULE_NAME}
fi
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
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling if [[ "${SCHEDULE_NAME}" == "NO" ]]; then
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
else
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling-${SCHEDULE_NAME}
fi
fi fi
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")
@ -58,12 +66,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-${NAME}-${PULL_BRANCH}-${CI_PIPELINE_ID} docker pull ${ORG_NAME}/image-cache-private:x86_64-${NAME}-${PULL_BRANCH}-${CI_PIPELINE_ID}

View File

@ -6,10 +6,15 @@ import os
# Determine if this is a feature branch # Determine if this is a feature branch
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')
if os.getenv('USE_PRIVATE_IMAGES') == 1: if os.getenv('USE_PRIVATE_IMAGES') == 1:
fileLimits = False fileLimits = False
@ -21,6 +26,8 @@ with open("template-vars.yaml", 'r') as stream:
templateVars['USE_PRIVATE_IMAGES'] = os.getenv('USE_PRIVATE_IMAGES') templateVars['USE_PRIVATE_IMAGES'] = os.getenv('USE_PRIVATE_IMAGES')
templateVars['BASE_TAG'] = os.getenv('BASE_TAG') templateVars['BASE_TAG'] = os.getenv('BASE_TAG')
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: