mirror of
https://github.com/kasmtech/workspaces-images.git
synced 2024-11-24 17:13:10 +01:00
Resolve KASM-5423 "Feature/ named schedules"
This commit is contained in:
parent
fb8a62165b
commit
f609fe0fb5
@ -10,11 +10,6 @@ if [ ${USE_PRIVATE_IMAGES} -eq 1 ]; then
|
||||
BASE=${BASE}-private
|
||||
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 ##
|
||||
docker build \
|
||||
-t ${ORG_NAME}/image-cache-private:$(arch)-${NAME}-${SANITIZED_BRANCH}-${CI_PIPELINE_ID} \
|
||||
|
@ -136,6 +136,9 @@ test_{{ IMAGE.name }}:
|
||||
manifest_{{ IMAGE.name }}:
|
||||
stage: manifest
|
||||
when: always
|
||||
variables:
|
||||
SCHEDULED: "{{ SCHEDULED }}"
|
||||
SCHEDULE_NAME: "{{ SCHEDULE_NAME }}"
|
||||
script:
|
||||
- apk add bash tar
|
||||
- bash ci-scripts/manifest.sh "{{ IMAGE.name }}" "multi"{% if IMAGE.singleapp %}
|
||||
@ -162,6 +165,9 @@ manifest_{{ IMAGE.name }}:
|
||||
manifest_{{ IMAGE.name }}:
|
||||
stage: manifest
|
||||
when: always
|
||||
variables:
|
||||
SCHEDULED: "{{ SCHEDULED }}"
|
||||
SCHEDULE_NAME: "{{ SCHEDULE_NAME }}"
|
||||
script:
|
||||
- apk add bash tar
|
||||
- bash ci-scripts/manifest.sh "{{ IMAGE.name }}" "single"{% if IMAGE.singleapp %}
|
||||
|
@ -19,23 +19,31 @@ else
|
||||
fi
|
||||
|
||||
# Determine if this is a rolling build
|
||||
if [ "${CI_PIPELINE_SOURCE}" == "schedule" ]; then
|
||||
if [[ "${SCHEDULED}" != "NO" ]]; then
|
||||
if [[ "${SCHEDULE_NAME}" == "NO" ]]; then
|
||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
|
||||
else
|
||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling-${SCHEDULE_NAME}
|
||||
fi
|
||||
fi
|
||||
|
||||
# Determine if we are doing a reversion
|
||||
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 [[ "${IS_ROLLING}" == "true" ]]; then
|
||||
if [[ "${SCHEDULE_NAME}" == "NO" ]]; then
|
||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
|
||||
else
|
||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling-${SCHEDULE_NAME}
|
||||
fi
|
||||
fi
|
||||
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")
|
||||
@ -58,12 +66,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-${NAME}-${PULL_BRANCH}-${CI_PIPELINE_ID}
|
||||
|
@ -6,10 +6,15 @@ import os
|
||||
|
||||
# Determine if this is a feature branch
|
||||
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')
|
||||
if os.getenv('USE_PRIVATE_IMAGES') == 1:
|
||||
fileLimits = False
|
||||
|
||||
@ -21,6 +26,8 @@ with open("template-vars.yaml", 'r') as stream:
|
||||
templateVars['USE_PRIVATE_IMAGES'] = os.getenv('USE_PRIVATE_IMAGES')
|
||||
templateVars['BASE_TAG'] = os.getenv('BASE_TAG')
|
||||
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