From 51e1b02c19587ab383b9af6f18dd872df4abcb40 Mon Sep 17 00:00:00 2001 From: victordrose <137196064+victordrose@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:37:54 +0100 Subject: [PATCH 1/7] Update ci-pipeline.cfg --- scripts/pipelines/azure-devops/templates/ci/ci-pipeline.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pipelines/azure-devops/templates/ci/ci-pipeline.cfg b/scripts/pipelines/azure-devops/templates/ci/ci-pipeline.cfg index f7df4f945..549c750c8 100644 --- a/scripts/pipelines/azure-devops/templates/ci/ci-pipeline.cfg +++ b/scripts/pipelines/azure-devops/templates/ci/ci-pipeline.cfg @@ -1,7 +1,7 @@ # Mandatory flags. mandatoryFlags="$pipelineName,$localDirectory,$language,$sonarUrl,$sonarToken" # Path to the templates. -templatesPath=("scripts/pipelines/azure-devops/templates/build" "scripts/pipelines/azure-devops/templates/test" "scripts/pipelines/azure-devops/templates/quality" "scripts/pipelines/azure-devops/templates/ci") +templatesPath="scripts/pipelines/azure-devops/templates/ci" # Path to the common templates folder commonTemplatesPipelinePath=("scripts/pipelines/common/templates/build" "scripts/pipelines/common/templates/test" "scripts/pipelines/common/templates/quality") # YAML file name. From 0d3b1cbb251dbe5b98339fdaa85d746c1bc73f2e Mon Sep 17 00:00:00 2001 From: victordrose <137196064+victordrose@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:38:59 +0100 Subject: [PATCH 2/7] Update pipeline_generator.lib --- scripts/pipelines/common/pipeline_generator.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pipelines/common/pipeline_generator.lib b/scripts/pipelines/common/pipeline_generator.lib index eed2f0655..809eaeeed 100644 --- a/scripts/pipelines/common/pipeline_generator.lib +++ b/scripts/pipelines/common/pipeline_generator.lib @@ -213,7 +213,7 @@ function copyYAMLFile { # Generate pipeline YAML from template and put it in the repository. # We cannot use a variable in the definition of resource in the pipeline so we have to use a placeholder to replace it with the value we need commonEnvSubstList='${buildPipelineName} ${testPipelineName} ${qualityPipelineName} ${pipelineName} ${ciPipelineName} ${packagePipelineName}' - envsubst "${commonEnvSubstList} ${specificEnvSubstList}" < "${hangarPath}/${templatesPath[3]}/${yamlFile}.template" > "${localDirectory}/${pipelinePath}/${yamlFile}" + envsubst "${commonEnvSubstList} ${specificEnvSubstList}" < "${hangarPath}/${templatesPath}/${yamlFile}.template" > "${localDirectory}/${pipelinePath}/${yamlFile}" # Check if an extra artifact to store is supplied. if test -n "$artifactPath" From d25f4040019ae858c3331442d77cc9ae56dd7a60 Mon Sep 17 00:00:00 2001 From: victordrose <137196064+victordrose@users.noreply.github.com> Date: Wed, 20 Dec 2023 09:34:19 +0100 Subject: [PATCH 3/7] Update ci-pipeline.cfg deleted setup script file from azure --- scripts/pipelines/azure-devops/templates/ci/ci-pipeline.cfg | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/pipelines/azure-devops/templates/ci/ci-pipeline.cfg b/scripts/pipelines/azure-devops/templates/ci/ci-pipeline.cfg index 549c750c8..2f1bd9183 100644 --- a/scripts/pipelines/azure-devops/templates/ci/ci-pipeline.cfg +++ b/scripts/pipelines/azure-devops/templates/ci/ci-pipeline.cfg @@ -10,8 +10,7 @@ yamlFile="ci-pipeline.yml" scriptFile=("build.sh" "test.sh" "quality.sh") # Source branch. sourceBranch="feature/ci-pipeline" -# Setup Environment script -setupScriptFile="quality-setup-environment.sh" + # Function that copies the script to build, test and check quality of the application. function copyScript { @@ -26,7 +25,6 @@ function copyScript { fi # Copy the quality script. cp "${hangarPath}/${commonTemplatesPipelinePath[2]}/${language}-${scriptFile[2]}.template" "${localDirectory}/${scriptFilePath}/${scriptFile[2]}" - ! [ -f "${hangarPath}/${templatesPath[2]}/${language}-${setupScriptFile}" ] || cp "${hangarPath}/${templatesPath[2]}/${language}-${setupScriptFile}" "${localDirectory}/${scriptFilePath}/${setupScriptFile}" } # Function that adds the variables to be used in the pipeline. From d7694111321ee0aa2edf834243ed2b1d82377d93 Mon Sep 17 00:00:00 2001 From: victordrose <137196064+victordrose@users.noreply.github.com> Date: Wed, 20 Dec 2023 09:34:50 +0100 Subject: [PATCH 4/7] Delete scripts/pipelines/azure-devops/templates/quality/angular-quality-setup-environment.sh --- .../templates/quality/angular-quality-setup-environment.sh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100755 scripts/pipelines/azure-devops/templates/quality/angular-quality-setup-environment.sh diff --git a/scripts/pipelines/azure-devops/templates/quality/angular-quality-setup-environment.sh b/scripts/pipelines/azure-devops/templates/quality/angular-quality-setup-environment.sh deleted file mode 100755 index c25b2d3ec..000000000 --- a/scripts/pipelines/azure-devops/templates/quality/angular-quality-setup-environment.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -apt-get update -y -apt-get install -y openjdk-17-jre -apt-get install -y python \ No newline at end of file From dfee8e7501ba76efe137e36006b02f9422981c57 Mon Sep 17 00:00:00 2001 From: victordrose <137196064+victordrose@users.noreply.github.com> Date: Wed, 20 Dec 2023 09:35:01 +0100 Subject: [PATCH 5/7] Delete scripts/pipelines/azure-devops/templates/quality/node-quality-setup-environment.sh --- .../templates/quality/node-quality-setup-environment.sh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100755 scripts/pipelines/azure-devops/templates/quality/node-quality-setup-environment.sh diff --git a/scripts/pipelines/azure-devops/templates/quality/node-quality-setup-environment.sh b/scripts/pipelines/azure-devops/templates/quality/node-quality-setup-environment.sh deleted file mode 100755 index c25b2d3ec..000000000 --- a/scripts/pipelines/azure-devops/templates/quality/node-quality-setup-environment.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -apt-get update -y -apt-get install -y openjdk-17-jre -apt-get install -y python \ No newline at end of file From b11f4348e6eb0639bd8e33a279538890d817124e Mon Sep 17 00:00:00 2001 From: victordrose <137196064+victordrose@users.noreply.github.com> Date: Wed, 20 Dec 2023 09:44:19 +0100 Subject: [PATCH 6/7] Update python-build.sh with ./venv where necessary --- .../pipelines/common/templates/build/python-build.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/pipelines/common/templates/build/python-build.sh b/scripts/pipelines/common/templates/build/python-build.sh index 328f34b27..60ed86102 100755 --- a/scripts/pipelines/common/templates/build/python-build.sh +++ b/scripts/pipelines/common/templates/build/python-build.sh @@ -9,11 +9,11 @@ export PIP_NO_CACHE_DIR=1 export POETRY_VERSION=1.0.5 pip install "poetry==$POETRY_VERSION" -python -m venv /venv -poetry export --without-hashes -f requirements.txt | /venv/bin/pip install -r /dev/stdin +python -m venv ./venv +poetry export --without-hashes -f requirements.txt | ./venv/bin/pip install -r /dev/stdin # shellcheck source=/dev/null -. /venv/bin/activate +. ./venv/bin/activate mypy . -poetry build && /venv/bin/pip install dist/*.whl +poetry build && ./venv/bin/pip install dist/*.whl deactivate -mv /venv ./venv \ No newline at end of file +#mv /venv ./venv From 02739bce51e0e6278eb7becf4f4c3880b214d58d Mon Sep 17 00:00:00 2001 From: victordrose <137196064+victordrose@users.noreply.github.com> Date: Wed, 20 Dec 2023 10:43:03 +0100 Subject: [PATCH 7/7] Update python-test.sh --- scripts/pipelines/common/templates/test/python-test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/pipelines/common/templates/test/python-test.sh b/scripts/pipelines/common/templates/test/python-test.sh index 28e1ec401..24d4db9ef 100755 --- a/scripts/pipelines/common/templates/test/python-test.sh +++ b/scripts/pipelines/common/templates/test/python-test.sh @@ -1,9 +1,9 @@ #!/bin/bash set -e # shellcheck source=/dev/null -mv venv /venv +#mv venv ./venv # shellcheck source=/dev/null -. /venv/bin/activate +. ./venv/bin/activate coverage run -m unittest coverage report -coverage xml \ No newline at end of file +coverage xml