diff --git a/build-pipeline-yocto.yml.jinja2 b/build-pipeline-yocto.yml.jinja2 index 5fdb99cfe8c1225a36d41186d6e8bc398f6063e8..dd8ef24ba63ad44ad3729a92992bf51c26d0dc74 100644 --- a/build-pipeline-yocto.yml.jinja2 +++ b/build-pipeline-yocto.yml.jinja2 @@ -140,6 +140,7 @@ package-{{ machine }}: - job: build-{{ machine }} artifacts: false - job: changelog + - job: build-version # -------------------------------------------------------------------------------------- @@ -165,6 +166,7 @@ deploy-{{ machine }}: - job: package-{{ machine }} artifacts: false - job: changelog + - job: build-version # -------------------------------------------------------------------------------------- @@ -174,6 +176,7 @@ generate-alphaplan-data-{{ machine }}: extends: .generate_alphaplan_data needs: - deploy-{{ machine }} + - build-version import-alphaplan-data-{{ machine }}: extends: .import_alphaplan_data @@ -205,6 +208,7 @@ ftp-{{ machine }}: - job: package-{{ machine }} artifacts: false - job: changelog + - job: build-version {% endif %} {% endif %} @@ -258,8 +262,6 @@ generate-confluence-page: publish-confluence-page: extends: - .publish-confluence-page - needs: - - generate-confluence-page {% endif %} {% endif %} diff --git a/build-pipeline.yml b/build-pipeline.yml index 8aab41bdee1db2982a9477c4752e0c2b202d8fb3..30a5e93c46da59a038b9233e750c8a2957c9e726 100644 --- a/build-pipeline.yml +++ b/build-pipeline.yml @@ -339,16 +339,19 @@ workflow: - source build.env script: # 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 - .gitlab-ci/scripts/package_release.py --images-dir="${IMAGE_PATH}" --licenses-dir="${LICENSES_PATH}" --doc-dir=. - --output-dir=release + --output-dir=release/${RELEASE_NAME} + --release-version=${RELEASE_VERSION} - elif [[ "${PACKAGE_TYPE}" == "sdk" ]]; then - .gitlab-ci/scripts/package_release.py --sdk-dir="${SDK_PATH}" - --output-dir=release + --output-dir=release/${RELEASE_NAME} + --release-version=${RELEASE_VERSION} - fi cache: - key: ${CI_PIPELINE_ID}-${ASSOCIATED_BUILD_JOB} @@ -371,8 +374,6 @@ workflow: # We do this manually since we do not use GitLab's default artifact downloader - source package.env # Save dotenv data for next stage - - echo "RELEASE_NAME=${RELEASE_NAME}" > deploy.env - - echo "VERSION=${VERSION}" >> deploy.env - echo "MACHINE=${MACHINE}" >> deploy.env # Expand eventual nested variables contained within the DEPLOY_* variables # FIXME: For now we need a double 'eval' here due to a GitLab bug: @@ -444,6 +445,8 @@ workflow: rules: - when: manual allow_failure: true + needs: + - build-version script: - .gitlab-ci/scripts/collect_release_information.py --project $CI_PROJECT_ID @@ -457,12 +460,9 @@ workflow: - .gitlab-ci/scripts/render_jinja2_template.py --template="${PAGE_TEMPLATE}" > confluence-page.xml - - echo "RELEASE_NAME=${RELEASE_NAME}" >> confluence.env artifacts: paths: - confluence-page.xml - reports: - dotenv: confluence.env .publish-confluence-page: extends: @@ -471,6 +471,9 @@ workflow: rules: - when: manual allow_failure: true + needs: + - generate-confluence-page + - build-version script: - .gitlab-ci/scripts/confluence_create_or_update_page.py --username="${CONFLUENCE_USERNAME}" @@ -492,7 +495,8 @@ workflow: rules: - if: $ALPHAPLAN_STAGE == "true" 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 --machine="${MACHINE}" --release-name="${RELEASE_NAME}" diff --git a/scripts/package_release.py b/scripts/package_release.py index 92bc2b1bd0a9997622a300676714a58007c2b6a7..1b2b950ae59c757d65db64feae3ee846d9cf9b57 100755 --- a/scripts/package_release.py +++ b/scripts/package_release.py @@ -82,9 +82,14 @@ def main(): ) parser.add_argument( "--output-dir", - help="""Base directory name for output artifacts (can be specified multiple times)""", + help="""Directory name for output artifacts""", dest="output_dir", - action="append", + required=True, + ) + parser.add_argument( + "--release-version", + help="""Release version""", + dest="release_version", required=True, ) args, _ = parser.parse_known_args() @@ -114,24 +119,13 @@ def main(): buildvars = json.load(f) machine = buildvars["MACHINE"] - version = buildvars["DISTRO_VERSION"] sdkname = buildvars["TOOLCHAIN_OUTPUTNAME"] image_artifacts = buildvars["DISTRO_IMAGES"].split() artifacts = buildvars["DISTRO_RELEASE_ARTEFACTS"].split() artifacts.append("BUILD_SRCREVS.log") - # Set release name - if version.startswith("fngsystem"): - 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) + # Create output directory + os.makedirs(args.output_dir, exist_ok=True) # Package documentation files if args.doc_dir is not None: @@ -151,8 +145,7 @@ def main(): files.append(doc_md5sums_file) # Copy files - for output_dir in output_dirs: - copy_files(files, output_dir) + copy_files(files, args.output_dir) # Package image files if args.images_dir is not None: @@ -184,7 +177,7 @@ def main(): # Generate metadata file generate_metadata( machine, - version, + args.release_version, artifacts, sdkname, os.path.join(args.images_dir, "metainfo.json"), @@ -192,8 +185,7 @@ def main(): artifacts.append(os.path.join(args.images_dir, "metainfo.json")) # Copy files - for output_dir in output_dirs: - copy_files(artifacts, os.path.join(output_dir, machine)) + copy_files(artifacts, os.path.join(args.output_dir, machine)) # Package SDK if args.sdk_dir is not None: @@ -205,13 +197,10 @@ def main(): sdkfiles.append(sdk_md5sums_file) # Copy files - for output_dir in output_dirs: - copy_files(sdkfiles, os.path.join(output_dir, machine, "sdk")) + copy_files(sdkfiles, os.path.join(args.output_dir, machine, "sdk")) # Store pathes and other stuff in environment variable 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")