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

Use RELEASE_VERSION and RELEASE_NAME from build-version job

Instead of passing these variables from stage to stage or regenerating
their values in later stages, use the ones set in the build-version job
at all places.
parent cad30c20
No related branches found
No related tags found
1 merge request!329Add yocto version job
Pipeline #78635 passed with warnings with stages
in 10 minutes
...@@ -140,6 +140,7 @@ package-{{ machine }}: ...@@ -140,6 +140,7 @@ package-{{ machine }}:
- job: build-{{ machine }} - job: build-{{ machine }}
artifacts: false artifacts: false
- job: changelog - job: changelog
- job: build-version
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
...@@ -165,6 +166,7 @@ deploy-{{ machine }}: ...@@ -165,6 +166,7 @@ deploy-{{ machine }}:
- job: package-{{ machine }} - job: package-{{ machine }}
artifacts: false artifacts: false
- job: changelog - job: changelog
- job: build-version
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
...@@ -174,6 +176,7 @@ generate-alphaplan-data-{{ machine }}: ...@@ -174,6 +176,7 @@ generate-alphaplan-data-{{ machine }}:
extends: .generate_alphaplan_data extends: .generate_alphaplan_data
needs: needs:
- deploy-{{ machine }} - deploy-{{ machine }}
- build-version
import-alphaplan-data-{{ machine }}: import-alphaplan-data-{{ machine }}:
extends: .import_alphaplan_data extends: .import_alphaplan_data
...@@ -205,6 +208,7 @@ ftp-{{ machine }}: ...@@ -205,6 +208,7 @@ ftp-{{ machine }}:
- job: package-{{ machine }} - job: package-{{ machine }}
artifacts: false artifacts: false
- job: changelog - job: changelog
- job: build-version
{% endif %} {% endif %}
{% endif %} {% endif %}
...@@ -258,8 +262,6 @@ generate-confluence-page: ...@@ -258,8 +262,6 @@ generate-confluence-page:
publish-confluence-page: publish-confluence-page:
extends: extends:
- .publish-confluence-page - .publish-confluence-page
needs:
- generate-confluence-page
{% endif %} {% endif %}
{% endif %} {% endif %}
......
...@@ -339,16 +339,19 @@ workflow: ...@@ -339,16 +339,19 @@ workflow:
- source build.env - source build.env
script: script:
# IMAGE_PATH, SDK_PATH and LICENSES_PATH are available via build.env from build job # IMAGE_PATH, SDK_PATH and LICENSES_PATH are available via build.env from build job
# RELEASE_NAME is available via version.env from build-version job
- if [[ "${PACKAGE_TYPE}" == "image" ]]; then - if [[ "${PACKAGE_TYPE}" == "image" ]]; then
- .gitlab-ci/scripts/package_release.py - .gitlab-ci/scripts/package_release.py
--images-dir="${IMAGE_PATH}" --images-dir="${IMAGE_PATH}"
--licenses-dir="${LICENSES_PATH}" --licenses-dir="${LICENSES_PATH}"
--doc-dir=. --doc-dir=.
--output-dir=release --output-dir=release/${RELEASE_NAME}
--release-version=${RELEASE_VERSION}
- elif [[ "${PACKAGE_TYPE}" == "sdk" ]]; then - elif [[ "${PACKAGE_TYPE}" == "sdk" ]]; then
- .gitlab-ci/scripts/package_release.py - .gitlab-ci/scripts/package_release.py
--sdk-dir="${SDK_PATH}" --sdk-dir="${SDK_PATH}"
--output-dir=release --output-dir=release/${RELEASE_NAME}
--release-version=${RELEASE_VERSION}
- fi - fi
cache: cache:
- key: ${CI_PIPELINE_ID}-${ASSOCIATED_BUILD_JOB} - key: ${CI_PIPELINE_ID}-${ASSOCIATED_BUILD_JOB}
...@@ -371,8 +374,6 @@ workflow: ...@@ -371,8 +374,6 @@ workflow:
# We do this manually since we do not use GitLab's default artifact downloader # We do this manually since we do not use GitLab's default artifact downloader
- source package.env - source package.env
# Save dotenv data for next stage # Save dotenv data for next stage
- echo "RELEASE_NAME=${RELEASE_NAME}" > deploy.env
- echo "VERSION=${VERSION}" >> deploy.env
- echo "MACHINE=${MACHINE}" >> deploy.env - echo "MACHINE=${MACHINE}" >> deploy.env
# Expand eventual nested variables contained within the DEPLOY_* variables # Expand eventual nested variables contained within the DEPLOY_* variables
# FIXME: For now we need a double 'eval' here due to a GitLab bug: # FIXME: For now we need a double 'eval' here due to a GitLab bug:
...@@ -444,6 +445,8 @@ workflow: ...@@ -444,6 +445,8 @@ workflow:
rules: rules:
- when: manual - when: manual
allow_failure: true allow_failure: true
needs:
- build-version
script: script:
- .gitlab-ci/scripts/collect_release_information.py - .gitlab-ci/scripts/collect_release_information.py
--project $CI_PROJECT_ID --project $CI_PROJECT_ID
...@@ -457,12 +460,9 @@ workflow: ...@@ -457,12 +460,9 @@ workflow:
- .gitlab-ci/scripts/render_jinja2_template.py - .gitlab-ci/scripts/render_jinja2_template.py
--template="${PAGE_TEMPLATE}" --template="${PAGE_TEMPLATE}"
> confluence-page.xml > confluence-page.xml
- echo "RELEASE_NAME=${RELEASE_NAME}" >> confluence.env
artifacts: artifacts:
paths: paths:
- confluence-page.xml - confluence-page.xml
reports:
dotenv: confluence.env
.publish-confluence-page: .publish-confluence-page:
extends: extends:
...@@ -471,6 +471,9 @@ workflow: ...@@ -471,6 +471,9 @@ workflow:
rules: rules:
- when: manual - when: manual
allow_failure: true allow_failure: true
needs:
- generate-confluence-page
- build-version
script: script:
- .gitlab-ci/scripts/confluence_create_or_update_page.py - .gitlab-ci/scripts/confluence_create_or_update_page.py
--username="${CONFLUENCE_USERNAME}" --username="${CONFLUENCE_USERNAME}"
...@@ -492,7 +495,8 @@ workflow: ...@@ -492,7 +495,8 @@ workflow:
rules: rules:
- if: $ALPHAPLAN_STAGE == "true" - if: $ALPHAPLAN_STAGE == "true"
script: script:
# MACHINE and RELEASE_NAME are available from deploy.env # MACHINE is available from deploy.env
# RELEASE_NAME is available from build-version.env
- .gitlab-ci/scripts/generate_alphaplan_fwr_file.py - .gitlab-ci/scripts/generate_alphaplan_fwr_file.py
--machine="${MACHINE}" --machine="${MACHINE}"
--release-name="${RELEASE_NAME}" --release-name="${RELEASE_NAME}"
......
...@@ -82,9 +82,14 @@ def main(): ...@@ -82,9 +82,14 @@ def main():
) )
parser.add_argument( parser.add_argument(
"--output-dir", "--output-dir",
help="""Base directory name for output artifacts (can be specified multiple times)""", help="""Directory name for output artifacts""",
dest="output_dir", dest="output_dir",
action="append", required=True,
)
parser.add_argument(
"--release-version",
help="""Release version""",
dest="release_version",
required=True, required=True,
) )
args, _ = parser.parse_known_args() args, _ = parser.parse_known_args()
...@@ -114,24 +119,13 @@ def main(): ...@@ -114,24 +119,13 @@ def main():
buildvars = json.load(f) buildvars = json.load(f)
machine = buildvars["MACHINE"] machine = buildvars["MACHINE"]
version = buildvars["DISTRO_VERSION"]
sdkname = buildvars["TOOLCHAIN_OUTPUTNAME"] sdkname = buildvars["TOOLCHAIN_OUTPUTNAME"]
image_artifacts = buildvars["DISTRO_IMAGES"].split() image_artifacts = buildvars["DISTRO_IMAGES"].split()
artifacts = buildvars["DISTRO_RELEASE_ARTEFACTS"].split() artifacts = buildvars["DISTRO_RELEASE_ARTEFACTS"].split()
artifacts.append("BUILD_SRCREVS.log") artifacts.append("BUILD_SRCREVS.log")
# Set release name # Create output directory
if version.startswith("fngsystem"): os.makedirs(args.output_dir, exist_ok=True)
release_name = version.replace("fngsystem", "FNGSystem")
else:
release_name = f"Yocto-{version}"
# Create output directories
output_dirs = []
for output_dir in args.output_dir:
full_output_dir = os.path.join(output_dir, release_name)
output_dirs.append(full_output_dir)
os.makedirs(full_output_dir, exist_ok=True)
# Package documentation files # Package documentation files
if args.doc_dir is not None: if args.doc_dir is not None:
...@@ -151,8 +145,7 @@ def main(): ...@@ -151,8 +145,7 @@ def main():
files.append(doc_md5sums_file) files.append(doc_md5sums_file)
# Copy files # Copy files
for output_dir in output_dirs: copy_files(files, args.output_dir)
copy_files(files, output_dir)
# Package image files # Package image files
if args.images_dir is not None: if args.images_dir is not None:
...@@ -184,7 +177,7 @@ def main(): ...@@ -184,7 +177,7 @@ def main():
# Generate metadata file # Generate metadata file
generate_metadata( generate_metadata(
machine, machine,
version, args.release_version,
artifacts, artifacts,
sdkname, sdkname,
os.path.join(args.images_dir, "metainfo.json"), os.path.join(args.images_dir, "metainfo.json"),
...@@ -192,8 +185,7 @@ def main(): ...@@ -192,8 +185,7 @@ def main():
artifacts.append(os.path.join(args.images_dir, "metainfo.json")) artifacts.append(os.path.join(args.images_dir, "metainfo.json"))
# Copy files # Copy files
for output_dir in output_dirs: copy_files(artifacts, os.path.join(args.output_dir, machine))
copy_files(artifacts, os.path.join(output_dir, machine))
# Package SDK # Package SDK
if args.sdk_dir is not None: if args.sdk_dir is not None:
...@@ -205,13 +197,10 @@ def main(): ...@@ -205,13 +197,10 @@ def main():
sdkfiles.append(sdk_md5sums_file) sdkfiles.append(sdk_md5sums_file)
# Copy files # Copy files
for output_dir in output_dirs: copy_files(sdkfiles, os.path.join(args.output_dir, machine, "sdk"))
copy_files(sdkfiles, os.path.join(output_dir, machine, "sdk"))
# Store pathes and other stuff in environment variable file # Store pathes and other stuff in environment variable file
with open("package.env", "w", encoding="utf-8") as env_file: with open("package.env", "w", encoding="utf-8") as env_file:
env_file.write(f"RELEASE_NAME={release_name}\n")
env_file.write(f"VERSION={version}\n")
env_file.write(f"MACHINE={machine}\n") env_file.write(f"MACHINE={machine}\n")
......
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