Skip to content
Snippets Groups Projects
Commit cdd47023 authored by Tim Jaacks's avatar Tim Jaacks
Browse files

Introduce separate variables to set RELEASE_NAME and RELEASE_VERSION

The expressions to calculate RELEASE_NAME and RELEASE_VERSION cannot be
stored within these variables themseselves. If set on the trigger level,
they would override the calculated values in build-version.env then,
as trigger variables always have the highest precedence.

Use separate variables RELEASE_VERSION_EXPRESSION and
RELEASE_NAME_EXPRESSION to define how RELEASE_VERSION and RELEASE_NAME
are calculated instead.
parent 372d192b
No related branches found
No related tags found
1 merge request!329Add yocto version job
Pipeline #78802 passed with stage
in 2 minutes and 45 seconds
...@@ -152,19 +152,19 @@ workflow: ...@@ -152,19 +152,19 @@ workflow:
- when: always - when: always
variables: variables:
BITBAKE_ENV_COMMAND: bitbake ${YOCTO_IMAGE} -e BITBAKE_ENV_COMMAND: bitbake ${YOCTO_IMAGE} -e
# RELEASE_VERSION and RELEASE_NAME are eval'ed before saving them to version.env, # RELEASE_VERSION_EXPRESSION and RELEASE_NAME_EXPRESSION are eval'ed and then saved
# so we can use deferred variable expansion or even command execution to construct # as RELEASE_VERSION and RELEASE_NAME to version.env, so we can use deferred
# their values. # variable expansion or even command execution to construct their values.
RELEASE_VERSION: $${DISTRO_VERSION} RELEASE_VERSION_EXPRESSION: $${DISTRO_VERSION}
RELEASE_NAME: Yocto-${RELEASE_VERSION} RELEASE_NAME_EXPRESSION: Yocto-$${RELEASE_VERSION}
script: script:
# Extract all variable assignments from the BitBake environment and source them. # Extract all variable assignments from the BitBake environment and source them.
# The rather complicated regex also regards values containing escaped quotes. # The rather complicated regex also regards values containing escaped quotes.
- source <( ${BITBAKE_ENV_COMMAND} | egrep '^[A-Z]\w*="([^\\"]+|\\.)*"$' ) - source <( ${BITBAKE_ENV_COMMAND} | egrep '^[A-Z]\w*="([^\\"]+|\\.)*"$' )
- echo ${RELEASE_VERSION} - echo ${RELEASE_VERSION_EXPRESSION}
- echo ${RELEASE_NAME} - echo ${RELEASE_NAME_EXPRESSION}
- RELEASE_VERSION=$(eval echo "${RELEASE_VERSION}") - RELEASE_VERSION=$(eval echo "${RELEASE_VERSION_EXPRESSION}")
- RELEASE_NAME=$(eval echo "${RELEASE_NAME}") - RELEASE_NAME=$(eval echo "${RELEASE_NAME_EXPRESSION}")
- echo "RELEASE_VERSION=${RELEASE_VERSION}" >> ${CI_PROJECT_DIR}/version.env - echo "RELEASE_VERSION=${RELEASE_VERSION}" >> ${CI_PROJECT_DIR}/version.env
- echo "RELEASE_NAME=${RELEASE_NAME}" >> ${CI_PROJECT_DIR}/version.env - echo "RELEASE_NAME=${RELEASE_NAME}" >> ${CI_PROJECT_DIR}/version.env
- cat ${CI_PROJECT_DIR}/version.env - cat ${CI_PROJECT_DIR}/version.env
......
...@@ -101,10 +101,10 @@ fngsystem-pipeline: ...@@ -101,10 +101,10 @@ fngsystem-pipeline:
# Escaped variables are not correctly passed to child pipelines. Proposed workaround # Escaped variables are not correctly passed to child pipelines. Proposed workaround
# is to use raw variables, but we need at least GitLab 15.6 for that. As soon as we # is to use raw variables, but we need at least GitLab 15.6 for that. As soon as we
# update our GitLab, we can get rid of the DEFERRED_RELEASE_VERSION variable and # update our GitLab, we can get rid of the DEFERRED_RELEASE_VERSION variable and
# assign its value to RELEASE_VERSION directly. # assign its value to RELEASE_VERSION_EXPRESSION directly.
DEFERRED_RELEASE_VERSION: $$(echo $$DISTRO_VERSION | sed "s/fngsystem-//") DEFERRED_RELEASE_VERSION: $$(echo $$DISTRO_VERSION | sed "s/fngsystem-//")
RELEASE_VERSION: $DEFERRED_RELEASE_VERSION RELEASE_VERSION_EXPRESSION: $DEFERRED_RELEASE_VERSION
RELEASE_NAME: FNGSystem-${DEFERRED_RELEASE_VERSION} RELEASE_NAME_EXPRESSION: FNGSystem-${DEFERRED_RELEASE_VERSION}
ARTIFACTS_PATH: build-*/tmp/deploy/images/**/* ARTIFACTS_PATH: build-*/tmp/deploy/images/**/*
PACKAGE_TYPE: image PACKAGE_TYPE: image
ALPHAPLAN_STAGE: "true" ALPHAPLAN_STAGE: "true"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment