From 1bc683d5b4393e4205f45c7236c0e702182256f5 Mon Sep 17 00:00:00 2001 From: Tim Jaacks <tim.jaacks@garz-fricke.com> Date: Mon, 13 Jun 2022 10:39:32 +0200 Subject: [PATCH] Move python scripts to subfolder BCS 746-000808 --- .gitlab-ci.yml | 5 ++++- ci-test-manifest-integration.yml | 4 ++-- ci-test-manifest.yml | 12 ++++++------ common.yml | 2 +- manifest-build.yml | 2 +- manifest-integration.yml | 4 ++-- manifest-package.yml | 4 ++-- manifest.yml | 14 +++++++------- .../accept_merge_request.py | 0 alphaplan_fwr.py => scripts/alphaplan_fwr.py | 0 alphaplan_keys.py => scripts/alphaplan_keys.py | 0 .../changelog_generator.py | 0 .../check_if_integration_branch_is_up_to_date.py | 0 common.py => scripts/common.py | 0 convert_md2html.py => scripts/convert_md2html.py | 0 .../create_merge_request.py | 0 deploy_gitlab_ci.py => scripts/deploy_gitlab_ci.py | 0 .../generate_job_from_template.py | 0 .../generate_release_metadata.py | 0 .../get_current_revision_from_manifest.py | 0 .../get_manifest_projects.py | 0 .../get_merge_requests.py | 0 get_pipelines.py => scripts/get_pipelines.py | 0 .../integrate_into_manifest.py | 0 .../merge_into_manifest.py | 0 .../mirror_pipeline_result.py | 0 package_release.py => scripts/package_release.py | 0 pylintrc => scripts/pylintrc | 0 .../retrigger_mr_pipeline_job.py | 0 .../retrigger_mr_pipeline_jobs.py | 0 submit_test.py => scripts/submit_test.py | 0 trigger_pipeline.py => scripts/trigger_pipeline.py | 0 update_submodule.py => scripts/update_submodule.py | 0 33 files changed, 25 insertions(+), 22 deletions(-) rename accept_merge_request.py => scripts/accept_merge_request.py (100%) rename alphaplan_fwr.py => scripts/alphaplan_fwr.py (100%) rename alphaplan_keys.py => scripts/alphaplan_keys.py (100%) rename changelog_generator.py => scripts/changelog_generator.py (100%) rename check_if_integration_branch_is_up_to_date.py => scripts/check_if_integration_branch_is_up_to_date.py (100%) rename common.py => scripts/common.py (100%) rename convert_md2html.py => scripts/convert_md2html.py (100%) rename create_merge_request.py => scripts/create_merge_request.py (100%) rename deploy_gitlab_ci.py => scripts/deploy_gitlab_ci.py (100%) rename generate_job_from_template.py => scripts/generate_job_from_template.py (100%) rename generate_release_metadata.py => scripts/generate_release_metadata.py (100%) rename get_current_revision_from_manifest.py => scripts/get_current_revision_from_manifest.py (100%) rename get_manifest_projects.py => scripts/get_manifest_projects.py (100%) rename get_merge_requests.py => scripts/get_merge_requests.py (100%) rename get_pipelines.py => scripts/get_pipelines.py (100%) rename integrate_into_manifest.py => scripts/integrate_into_manifest.py (100%) rename merge_into_manifest.py => scripts/merge_into_manifest.py (100%) rename mirror_pipeline_result.py => scripts/mirror_pipeline_result.py (100%) rename package_release.py => scripts/package_release.py (100%) rename pylintrc => scripts/pylintrc (100%) rename retrigger_mr_pipeline_job.py => scripts/retrigger_mr_pipeline_job.py (100%) rename retrigger_mr_pipeline_jobs.py => scripts/retrigger_mr_pipeline_jobs.py (100%) rename submit_test.py => scripts/submit_test.py (100%) rename trigger_pipeline.py => scripts/trigger_pipeline.py (100%) rename update_submodule.py => scripts/update_submodule.py (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 117be92..d2b7d36 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,16 +41,19 @@ workflow: pylint: extends: .analyze script: + - cd scripts - pylint --rcfile=pylintrc *.py black: extends: .analyze script: + - cd scripts - black --diff --check *.py executable: extends: .analyze script: + - cd scripts - (! find ! -executable -name "*.py" -exec echo "not executable:"" {}" \; | grep .) yamllint: @@ -111,7 +114,7 @@ yamllint: MERGE: "" script: - cd ${CI_PROJECT_DIR} - - ./deploy_gitlab_ci.py + - scripts/deploy_gitlab_ci.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --manifest-project=${MANIFEST_PROJECT} diff --git a/ci-test-manifest-integration.yml b/ci-test-manifest-integration.yml index b49a45f..fa5e762 100644 --- a/ci-test-manifest-integration.yml +++ b/ci-test-manifest-integration.yml @@ -79,7 +79,7 @@ integrate: else MERGE_REQUEST="${CI_OPEN_MERGE_REQUESTS%%,*}"; fi - - .gitlab-ci/integrate_into_manifest.py + - .gitlab-ci/scripts/integrate_into_manifest.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --manifest-project=${MANIFEST_PROJECT} @@ -103,7 +103,7 @@ merge: - if: $CI_COMMIT_BRANCH == $MASTER_BRANCH_PROJECT script: - cd ${CI_PROJECT_DIR} - - .gitlab-ci/merge_into_manifest.py + - .gitlab-ci/scripts/merge_into_manifest.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --manifest-project=${MANIFEST_PROJECT} diff --git a/ci-test-manifest.yml b/ci-test-manifest.yml index 7907b4b..ef2a2eb 100644 --- a/ci-test-manifest.yml +++ b/ci-test-manifest.yml @@ -45,7 +45,7 @@ retrigger: - if: $CI_COMMIT_REF_NAME == $MASTER_BRANCH_MANIFEST && $CI_PIPELINE_SOURCE != "api" script: - PROJECTS=$( - .gitlab-ci/get_manifest_projects.py + .gitlab-ci/scripts/get_manifest_projects.py --manifest=default.xml --remote=ci-test ) @@ -55,7 +55,7 @@ retrigger: # Retrigger also project in SRCREV - echo -e "Projects:\n${PROJECTS}" - for PROJECT in ${PROJECTS}; do - .gitlab-ci/retrigger_mr_pipeline_jobs.py + .gitlab-ci/scripts/retrigger_mr_pipeline_jobs.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --project=${PROJECT} @@ -166,7 +166,7 @@ build:merge_request: script: - cd ${CI_PROJECT_DIR} # Get pipeline for merge request - - MR_PIPELINE=$(.gitlab-ci/get_pipelines.py + - MR_PIPELINE=$(.gitlab-ci/scripts/get_pipelines.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --project=${CI_PROJECT_PATH} @@ -174,14 +174,14 @@ build:merge_request: --ref=^${MASTER_BRANCH_MANIFEST} || true | head -1) # If pipeline exists, mirror its result - if [ ! -z "${MR_PIPELINE}" ]; then - .gitlab-ci/mirror_pipeline_result.py + .gitlab-ci/scripts/mirror_pipeline_result.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --project=${CI_PROJECT_PATH} --pipeline=${MR_PIPELINE} # If no pipeline found, trigger a new one on the master - else - .gitlab-ci/trigger_pipeline.py + .gitlab-ci/scripts/trigger_pipeline.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --project=${CI_PROJECT_PATH} @@ -269,7 +269,7 @@ test:fail: RELEASE="Yocto-dunfell-15.0/" INSTALLSCRIPT_ABS="$DEPLOYPATH_TEST/$RELEASE/$CI_PARAM_MACHINE/fng-install.sh" FNG_INSTALL_URL="${INSTALLSCRIPT_ABS#/*/}" - .gitlab-ci/submit_test.py \ + .gitlab-ci/scripts/submit_test.py \ --fng-install "${FNG_INSTALL_URL}" \ --name \ "Gitlab build test ${CI_PARAM_MACHINE} ${RELEASE} ${CI_PIPELINE_ID}" \ diff --git a/common.yml b/common.yml index 774d8a2..ea0ccf6 100644 --- a/common.yml +++ b/common.yml @@ -85,7 +85,7 @@ yamllint: - if [ -n "${parent_merge_request}" ];then PARENT_MR="--parent-merge-request=${parent_merge_request}"; fi - - .gitlab-ci/check_if_integration_branch_is_up_to_date.py + - .gitlab-ci/scripts/check_if_integration_branch_is_up_to_date.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --manifest-project=${MANIFEST_PROJECT} diff --git a/manifest-build.yml b/manifest-build.yml index 4b9d072..697dc69 100644 --- a/manifest-build.yml +++ b/manifest-build.yml @@ -126,6 +126,6 @@ variables: - |- # Copy artifacts to local server for automated tests echo "${LOGPREFIX} Copy files for automated tests using package_release" - .gitlab-ci/package_release.py \ + .gitlab-ci/scripts/package_release.py \ --images-dir="${BUILDPATH}/${IMAGEPATH}" \ --outputdir-local="${DEPLOYPATH_TEST}" diff --git a/manifest-integration.yml b/manifest-integration.yml index eb2fc5b..e3670a2 100644 --- a/manifest-integration.yml +++ b/manifest-integration.yml @@ -66,7 +66,7 @@ integrate: else MERGE_REQUEST="${CI_OPEN_MERGE_REQUESTS%%,*}"; fi - - .gitlab-ci/integrate_into_manifest.py + - .gitlab-ci/scripts/integrate_into_manifest.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --manifest-project=${MANIFEST_PROJECT} @@ -90,7 +90,7 @@ merge: - if: $CI_COMMIT_BRANCH == $MASTER_BRANCH_PROJECT script: - cd ${CI_PROJECT_DIR} - - .gitlab-ci/merge_into_manifest.py + - .gitlab-ci/scripts/merge_into_manifest.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --manifest-project=${MANIFEST_PROJECT} diff --git a/manifest-package.yml b/manifest-package.yml index 55b721f..3ac3edb 100644 --- a/manifest-package.yml +++ b/manifest-package.yml @@ -56,7 +56,7 @@ echo "${LOGPREFIX} outdir=${outdir}" # Check if the package_release script is available - script=".gitlab-ci/package_release.py" + script=".gitlab-ci/scripts/package_release.py" # Change script path if ? [ ! -x "${script}" ] && script=".repo/manifests/${script}" if [ ! -x "${script}" ]; then @@ -93,7 +93,7 @@ # - a release tag is set # - this is an image build and # - the files were deployed to local network (drive Z) - apscript=".gitlab-ci/alphaplan_fwr.py" + apscript=".gitlab-ci/scripts/alphaplan_fwr.py" echo "${LOGPREFIX} Check if AlphaPlan FWR articles need to be generated" if [ -n "$CI_COMMIT_TAG" ] && [ -d "${ARTIFACTS_IMAGE_PATH}" ] && \ [[ "${CI_PARAM_PACKAGE_FTP}" == "false" ]];then diff --git a/manifest.yml b/manifest.yml index 9a78952..52c32d3 100644 --- a/manifest.yml +++ b/manifest.yml @@ -54,7 +54,7 @@ retrigger: - if: $CI_COMMIT_REF_NAME == $MASTER_BRANCH_MANIFEST && $CI_PIPELINE_SOURCE != "api" script: - PROJECTS=$( - .gitlab-ci/get_manifest_projects.py + .gitlab-ci/scripts/get_manifest_projects.py --manifest=default.xml --remote=seco-ne --concat-namespaces @@ -65,7 +65,7 @@ retrigger: # Retrigger also project in SRCREV - echo -e "Projects:\n${PROJECTS}" - for PROJECT in ${PROJECTS}; do - .gitlab-ci/retrigger_mr_pipeline_jobs.py + .gitlab-ci/scripts/retrigger_mr_pipeline_jobs.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --project=${PROJECT} @@ -83,7 +83,7 @@ changelog: extends: .infrastructure rules: - if: $CI_COMMIT_REF_NAME != $MASTER_BRANCH_MANIFEST || $CI_PIPELINE_SOURCE == "api" - script: .gitlab-ci/changelog_generator.py + script: .gitlab-ci/scripts/changelog_generator.py --token=${GITBOT_TOKEN} --branch ${MASTER_BRANCH_MANIFEST} > changelog.md @@ -138,7 +138,7 @@ build:merge_request: script: - cd ${CI_PROJECT_DIR} # Get pipeline for merge request - - MR_PIPELINE=$(.gitlab-ci/get_pipelines.py + - MR_PIPELINE=$(.gitlab-ci/scripts/get_pipelines.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --project=${CI_PROJECT_PATH} @@ -146,14 +146,14 @@ build:merge_request: --ref=^${MASTER_BRANCH_MANIFEST} || true | head -1) # If pipeline exists, mirror its result - if [ ! -z "${MR_PIPELINE}" ]; then - .gitlab-ci/mirror_pipeline_result.py + .gitlab-ci/scripts/mirror_pipeline_result.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --project=${CI_PROJECT_PATH} --pipeline=${MR_PIPELINE} # If no pipeline found, trigger a new one on the master - else - .gitlab-ci/trigger_pipeline.py + .gitlab-ci/scripts/trigger_pipeline.py --gitlab-url=${CI_SERVER_URL} --token=${GITBOT_TOKEN} --project=${CI_PROJECT_PATH} @@ -210,7 +210,7 @@ build:merge_request: RELEASE=$(ls ${DEPLOYPATH_TEST}/) INSTALLSCRIPT_ABS="$DEPLOYPATH_TEST/$RELEASE/$CI_PARAM_MACHINE/fng-install.sh" FNG_INSTALL_URL="${ARTIFACTS_HOST_URL}/${INSTALLSCRIPT_ABS#/*/}" - .gitlab-ci/submit_test.py \ + .gitlab-ci/scripts/submit_test.py \ --fng-install "${FNG_INSTALL_URL}" \ --name \ "Gitlab build test ${CI_PARAM_MACHINE} ${RELEASE} ${CI_PIPELINE_ID}" \ diff --git a/accept_merge_request.py b/scripts/accept_merge_request.py similarity index 100% rename from accept_merge_request.py rename to scripts/accept_merge_request.py diff --git a/alphaplan_fwr.py b/scripts/alphaplan_fwr.py similarity index 100% rename from alphaplan_fwr.py rename to scripts/alphaplan_fwr.py diff --git a/alphaplan_keys.py b/scripts/alphaplan_keys.py similarity index 100% rename from alphaplan_keys.py rename to scripts/alphaplan_keys.py diff --git a/changelog_generator.py b/scripts/changelog_generator.py similarity index 100% rename from changelog_generator.py rename to scripts/changelog_generator.py diff --git a/check_if_integration_branch_is_up_to_date.py b/scripts/check_if_integration_branch_is_up_to_date.py similarity index 100% rename from check_if_integration_branch_is_up_to_date.py rename to scripts/check_if_integration_branch_is_up_to_date.py diff --git a/common.py b/scripts/common.py similarity index 100% rename from common.py rename to scripts/common.py diff --git a/convert_md2html.py b/scripts/convert_md2html.py similarity index 100% rename from convert_md2html.py rename to scripts/convert_md2html.py diff --git a/create_merge_request.py b/scripts/create_merge_request.py similarity index 100% rename from create_merge_request.py rename to scripts/create_merge_request.py diff --git a/deploy_gitlab_ci.py b/scripts/deploy_gitlab_ci.py similarity index 100% rename from deploy_gitlab_ci.py rename to scripts/deploy_gitlab_ci.py diff --git a/generate_job_from_template.py b/scripts/generate_job_from_template.py similarity index 100% rename from generate_job_from_template.py rename to scripts/generate_job_from_template.py diff --git a/generate_release_metadata.py b/scripts/generate_release_metadata.py similarity index 100% rename from generate_release_metadata.py rename to scripts/generate_release_metadata.py diff --git a/get_current_revision_from_manifest.py b/scripts/get_current_revision_from_manifest.py similarity index 100% rename from get_current_revision_from_manifest.py rename to scripts/get_current_revision_from_manifest.py diff --git a/get_manifest_projects.py b/scripts/get_manifest_projects.py similarity index 100% rename from get_manifest_projects.py rename to scripts/get_manifest_projects.py diff --git a/get_merge_requests.py b/scripts/get_merge_requests.py similarity index 100% rename from get_merge_requests.py rename to scripts/get_merge_requests.py diff --git a/get_pipelines.py b/scripts/get_pipelines.py similarity index 100% rename from get_pipelines.py rename to scripts/get_pipelines.py diff --git a/integrate_into_manifest.py b/scripts/integrate_into_manifest.py similarity index 100% rename from integrate_into_manifest.py rename to scripts/integrate_into_manifest.py diff --git a/merge_into_manifest.py b/scripts/merge_into_manifest.py similarity index 100% rename from merge_into_manifest.py rename to scripts/merge_into_manifest.py diff --git a/mirror_pipeline_result.py b/scripts/mirror_pipeline_result.py similarity index 100% rename from mirror_pipeline_result.py rename to scripts/mirror_pipeline_result.py diff --git a/package_release.py b/scripts/package_release.py similarity index 100% rename from package_release.py rename to scripts/package_release.py diff --git a/pylintrc b/scripts/pylintrc similarity index 100% rename from pylintrc rename to scripts/pylintrc diff --git a/retrigger_mr_pipeline_job.py b/scripts/retrigger_mr_pipeline_job.py similarity index 100% rename from retrigger_mr_pipeline_job.py rename to scripts/retrigger_mr_pipeline_job.py diff --git a/retrigger_mr_pipeline_jobs.py b/scripts/retrigger_mr_pipeline_jobs.py similarity index 100% rename from retrigger_mr_pipeline_jobs.py rename to scripts/retrigger_mr_pipeline_jobs.py diff --git a/submit_test.py b/scripts/submit_test.py similarity index 100% rename from submit_test.py rename to scripts/submit_test.py diff --git a/trigger_pipeline.py b/scripts/trigger_pipeline.py similarity index 100% rename from trigger_pipeline.py rename to scripts/trigger_pipeline.py diff --git a/update_submodule.py b/scripts/update_submodule.py similarity index 100% rename from update_submodule.py rename to scripts/update_submodule.py -- GitLab