From 1242d2e9e515f41ed1da417c5773eab3cc7e8826 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Thu, 30 Nov 2023 11:25:12 +0100 Subject: [PATCH 01/21] modifcations complete pipeline --- .../templates/complete/complete-pipeline.cfg | 37 +++++++++++++++++ .../complete/complete-pipeline.yml.template | 41 +++++++++++++++++++ setup/Dockerfile | 9 ++-- 3 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 scripts/pipelines/github/templates/complete/complete-pipeline.cfg create mode 100644 scripts/pipelines/github/templates/complete/complete-pipeline.yml.template diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg new file mode 100644 index 000000000..675805ae1 --- /dev/null +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -0,0 +1,37 @@ +# Mandatory flags. +mandatoryFlags="$pipelineName,$localDirectory,$language," + +# Path to the templates. +templatesPath="scripts/pipelines/github/templates/complete-pipeline" + +# Path to the common templates folder +commonTemplatesPipelinePath="scripts/pipelines/common/templates/complete-pipeline" + +# YAML file name. +yamlFile="complete-pipeline.yml" + +# Script name. +scriptFile=["build.sh","test.sh"] + +# Source branch. +sourceBranch="feature/complete-pipeline" + +# Function that copies the script to build the application. +function copyScript { + # Copy the script. + cp "${hangarPath}/${commonTemplatesPipelinePath}/${language}-${scriptFile}" "${localDirectory}/${scriptFilePath}/${scriptFile}" +} + +# Function that adds the variables to be used in the pipeline. +function addPipelineVariables { + # if the user did not specify a custom target-directory + # we default to the language specific defaults + + if test -z $targetDirectory + then + setTargetDirectory + fi + + export targetDirectory + specificEnvSubstList='${targetDirectory}' +} diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template new file mode 100644 index 000000000..f7a5a81e5 --- /dev/null +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template @@ -0,0 +1,41 @@ +name: $pipelineName + +on: + workflow_call: + workflow_dispatch: + inputs: + targetPath: + description: 'Target directory of build process.' + required: false + type: string + default: '$targetDirectory' + +# mark to insert additional artifact input # + +env: + targetPath: ${{ github.event.inputs.targetPath || '$targetDirectory' }} + +# mark to insert additional artifact env var # + +jobs: + Build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v2 + + - name: Build the application + run: .github/workflows/scripts/build.sh + + - name: Archiving artifact + run: pwd;ls -l;tar -cvf ./BuildOutput.tar -C ${{ env.targetPath }}/ . + + - name: Publish Artifact + uses: actions/upload-artifact@v3 + with: + name: BuildOutput + path: ./BuildOutput.tar + +# mark to insert step for additional artifact # diff --git a/setup/Dockerfile b/setup/Dockerfile index 42dccbcd9..30bf1279d 100644 --- a/setup/Dockerfile +++ b/setup/Dockerfile @@ -8,9 +8,6 @@ FROM base as cli_install_gcloud WORKDIR /downloaded_assets # Install gcloud -RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | tee /usr/share/keyrings/cloud.google.gpg && \ - apt-get update -y && apt-get install google-cloud-sdk -y FROM cli_install_gcloud as cli_install_aws @@ -54,6 +51,12 @@ RUN curl -Lo ./firebase_tools https://firebase.tools/bin/linux/v11.16.0 && \ FROM cli_install_firebase as run_env +ARG KEY_ONE +ARG KEY_TWO + +ENV ssh_prv_key=$KEY_ONE +ENV ssh_pub_key=$KEY_TWO + WORKDIR /scripts ADD scripts . From f7ce0e7cbd3cbbc5aa0c3e2b465b3b18e1b82805 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Fri, 1 Dec 2023 09:40:46 +0100 Subject: [PATCH 02/21] Add modifications complete pipeline yml and cfg --- .../templates/complete/complete-pipeline.cfg | 4 +- .../complete/complete-pipeline.yml.template | 48 +++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index 675805ae1..54f06d417 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -2,10 +2,10 @@ mandatoryFlags="$pipelineName,$localDirectory,$language," # Path to the templates. -templatesPath="scripts/pipelines/github/templates/complete-pipeline" +templatesPath="scripts/pipelines/github/templates/complete" # Path to the common templates folder -commonTemplatesPipelinePath="scripts/pipelines/common/templates/complete-pipeline" +commonTemplatesPipelinePath="scripts/pipelines/common/templates/build" # YAML file name. yamlFile="complete-pipeline.yml" diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template index f7a5a81e5..9098bd48d 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template @@ -39,3 +39,51 @@ jobs: path: ./BuildOutput.tar # mark to insert step for additional artifact # + Test: + name: test + runs-on: ubuntu-latest + steps: + - name: Checkout repository code + uses: actions/checkout@v2 + + - name: Download artifact from build job (current workflow) + uses: actions/download-artifact@v2 + id: dowloadFromSamePipeline + continue-on-error: true + with: + name: BuildOutput + path: ${{ env.targetPath }} + + - name: Download artifact from build workflow + uses: dawidd6/action-download-artifact@v2 + id: downloadFromBuild + continue-on-error: true + if: ${{ steps.dowloadFromSamePipeline.outcome == 'failure' }} + with: + workflow: ${{ env.buildPipelineYamlName }} + commit: ${{ github.sha }} + check_artifacts: true + name: BuildOutput + path: ${{ env.targetPath }} + + - name: Download artifact from CI workflow + uses: dawidd6/action-download-artifact@v2 + if: ${{ steps.downloadFromBuild.outcome == 'failure' }} + with: + workflow: ${{ env.ciPipelineYamlName }} + commit: ${{ github.sha }} + check_artifacts: true + name: BuildOutput + path: ${{ env.targetPath }} + + - name: Extracting archive + run: tar -C ${{ env.targetPath }} -xf ${{ env.targetPath }}/BuildOutput.tar + + - name: Test + run: .github/workflows/scripts/test.sh + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v1 + if: always() + with: + files: '**/TEST-*.xml' From 69850f0269fae8ebfce30208b62aaa6aa89d2fcc Mon Sep 17 00:00:00 2001 From: cam19kab Date: Fri, 1 Dec 2023 11:24:59 +0100 Subject: [PATCH 03/21] modifications complete-pipeline common node-build --- scripts/pipelines/common/templates/complete/node-build.sh | 7 +++++++ .../github/templates/complete/complete-pipeline.cfg | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100755 scripts/pipelines/common/templates/complete/node-build.sh diff --git a/scripts/pipelines/common/templates/complete/node-build.sh b/scripts/pipelines/common/templates/complete/node-build.sh new file mode 100755 index 000000000..3b67bbac8 --- /dev/null +++ b/scripts/pipelines/common/templates/complete/node-build.sh @@ -0,0 +1,7 @@ +#!/bin/bash +npm install +npm install jest-junit +JEST_SUITE_NAME="jest tests" JEST_JUNIT_OUTPUT_NAME="TEST-junit.xml" JEST_JUNIT_OUTPUT_DIR="." npm run test -- --ci --coverage --reporters=default --reporters=jest-junit +mv ./coverage/lcov.info ./lcov.info +projectKey=$(python -c "from json import load; print(load(open('./package.json', 'r'))['name']);") +npx sonar-scanner -Dsonar.host.url="$SONAR_URL" -Dsonar.login="$SONAR_TOKEN" -Dsonar.projectKey=$projectKey -Dsonar.javascript.lcov.reportPaths=lcov.info -Dsonar.sources="." diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index 54f06d417..2ffd525e0 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -5,7 +5,7 @@ mandatoryFlags="$pipelineName,$localDirectory,$language," templatesPath="scripts/pipelines/github/templates/complete" # Path to the common templates folder -commonTemplatesPipelinePath="scripts/pipelines/common/templates/build" +commonTemplatesPipelinePath="scripts/pipelines/common/templates/complete" # YAML file name. yamlFile="complete-pipeline.yml" From 287aec034da6c83a4430960d521f8d6bd3ed4aec Mon Sep 17 00:00:00 2001 From: cam19kab Date: Fri, 1 Dec 2023 12:48:14 +0100 Subject: [PATCH 04/21] new changes file configurations --- .../pipelines/github/templates/complete/complete-pipeline.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index 2ffd525e0..70063e7d2 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -11,10 +11,10 @@ commonTemplatesPipelinePath="scripts/pipelines/common/templates/complete" yamlFile="complete-pipeline.yml" # Script name. -scriptFile=["build.sh","test.sh"] +scriptFile="build.sh" # Source branch. -sourceBranch="feature/complete-pipeline" +sourceBranch="feature/complete-pipeline1" # Function that copies the script to build the application. function copyScript { From 5e4fb3ae5f9802521fa31bc70466994ed208e248 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Mon, 4 Dec 2023 13:45:57 +0100 Subject: [PATCH 05/21] changes complete cfg and file sh --- .../common/templates/complete/node-build.sh | 7 ----- .../templates/complete/node-complete.sh | 7 +++++ .../templates/complete/complete-pipeline.cfg | 2 +- .../complete/complete-pipeline.yml.template | 30 ------------------- 4 files changed, 8 insertions(+), 38 deletions(-) delete mode 100755 scripts/pipelines/common/templates/complete/node-build.sh create mode 100755 scripts/pipelines/common/templates/complete/node-complete.sh diff --git a/scripts/pipelines/common/templates/complete/node-build.sh b/scripts/pipelines/common/templates/complete/node-build.sh deleted file mode 100755 index 3b67bbac8..000000000 --- a/scripts/pipelines/common/templates/complete/node-build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -npm install -npm install jest-junit -JEST_SUITE_NAME="jest tests" JEST_JUNIT_OUTPUT_NAME="TEST-junit.xml" JEST_JUNIT_OUTPUT_DIR="." npm run test -- --ci --coverage --reporters=default --reporters=jest-junit -mv ./coverage/lcov.info ./lcov.info -projectKey=$(python -c "from json import load; print(load(open('./package.json', 'r'))['name']);") -npx sonar-scanner -Dsonar.host.url="$SONAR_URL" -Dsonar.login="$SONAR_TOKEN" -Dsonar.projectKey=$projectKey -Dsonar.javascript.lcov.reportPaths=lcov.info -Dsonar.sources="." diff --git a/scripts/pipelines/common/templates/complete/node-complete.sh b/scripts/pipelines/common/templates/complete/node-complete.sh new file mode 100755 index 000000000..b8d6b278c --- /dev/null +++ b/scripts/pipelines/common/templates/complete/node-complete.sh @@ -0,0 +1,7 @@ +#!/bin/bash +npm install +npm install jest-junit +JEST_SUITE_NAME="jest tests" JEST_JUNIT_OUTPUT_NAME="TEST-junit.xml" JEST_JUNIT_OUTPUT_DIR="." npm run test -- --ci --coverage --reporters=default --reporters=jest-junit +mv ./coverage/lcov.info ./lcov.info +#projectKey=$(python -c "from json import load; print(load(open('./package.json', 'r'))['name']);") +#npx sonar-scanner -Dsonar.host.url="$SONAR_URL" -Dsonar.login="$SONAR_TOKEN" -Dsonar.projectKey=$projectKey -Dsonar.javascript.lcov.reportPaths=lcov.info -Dsonar.sources="." diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index 70063e7d2..e882986dd 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -11,7 +11,7 @@ commonTemplatesPipelinePath="scripts/pipelines/common/templates/complete" yamlFile="complete-pipeline.yml" # Script name. -scriptFile="build.sh" +scriptFile="complete.sh" # Source branch. sourceBranch="feature/complete-pipeline1" diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template index 9098bd48d..1fc4668e4 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template @@ -46,36 +46,6 @@ jobs: - name: Checkout repository code uses: actions/checkout@v2 - - name: Download artifact from build job (current workflow) - uses: actions/download-artifact@v2 - id: dowloadFromSamePipeline - continue-on-error: true - with: - name: BuildOutput - path: ${{ env.targetPath }} - - - name: Download artifact from build workflow - uses: dawidd6/action-download-artifact@v2 - id: downloadFromBuild - continue-on-error: true - if: ${{ steps.dowloadFromSamePipeline.outcome == 'failure' }} - with: - workflow: ${{ env.buildPipelineYamlName }} - commit: ${{ github.sha }} - check_artifacts: true - name: BuildOutput - path: ${{ env.targetPath }} - - - name: Download artifact from CI workflow - uses: dawidd6/action-download-artifact@v2 - if: ${{ steps.downloadFromBuild.outcome == 'failure' }} - with: - workflow: ${{ env.ciPipelineYamlName }} - commit: ${{ github.sha }} - check_artifacts: true - name: BuildOutput - path: ${{ env.targetPath }} - - name: Extracting archive run: tar -C ${{ env.targetPath }} -xf ${{ env.targetPath }}/BuildOutput.tar From 7093bcd075b0d9563b7f8d6c41c49c991753a7b2 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 5 Dec 2023 08:57:34 +0100 Subject: [PATCH 06/21] changes complete pipeline yml template --- .../github/templates/complete/complete-pipeline.yml.template | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template index 1fc4668e4..59acbb0db 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template @@ -46,9 +46,6 @@ jobs: - name: Checkout repository code uses: actions/checkout@v2 - - name: Extracting archive - run: tar -C ${{ env.targetPath }} -xf ${{ env.targetPath }}/BuildOutput.tar - - name: Test run: .github/workflows/scripts/test.sh From d170d1d9d3fbf508db52504f0f077cfa23e53a51 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 5 Dec 2023 09:29:50 +0100 Subject: [PATCH 07/21] add modifications build-test-quality --- .../templates/complete/complete-pipeline.cfg | 17 ++++++++++++++++- .../complete/complete-pipeline.yml.template | 14 ++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index e882986dd..8df892b79 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -14,7 +14,7 @@ yamlFile="complete-pipeline.yml" scriptFile="complete.sh" # Source branch. -sourceBranch="feature/complete-pipeline1" +sourceBranch="feature/build-test-quality" # Function that copies the script to build the application. function copyScript { @@ -34,4 +34,19 @@ function addPipelineVariables { export targetDirectory specificEnvSubstList='${targetDirectory}' + + + repoURL=$(git config --get remote.origin.url) + repoNameWithGit="${repoURL/https:\/\/github.com\/}" + repoName="${repoNameWithGit/.git}" + gh secret set SONARQUBE_TOKEN -a actions -b "$sonarToken" -R "$repoName" + + if test -z $targetDirectory + then + setTargetDirectory + fi + + export sonarUrl + export targetDirectory + specificEnvSubstList='${sonarUrl} ${targetDirectory}' } diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template index 59acbb0db..fa623e0c9 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template @@ -54,3 +54,17 @@ jobs: if: always() with: files: '**/TEST-*.xml' + + Quality: + name: SonarQube analysis + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v2 + + - name: SonarQube analysis + run: .github/workflows/scripts/quality.sh + env: + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + SONAR_URL: ${{ env.sonarUrl }} + PROJECT_PATH: . From d4a4f3a81e51f9a0f77e89bd7649f42109284c2f Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 5 Dec 2023 09:34:14 +0100 Subject: [PATCH 08/21] new changes commit quality and test --- .../github/templates/complete/complete-pipeline.yml.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template index fa623e0c9..1a0894c3e 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template @@ -40,7 +40,7 @@ jobs: # mark to insert step for additional artifact # Test: - name: test + name: Test runs-on: ubuntu-latest steps: - name: Checkout repository code @@ -61,7 +61,7 @@ jobs: steps: - name: Checkout the repository uses: actions/checkout@v2 - + - name: SonarQube analysis run: .github/workflows/scripts/quality.sh env: From 546c2ea51aa5bc9b5013c4292ee8ac32d4c497c4 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 5 Dec 2023 12:31:02 +0100 Subject: [PATCH 09/21] changes cfg complete-pipeline --- .../github/templates/complete/complete-pipeline.cfg | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index 8df892b79..beb1fdcf3 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -11,7 +11,9 @@ commonTemplatesPipelinePath="scripts/pipelines/common/templates/complete" yamlFile="complete-pipeline.yml" # Script name. -scriptFile="complete.sh" +scriptFileBuild="build.sh" +scriptFileTest="test.sh" +scriptFileQuality="quality.sh" # Source branch. sourceBranch="feature/build-test-quality" @@ -19,7 +21,9 @@ sourceBranch="feature/build-test-quality" # Function that copies the script to build the application. function copyScript { # Copy the script. - cp "${hangarPath}/${commonTemplatesPipelinePath}/${language}-${scriptFile}" "${localDirectory}/${scriptFilePath}/${scriptFile}" + cp "${hangarPath}/${commonTemplatesPipelinePath}/${language}-${scriptFileBuild}" "${localDirectory}/${scriptFilePath}/${scriptFileBuild}" + cp "${hangarPath}/${commonTemplatesPipelinePath}/${language}-${scriptFileTest}" "${localDirectory}/${scriptFilePath}/${scriptFileTest}" + cp "${hangarPath}/${commonTemplatesPipelinePath}/${language}-${scriptFileQuality}" "${localDirectory}/${scriptFilePath}/${scriptFileQuality}" } # Function that adds the variables to be used in the pipeline. From b5a9c2f403864847cb2a12b890969047eb653f17 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 5 Dec 2023 12:49:54 +0100 Subject: [PATCH 10/21] modifications build-test-quality --- .../github/templates/complete/complete-pipeline.cfg | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index beb1fdcf3..299244b2b 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -5,12 +5,15 @@ mandatoryFlags="$pipelineName,$localDirectory,$language," templatesPath="scripts/pipelines/github/templates/complete" # Path to the common templates folder -commonTemplatesPipelinePath="scripts/pipelines/common/templates/complete" +commonTemplatesPipelinePathb="scripts/pipelines/common/templates/build" +commonTemplatesPipelinePatht="scripts/pipelines/common/templates/test" +commonTemplatesPipelinePathq="scripts/pipelines/common/templates/quality" # YAML file name. yamlFile="complete-pipeline.yml" # Script name. +scriptFilePath="complete.sh" scriptFileBuild="build.sh" scriptFileTest="test.sh" scriptFileQuality="quality.sh" @@ -21,9 +24,9 @@ sourceBranch="feature/build-test-quality" # Function that copies the script to build the application. function copyScript { # Copy the script. - cp "${hangarPath}/${commonTemplatesPipelinePath}/${language}-${scriptFileBuild}" "${localDirectory}/${scriptFilePath}/${scriptFileBuild}" - cp "${hangarPath}/${commonTemplatesPipelinePath}/${language}-${scriptFileTest}" "${localDirectory}/${scriptFilePath}/${scriptFileTest}" - cp "${hangarPath}/${commonTemplatesPipelinePath}/${language}-${scriptFileQuality}" "${localDirectory}/${scriptFilePath}/${scriptFileQuality}" + cp "${hangarPath}/${commonTemplatesPipelinePathb}/${language}-${scriptFileBuild}" "${localDirectory}/${scriptFilePath}/${scriptFilePath}" + cp "${hangarPath}/${commonTemplatesPipelinePatht}/${language}-${scriptFileTest}" "${localDirectory}/${scriptFilePath}/${scriptFilePath}" + cp "${hangarPath}/${commonTemplatesPipelinePathq}/${language}-${scriptFileQuality}" "${localDirectory}/${scriptFilePath}/${scriptFilepath}" } # Function that adds the variables to be used in the pipeline. From 02231eff6e1b398dcc3c3b1eaf883b1735a4b20b Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 5 Dec 2023 12:57:25 +0100 Subject: [PATCH 11/21] changes configuration template --- .../pipelines/github/templates/complete/complete-pipeline.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index 299244b2b..6f7d31e6f 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -16,7 +16,7 @@ yamlFile="complete-pipeline.yml" scriptFilePath="complete.sh" scriptFileBuild="build.sh" scriptFileTest="test.sh" -scriptFileQuality="quality.sh" +scriptFileQuality="quality.sh.template" # Source branch. sourceBranch="feature/build-test-quality" From b280876f24b42bc71a999c288ecae3026e663610 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 5 Dec 2023 13:15:22 +0100 Subject: [PATCH 12/21] changes configurations --- .../pipelines/github/templates/complete/complete-pipeline.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index 6f7d31e6f..e3a07f75a 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -26,7 +26,7 @@ function copyScript { # Copy the script. cp "${hangarPath}/${commonTemplatesPipelinePathb}/${language}-${scriptFileBuild}" "${localDirectory}/${scriptFilePath}/${scriptFilePath}" cp "${hangarPath}/${commonTemplatesPipelinePatht}/${language}-${scriptFileTest}" "${localDirectory}/${scriptFilePath}/${scriptFilePath}" - cp "${hangarPath}/${commonTemplatesPipelinePathq}/${language}-${scriptFileQuality}" "${localDirectory}/${scriptFilePath}/${scriptFilepath}" + cp "${hangarPath}/${commonTemplatesPipelinePathq}/${language}-${scriptFileQuality}" "${localDirectory}/${scriptFilePath}/${scriptFilePath}" } # Function that adds the variables to be used in the pipeline. From 77cd50ee0d5bc3fba7f1c5fd98113a31f1dc4dcd Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 5 Dec 2023 13:46:35 +0100 Subject: [PATCH 13/21] changes apply path and files --- .../templates/complete/complete-pipeline.cfg | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index e3a07f75a..397435702 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -1,22 +1,18 @@ # Mandatory flags. -mandatoryFlags="$pipelineName,$localDirectory,$language," +mandatoryFlags="$pipelineName,$localDirectory,$language,$sonarUrl,$sonarToken," # Path to the templates. templatesPath="scripts/pipelines/github/templates/complete" # Path to the common templates folder -commonTemplatesPipelinePathb="scripts/pipelines/common/templates/build" -commonTemplatesPipelinePatht="scripts/pipelines/common/templates/test" -commonTemplatesPipelinePathq="scripts/pipelines/common/templates/quality" +commonTemplatesPipelinePath=("scripts/pipelines/common/templates/build" "scripts/pipelines/common/templates/test" "scripts/pipelines/common/templates/quality") # YAML file name. yamlFile="complete-pipeline.yml" # Script name. -scriptFilePath="complete.sh" -scriptFileBuild="build.sh" -scriptFileTest="test.sh" -scriptFileQuality="quality.sh.template" +scriptFilePath=("build.sh" "test.sh" "quality.sh.template") + # Source branch. sourceBranch="feature/build-test-quality" @@ -24,9 +20,9 @@ sourceBranch="feature/build-test-quality" # Function that copies the script to build the application. function copyScript { # Copy the script. - cp "${hangarPath}/${commonTemplatesPipelinePathb}/${language}-${scriptFileBuild}" "${localDirectory}/${scriptFilePath}/${scriptFilePath}" - cp "${hangarPath}/${commonTemplatesPipelinePatht}/${language}-${scriptFileTest}" "${localDirectory}/${scriptFilePath}/${scriptFilePath}" - cp "${hangarPath}/${commonTemplatesPipelinePathq}/${language}-${scriptFileQuality}" "${localDirectory}/${scriptFilePath}/${scriptFilePath}" + cp "${hangarPath}/${commonTemplatesPipelinePath[0]}/${language}-${scriptFile[0]}" "${localDirectory}/${scriptFilePath}/${scriptFile[0]}" + cp "${hangarPath}/${commonTemplatesPipelinePath[1]}/${language}-${scriptFile[1]}" "${localDirectory}/${scriptFilePath}/${scriptFile[1]}" + cp "${hangarPath}/${commonTemplatesPipelinePath[2]}/${language}-${scriptFile[2]}" "${localDirectory}/${scriptFilePath}/${scriptFile[2]}" } # Function that adds the variables to be used in the pipeline. From 6a1b3df05b676729eb29aef8210ede818d11b020 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 5 Dec 2023 16:00:19 +0100 Subject: [PATCH 14/21] changes scripFile cfg --- .../pipelines/github/templates/complete/complete-pipeline.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index 397435702..2670f079b 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -11,7 +11,7 @@ commonTemplatesPipelinePath=("scripts/pipelines/common/templates/build" "scripts yamlFile="complete-pipeline.yml" # Script name. -scriptFilePath=("build.sh" "test.sh" "quality.sh.template") +scriptFile=("build.sh" "test.sh" "quality.sh.template") # Source branch. From 2ad03aa6d741e4e5fb837e766c92cb58c517e4f5 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 5 Dec 2023 16:13:02 +0100 Subject: [PATCH 15/21] changes in cfg and yml quality sonar --- .../pipelines/github/templates/complete/complete-pipeline.cfg | 2 +- .../github/templates/complete/complete-pipeline.yml.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index 2670f079b..a129fc91e 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -15,7 +15,7 @@ scriptFile=("build.sh" "test.sh" "quality.sh.template") # Source branch. -sourceBranch="feature/build-test-quality" +sourceBranch="feature/ci-complete" # Function that copies the script to build the application. function copyScript { diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template index 1a0894c3e..f2200f27d 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template @@ -63,7 +63,7 @@ jobs: uses: actions/checkout@v2 - name: SonarQube analysis - run: .github/workflows/scripts/quality.sh + run: .github/workflows/scripts/quality.sh.template env: SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} SONAR_URL: ${{ env.sonarUrl }} From 6df0c66e28374677214684d9d60803b319ad63eb Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 5 Dec 2023 16:41:48 +0100 Subject: [PATCH 16/21] changes yml template sonar env variables --- .../templates/complete/complete-pipeline.yml.template | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template index f2200f27d..f34cb64e4 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template @@ -4,6 +4,12 @@ on: workflow_call: workflow_dispatch: inputs: + sonarUrl: + required: false + default: $sonarUrl + sonarToken: + required: false + default: targetPath: description: 'Target directory of build process.' required: false @@ -14,6 +20,8 @@ on: env: targetPath: ${{ github.event.inputs.targetPath || '$targetDirectory' }} + sonarUrl: ${{ github.event.inputs.sonarUrl || '$sonarUrl' }} + sonarToken: ${{ github.event.inputs.sonarToken || secrets.SONARQUBE_TOKEN }} # mark to insert additional artifact env var # From dd47ab55399b74f7b9e6df26d128f47d8dc23f1d Mon Sep 17 00:00:00 2001 From: cam19kab Date: Mon, 11 Dec 2023 15:24:20 +0100 Subject: [PATCH 17/21] fix: modifications documentation and configuration --- .../setup-complete-pipeline.asciidoc | 94 +++++++++++++++++++ .../github/setup-complete-pipeline.asciidoc | 8 ++ .../templates/complete/complete-pipeline.cfg | 4 + 3 files changed, 106 insertions(+) create mode 100644 documentation/src/common_templates/setup-complete-pipeline.asciidoc create mode 100644 documentation/src/github/setup-complete-pipeline.asciidoc diff --git a/documentation/src/common_templates/setup-complete-pipeline.asciidoc b/documentation/src/common_templates/setup-complete-pipeline.asciidoc new file mode 100644 index 000000000..76e101b41 --- /dev/null +++ b/documentation/src/common_templates/setup-complete-pipeline.asciidoc @@ -0,0 +1,94 @@ += Setting up a Complete Pipeline {pipeline_type} on {provider} + +In this section we will create a complete {pipeline_type} for analyzing project code with SonarQube. {trigger_sentence}, and consumes the artifact produced by the build {pipeline_type}. + +The creation of this {pipeline_type2} will follow the project workflow, so a new branch named `feature/ci-pipeline` will be created and the YAML file for the {pipeline_type} will be pushed to it. + +ifndef::no-PR-or-MR[] +Then, a Pull Request (PR) will be created in order to merge the new branch into the appropriate branch (provided in `-b` flag). The PR will be automatically merged if the repository policies are met. If the merge is not possible, either the PR URL will be shown as output, or it will be opened in your web browser if using `-w` flag. + +endif::[] +ifdef::no-PR-or-MR[] +Then, the new branch will be merged into the appropriate branch (provided in `-b` flag). + +endif::[] +The script located at `/scripts/pipelines/{path_provider}/pipeline_generator.sh` will automatically create this new branch, create a quality {pipeline_type} based on a YAML template appropriate for the project programming language or framework, create the Pull Request, and if it is possible, merge this new branch into the specified branch. + +ifdef::extra_sentence_ci[] +{extra_sentence_ci} + +endif::[] +== Prerequisites + +* This script will commit and push the corresponding YAML template into your repository, so please be sure your local repository is up-to-date (i.e you have pulled the latest changes with `git pull`). +* Generate a SonarQube https://docs.sonarqube.org/latest/user-guide/user-token/[token] (just follow the section "Generating a token"). + +== Creating the {pipeline_type} using provided script + +=== Usage +[subs=attributes+] +``` +pipeline_generator.sh \ + -c \ + -n <{pipeline_type} name> \ + -l \ + --sonar-url \ + --sonar-token \ + -d \ +ifdef::build-pipeline[ --build-pipeline-name \] +ifdef::test-pipeline[ --test-pipeline-name \] +ifeval::["{provider}" == "Google Cloud"] + [--test-pipeline-name ] \ +endif::[] + [-b ] \ +ifndef::no-PR-or-MR[ [-w]] +ifeval::["{provider}" == "Google Cloud"] + [-m ] + [--env-vars ] + [--secret-vars ] +endif::[] +``` + + +NOTE: The config file for the complete {pipeline_type} is located at `/scripts/pipelines/{path_provider}/templates/complete/complete-pipeline.cfg`. + +=== Flags +[subs=attributes+] +``` +-c, --config-file [Required] Configuration file containing {pipeline_type} definition. +-n, --pipeline-name [Required] Name that will be set to the {pipeline_type}. +-l, --language [Required] Language or framework of the project. + --sonar-url [Required] SonarQube URL. + --sonar-token [Required] SonarQube token. +-d, --local-directory [Required] Local directory of your project. +ifdef::build-pipeline[ --build-pipeline-name [Required] Build {pipeline_type} name.] +ifdef::test-pipeline[ --test-pipeline-name [Required] Test {pipeline_type} name.] +ifeval::["{provider}" == "Google Cloud"] + --test-pipeline-name Test {pipeline_type} name. +endif::[] +-b, --target-branch Name of the branch to which the Pull Request will target. PR is not created if the flag is not provided. +ifndef::no-PR-or-MR[-w Open the Pull Request on the web browser if it cannot be automatically merged. Requires -b flag.] +ifeval::["{provider}" == "Google Cloud"] +-m, --machine-type Machine type for {pipeline_type} runner. Accepted values: E2_HIGHCPU_8, E2_HIGHCPU_32, N1_HIGHCPU_8, N1_HIGHCPU_32. + --env-vars List of environment variables to be made available in pipeline. Syntax: "var1=val1 var2=val2 ...". + --secret-vars List of environment variables (saved as secrets in Secret Manager) to be made available in pipeline. Syntax: "var1=val1 var2=val2 ...". +endif::[] +``` + +=== Examples + +==== Quarkus project + +[subs=attributes+] +``` +./pipeline_generator.sh -c ./templates/quality/quality-pipeline.cfg -n quarkus-project-quality -l quarkus --sonar-url http://1.2.3.4:9000 --sonar-token 6ce666 -d C:/Users/$USERNAME/Desktop/quarkus-project {extra_args_quarkus} -b develop {openBrowserFlag} +``` + +==== Node.js project + +[subs=attributes+] +``` +./pipeline_generator.sh -c ./templates/complete/complete-pipeline.cfg -n node-project -l node --sonar-url http://1.2.3.4:9000 --sonar-token 6ce66 -d C:/Users/$USERNAME/Desktop/node-project {extra_args_quarkus} -b develop {openBrowserFlag} +``` + + diff --git a/documentation/src/github/setup-complete-pipeline.asciidoc b/documentation/src/github/setup-complete-pipeline.asciidoc new file mode 100644 index 000000000..7d920ce1d --- /dev/null +++ b/documentation/src/github/setup-complete-pipeline.asciidoc @@ -0,0 +1,8 @@ +:provider: GitHub +:pipeline_type: workflow +:trigger_sentence: This workflow will be configured to be executed as a job inside a CI workflow +:pipeline_type2: GitHub action +:path_provider: github +:extra_sentence_ci: Please note that this workflow, although manually triggerable, is designed to be executed as part of a CI workflow, which you can create following this xref:./setup-ci-pipeline.asciidoc[guide]. +:openBrowserFlag: -w +include::../common_templates/setup-complete-pipeline.asciidoc[] diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index a129fc91e..ee697179c 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -19,6 +19,10 @@ sourceBranch="feature/ci-complete" # Function that copies the script to build the application. function copyScript { + if [[ $language == "quarkus"* ]] + then + language="quarkus" + fi # Copy the script. cp "${hangarPath}/${commonTemplatesPipelinePath[0]}/${language}-${scriptFile[0]}" "${localDirectory}/${scriptFilePath}/${scriptFile[0]}" cp "${hangarPath}/${commonTemplatesPipelinePath[1]}/${language}-${scriptFile[1]}" "${localDirectory}/${scriptFilePath}/${scriptFile[1]}" From 86a74e5bcf868fc93ed995f1fd183a76e76c4534 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Mon, 11 Dec 2023 16:30:43 +0100 Subject: [PATCH 18/21] fix: new modifications quarkus-quality.sh --- .../common/templates/quality/quarkus-quality.sh.template | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/pipelines/common/templates/quality/quarkus-quality.sh.template b/scripts/pipelines/common/templates/quality/quarkus-quality.sh.template index 775be2a43..842049768 100755 --- a/scripts/pipelines/common/templates/quality/quarkus-quality.sh.template +++ b/scripts/pipelines/common/templates/quality/quarkus-quality.sh.template @@ -1,2 +1,3 @@ #!/bin/bash +ls -l $PROJECT_PATH/target/classes mvn sonar:sonar -B -Dsonar.host.url="$SONAR_URL" -Dsonar.login="$SONAR_TOKEN" -Dsonar.java.binaries=$PROJECT_PATH/target/classes From d78739c52ed03c60369d86b2fd10460029a438d5 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 12 Dec 2023 11:44:33 +0100 Subject: [PATCH 19/21] fix: changes configuration and yml --- .../templates/complete/complete-pipeline.cfg | 5 ----- .../complete/complete-pipeline.yml.template | 18 +++++++++--------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg index ee697179c..2ba510266 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.cfg +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.cfg @@ -48,11 +48,6 @@ function addPipelineVariables { repoName="${repoNameWithGit/.git}" gh secret set SONARQUBE_TOKEN -a actions -b "$sonarToken" -R "$repoName" - if test -z $targetDirectory - then - setTargetDirectory - fi - export sonarUrl export targetDirectory specificEnvSubstList='${sonarUrl} ${targetDirectory}' diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template index f34cb64e4..029b0c6f1 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template @@ -46,11 +46,11 @@ jobs: name: BuildOutput path: ./BuildOutput.tar -# mark to insert step for additional artifact # - Test: - name: Test - runs-on: ubuntu-latest - steps: +# # mark to insert step for additional artifact # +# Test: +# name: Test +# runs-on: ubuntu-latest +# steps: - name: Checkout repository code uses: actions/checkout@v2 @@ -63,10 +63,10 @@ jobs: with: files: '**/TEST-*.xml' - Quality: - name: SonarQube analysis - runs-on: ubuntu-latest - steps: + # Quality: + # name: SonarQube analysis + # runs-on: ubuntu-latest + # steps: - name: Checkout the repository uses: actions/checkout@v2 From 949ab611ee7e4fed5784f859fb3a0965f456f405 Mon Sep 17 00:00:00 2001 From: cam19kab Date: Tue, 12 Dec 2023 12:24:55 +0100 Subject: [PATCH 20/21] fix: changes complete yml --- .../github/templates/complete/complete-pipeline.yml.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template index 029b0c6f1..6abdaa52f 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template @@ -67,8 +67,8 @@ jobs: # name: SonarQube analysis # runs-on: ubuntu-latest # steps: - - name: Checkout the repository - uses: actions/checkout@v2 + # - name: Checkout the repository + # uses: actions/checkout@v2 - name: SonarQube analysis run: .github/workflows/scripts/quality.sh.template From 3523aae2bdd09c50be0ed342b1c2e1fc835cd8be Mon Sep 17 00:00:00 2001 From: cam19kab Date: Wed, 13 Dec 2023 15:53:47 +0100 Subject: [PATCH 21/21] fix: doc and pipeline yml delete comments --- .../github/setup-complete-pipeline.asciidoc | 74 +++++++++++++++++++ .../complete/complete-pipeline.yml.template | 12 --- 2 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 documentation/github/setup-complete-pipeline.asciidoc diff --git a/documentation/github/setup-complete-pipeline.asciidoc b/documentation/github/setup-complete-pipeline.asciidoc new file mode 100644 index 000000000..b9024afbe --- /dev/null +++ b/documentation/github/setup-complete-pipeline.asciidoc @@ -0,0 +1,74 @@ +:provider: GitHub +:pipeline_type: workflow +:trigger_sentence: This workflow will be configured to be executed as a job inside a CI workflow +:pipeline_type2: GitHub action +:path_provider: github +:extra_sentence_ci: Please note that this workflow, although manually triggerable, is designed to be executed as part of a CI workflow, which you can create following this xref:./setup-ci-pipeline.asciidoc[guide]. +:openBrowserFlag: -w += Setting up a Complete {pipeline_type} on {provider} + +In this section we will create a complete {pipeline_type} for compiling project code. {trigger_sentence}, regardless of which branch it is made on. + +The creation of the {pipeline_type2} will follow the project workflow, so a new branch named `feature/complete-pipeline` will be created and the YAML file for the {pipeline_type} will be pushed to it. + +Then, a Pull Request (PR) will be created in order to merge the new branch into the appropriate branch (provided in `-b` flag). The PR will be automatically merged if the repository policies are met. If the merge is not possible, either the PR URL will be shown as output, or it will be opened in your web browser if using `-w` flag. + +The script located at `/scripts/pipelines/{path_provider}/pipeline_generator.sh` will automatically create this new branch, create a complete {pipeline_type} based on a YAML template appropriate for the project programming language or framework, create the Pull Request and, if it is possible, merge this new branch into the specified branch. + +{extra_sentence_ci} + +== Prerequisites + +This script will commit and push the corresponding YAML template into your repository, so please be sure your local repository is up-to-date (i.e you have pulled latest changes with `git pull`). + +== Creating the {pipeline_type} using provided script + +=== Usage +[subs=attributes+] +``` +pipeline_generator.sh \ + -c \ + -n <{pipeline_type} name> \ + -l \ + --sonar-url \ + --sonar-token \ + -d \ + [-b ] \ + [-w] +``` + +NOTE: The config file for the Complete {pipeline_type} is located at `/scripts/pipelines/{path_provider}/templates/complete/complete-pipeline.cfg`. + +=== Flags +[subs=attributes+] +``` +-c, --config-file [Required] Configuration file containing {pipeline_type} definition. +-n, --pipeline-name [Required] Name that will be set to the {pipeline_type}. +-l, --language [Required] Language or framework of the project. +-d, --local-directory [Required] Local directory of your project. +-t, --target-directory Target directory of complete process. Takes precedence over the language/framework default one. +-b, --target-branch Name of the branch to which the Pull Request will target. PR is not created if the flag is not provided. +-w Open the Pull Request on the web browser if it cannot be automatically merged. Requires -b flag. +``` + +=== Examples + +==== Quarkus project + +===== Quarkus project using JVM +[subs=attributes+] +``` +./pipeline_generator.sh -c ./templates/complete/complete-pipeline.cfg -n quarkus-project-complete -l quarkus-jvm --sonar-url http://1.2.3.4:9000 --sonar-token 6ce6663b63fc02881c6ea4c7cBa6563b8247a04e -d C:/Users/$USERNAME/Desktop/quarkus-project -b develop {openBrowserFlag} +``` + +==== Node.js project +[subs=attributes+] +``` +./pipeline_generator.sh -c ./templates/complete/complete-pipeline.cfg -n node-project-complete -l node --sonar-url http://1.2.3.4:9000 --sonar-token 6ce6663b63fc02881c6ea4c7cBa6563b8247a04e -d C:/Users/$USERNAME/Desktop/node-project -b develop {openBrowserFlag} +``` + +==== Angular project +[subs=attributes+] +``` +./pipeline_generator.sh -c ./templates/complete/complete-pipeline.cfg -n angular-project-complete -l angular --sonar-url http://1.2.3.4:9000 --sonar-token 6ce6663b63fc02881c6ea4c7cBa6563b8247a04e -d C:/Users/$USERNAME/Desktop/angular-project -b develop {openBrowserFlag} +``` diff --git a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template index 6abdaa52f..7c97f5bbb 100644 --- a/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template +++ b/scripts/pipelines/github/templates/complete/complete-pipeline.yml.template @@ -46,11 +46,6 @@ jobs: name: BuildOutput path: ./BuildOutput.tar -# # mark to insert step for additional artifact # -# Test: -# name: Test -# runs-on: ubuntu-latest -# steps: - name: Checkout repository code uses: actions/checkout@v2 @@ -62,13 +57,6 @@ jobs: if: always() with: files: '**/TEST-*.xml' - - # Quality: - # name: SonarQube analysis - # runs-on: ubuntu-latest - # steps: - # - name: Checkout the repository - # uses: actions/checkout@v2 - name: SonarQube analysis run: .github/workflows/scripts/quality.sh.template