From ce8c5a8d582a715e93e8cd303e0893b0a5f2fd86 Mon Sep 17 00:00:00 2001 From: Lukas <115779773+lukas-greve-sonarsource@users.noreply.github.com> Date: Tue, 22 Nov 2022 16:56:23 +0100 Subject: [PATCH 01/10] Create sonar-project.properties --- sonar-project.properties | 1 + 1 file changed, 1 insertion(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..9f585023d --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1 @@ +sonar.projectKey=kimchi From 9e8e51ee87d8e66908f759137c04bc4201e90b14 Mon Sep 17 00:00:00 2001 From: Lukas <115779773+lukas-greve-sonarsource@users.noreply.github.com> Date: Tue, 22 Nov 2022 17:00:15 +0100 Subject: [PATCH 02/10] Update CI.yml add sonar related configuration --- .github/workflows/CI.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 29ce916bc..17f06dca2 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,6 +21,21 @@ jobs: - run: gcloud config set project $PROJECT_ID - uses: actions/checkout@v2-beta + with: + fetch-depth: 0 + - uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + + # If you wish to fail your job when the Quality Gate is red, uncomment the + # following lines. This would typically be used to fail a deployment. + # We do not recommend to use this in a pull request. Prefer using pull request + # decoration instead. + # - uses: sonarsource/sonarqube-quality-gate-action@master + # timeout-minutes: 5 + # env: + # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: create instance run: bash .github/scripts/setup_instance.sh $VM_NAME ubuntu-os-cloud ubuntu-1804-lts From 38522e80bf6d5e3eb11962ed116d94600c8cf22e Mon Sep 17 00:00:00 2001 From: Lukas <115779773+lukas-greve-sonarsource@users.noreply.github.com> Date: Tue, 22 Nov 2022 17:03:05 +0100 Subject: [PATCH 03/10] Update README.md Minor fix --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index c052630f7..2f780cb5a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -193,7 +193,7 @@ mapped user can get into the mount point. There are a lof of ways to contribute to the Kimchi Project: -* Issues can be reported at [Github](https://github.com/kimchi-project/kimchi/issues) +* Issues can be reported at [GiHhub](https://github.com/kimchi-project/kimchi/issues) * Patches are always welcome! Please, follow [these instructions](https://github.com/kimchi-project/kimchi/wiki/How-to-Contribute) on how to send patches to the mailing list (kimchi-devel@ovirt.org) or submit a pull request. From b35e98beee5be5e7a7bd4a1f2389dc3eac94ef86 Mon Sep 17 00:00:00 2001 From: Lukas Greve Date: Tue, 22 Nov 2022 17:18:18 +0100 Subject: [PATCH 04/10] remove support for iscsi.py --- .gitignore | 1 + iscsi.py | 86 ------------------------------------------------------ 2 files changed, 1 insertion(+), 86 deletions(-) delete mode 100644 iscsi.py diff --git a/.gitignore b/.gitignore index 8069807af..fce4570fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.pyc *~ *.list +.scannerwork/* i18n/mo/* log data diff --git a/iscsi.py b/iscsi.py deleted file mode 100644 index b50cb22d0..000000000 --- a/iscsi.py +++ /dev/null @@ -1,86 +0,0 @@ -# -# Project Kimchi -# -# Copyright IBM Corp, 2015-2016 -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301USA -import subprocess - -from wok.exception import OperationFailed - - -class TargetClient(object): - def __init__(self, target, host, port=None, auth=None): - self.portal = host + ('' if port is None else ':%s' % port) - self.target = target - self.auth = auth - self.targetCmd = ['iscsiadm', '--mode', 'node', '--targetname', - self.target, '--portal', self.portal] - - def _update_db(self, Name, Value): - self._run_cmd(['--op=update', '--name', Name, '--value', Value]) - - def _update_auth(self): - if self.auth is None: - items = (('node.session.auth.authmethod', 'None'), - ('node.session.auth.username', ''), - ('node.session.auth.password', '')) - else: - items = (('node.session.auth.authmethod', 'CHAP'), - ('node.session.auth.username', self.auth['username']), - ('node.session.auth.password', self.auth['password'])) - for name, value in items: - self._update_db(name, value) - - def _run_cmd(self, cmd): - iscsiadm = subprocess.Popen( - self.targetCmd + cmd, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = iscsiadm.communicate() - if iscsiadm.returncode != 0: - msg_args = {'portal': self.portal, 'err': err} - raise OperationFailed('KCHISCSI0001E', msg_args) - return out - - def _discover(self): - iscsiadm = subprocess.Popen( - ['iscsiadm', '--mode', 'discovery', '--type', 'sendtargets', - '--portal', self.portal], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = iscsiadm.communicate() - if iscsiadm.returncode != 0: - msg_args = {'portal': self.portal, 'err': err} - raise OperationFailed('KCHISCSI0001E', msg_args) - return out - - def _run_op(self, op): - self._run_cmd(['--' + op]) - - def login(self): - self._discover() - self._update_auth() - self._run_op('login') - - def logout(self): - self._run_op('logout') - - def validate(self): - try: - self.login() - except OperationFailed: - return False - - self.logout() - return True From c232f7a78c3f647a5cb1e3261db06def2682128c Mon Sep 17 00:00:00 2001 From: Lukas Greve Date: Thu, 15 Dec 2022 09:48:06 +0100 Subject: [PATCH 05/10] add jenkinsfile and sonar-project.properties --- jenkinsfile | 11 +++++++++++ sonar-project.properties | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 jenkinsfile diff --git a/jenkinsfile b/jenkinsfile new file mode 100644 index 000000000..796c74aad --- /dev/null +++ b/jenkinsfile @@ -0,0 +1,11 @@ +node { + stage('SCM') { + checkout scm + } + stage('SonarQube Analysis') { + def scannerHome = tool 'SonarScanner'; + withSonarQubeEnv() { + sh "${scannerHome}/bin/sonar-scanner" + } + } +} \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties index 9f585023d..b8fb7d7e0 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1 +1,6 @@ sonar.projectKey=kimchi +sonar.host.url=https://lg-sonarqube.ngrok.io +# sonar.sources = contrib/ +# sonar.tests = tests/ +sonar.exclusion=ui/spice*/**/* +sonar.python.version=3 \ No newline at end of file From 81bca0162d7c2da916604ff9ffefb1d392a8a2b7 Mon Sep 17 00:00:00 2001 From: Lukas Greve Date: Thu, 15 Dec 2022 09:50:55 +0100 Subject: [PATCH 06/10] rename Jenkinsfile --- jenkinsfile => Jenkinsfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jenkinsfile => Jenkinsfile (100%) diff --git a/jenkinsfile b/Jenkinsfile similarity index 100% rename from jenkinsfile rename to Jenkinsfile From 38cf9ed029b7f75844e5e194e12219578af0ed5a Mon Sep 17 00:00:00 2001 From: Lukas <115779773+lukas-greve-sonarsource@users.noreply.github.com> Date: Thu, 15 Dec 2022 09:58:26 +0100 Subject: [PATCH 07/10] Delete CI.yml Remove GitHub action --- .github/workflows/CI.yml | 70 ---------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml deleted file mode 100644 index 17f06dca2..000000000 --- a/.github/workflows/CI.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: kimchi-CI -on: ["push"] - -env: - VM_NAME: ubuntu-${{ github.sha }} - ZONE: us-central1-a - PROJECT_ID: ${{ secrets.GCP_PROJECT }} - WOK_DIR: wok - KIMCHI_DIR: wok/src/wok/plugins/kimchi/ - -jobs: - run-kimchi-tests: - runs-on: ubuntu-latest - steps: - - - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master - with: - version: '270.0.0' - service_account_email: ${{ secrets.GCP_SA_EMAIL }} - service_account_key: ${{ secrets.GCP_SA_KEY }} - - run: gcloud config set project $PROJECT_ID - - - uses: actions/checkout@v2-beta - with: - fetch-depth: 0 - - uses: sonarsource/sonarqube-scan-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - - # If you wish to fail your job when the Quality Gate is red, uncomment the - # following lines. This would typically be used to fail a deployment. - # We do not recommend to use this in a pull request. Prefer using pull request - # decoration instead. - # - uses: sonarsource/sonarqube-quality-gate-action@master - # timeout-minutes: 5 - # env: - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - - name: create instance - run: bash .github/scripts/setup_instance.sh $VM_NAME ubuntu-os-cloud ubuntu-1804-lts - shell: bash - - - name: checkout repos - run: | - gcloud compute ssh $VM_NAME --zone=$ZONE --command "git clone https://github.com/kimchi-project/wok" - gcloud compute ssh $VM_NAME --zone=$ZONE --command "git clone https://github.com/$GITHUB_REPOSITORY $KIMCHI_DIR" - gcloud compute ssh $VM_NAME --zone=$ZONE --command "cd $KIMCHI_DIR; git checkout $GITHUB_SHA" - shell: bash - - - name: setup wok deps - run: | - gcloud compute ssh $VM_NAME --zone=$ZONE --command "cd $WOK_DIR; bash .github/scripts/setup_wok_ubuntu.sh" - shell: bash - - - name: setup kimchi deps - run: gcloud compute ssh $VM_NAME --zone=$ZONE --command "cd $KIMCHI_DIR; bash .github/scripts/setup_kimchi_ubuntu.sh" - shell: bash - - - name: run tests - run: gcloud compute ssh $VM_NAME --zone=$ZONE --command "cd $KIMCHI_DIR; sudo make check-local; sudo make check" - shell: bash - - - name: Cleanup instance - if: always() - run: | - gcloud compute instances delete ${VM_NAME} --delete-disks=all --zone=$ZONE -q || true - gcloud compute images delete ${VM_NAME}-image -q || true - gcloud compute disks delete ${VM_NAME}-disk --zone=$ZONE -q || true - shell: bash From 6d7566383159a5a655f7fc04c403138947ecf994 Mon Sep 17 00:00:00 2001 From: Lukas Greve Date: Thu, 15 Dec 2022 10:02:55 +0100 Subject: [PATCH 08/10] make a change to kimchi.conf --- kimchi.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kimchi.conf b/kimchi.conf index d0e3c23de..b512b27e4 100644 --- a/kimchi.conf +++ b/kimchi.conf @@ -4,7 +4,7 @@ enable = True [kimchi] # Automatically create ISO pool on server start up -create_iso_pool = True +# create_iso_pool = True # Toggles whether to take a screenshot for the web-interface # Warning: Screenshots include a massive performance penalty -take_screenshot = True +# take_screenshot = True From 07fa56c366dd0845e69a075c84debe50a20803b0 Mon Sep 17 00:00:00 2001 From: Lukas Greve Date: Wed, 4 Jan 2023 15:01:14 +0100 Subject: [PATCH 09/10] Remove old workflows and add a new one --- .github/ISSUE_TEMPLATE/bug_report.md | 32 ---------- .github/ISSUE_TEMPLATE/feature_request.md | 20 ------ .github/pull_request_template.md | 26 -------- .github/scripts/setup_instance.sh | 78 ----------------------- .github/scripts/setup_kimchi_ubuntu.sh | 24 ------- .github/workflows/build.yml | 29 +++++++++ 6 files changed, 29 insertions(+), 180 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/pull_request_template.md delete mode 100644 .github/scripts/setup_instance.sh delete mode 100644 .github/scripts/setup_kimchi_ubuntu.sh create mode 100644 .github/workflows/build.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 615cc1d2d..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. Fedora 31, Ubuntu 19.10] - - Browser [e.g. chrome, safari] - - Version [e.g. 2.5, local@] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d6..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 170dc308c..000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,26 +0,0 @@ -# Pull Request Template - -## Description - -Please, include a summary of the patch and why it should be accepted. -Link it to any open issue and share any other information and context you judge relevant for this PR. - -Fixes # (issue) - -## How Has This Been Tested? - -Please, describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. - -- [ ] Test A -- [ ] Test B - -## Checklist: - -- [ ] My commit message follow the pattern described in [here](https://chris.beams.io/posts/git-commit/) -- [ ] I have signed-off my commit (git commit -s) to certify I have the rights to submit this work under the same license and agrees to a Developer Certificate of Origin (see http://developercertificate.org/ for more information). -- [ ] My code follows the style guidelines of this project and I have run `make check-local` to confirm it. -- [ ] I have run `make` to build the project and update any documentation that was added as part of this PR. -- [ ] I have performed a self-review of my own code -- [ ] I have commented my code, particularly in hard-to-understand areas -- [ ] I have added tests that prove my fix is effective or that my feature works -- [ ] New and existing unit tests pass locally with my changes (Run `make check` to confirm it) diff --git a/.github/scripts/setup_instance.sh b/.github/scripts/setup_instance.sh deleted file mode 100644 index 923902715..000000000 --- a/.github/scripts/setup_instance.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash - -set -euxo pipefail - -DISKS="gcloud compute disks" -IMAGES="gcloud compute images" -INSTANCES="gcloud compute instances" -VMX="https://compute.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx" -DEFAULT_ZONE=us-central1-a - -function createDisk() { - # Create disk - # - # $1: disk name - # $2: image project - # $3: image-family - # $4: zone - zone=${4:-$DEFAULT_ZONE} - - diskName=$1 - ${DISKS} create $diskName \ - --image-project $2 \ - --image-family $3 \ - --size 20GB \ - --zone $zone -} - -function createImage() { - # Create image with nested virtualization - # - # $1: image name - # $2: disk name - # $3: zone - zone=${3:-$DEFAULT_ZONE} - - imageName=$1 - ${IMAGES} create $imageName \ - --source-disk $2 \ - --source-disk-zone $zone \ - --licenses "${VMX}" -} - -function createVM() { - # Create VM with nested virtualization - # - # $1: VM name - # $2: image name - # $3: zone - zone=${3:-$DEFAULT_ZONE} - - instanceName=$1 - ${INSTANCES} create $1 \ - --zone $zone \ - --min-cpu-platform "Intel Haswell" \ - --image $2 -} - -# Entrypoint -# -# $1: vm name -# $2: image project -# $3: image family -# $4: zone -vmName=$1 -imageProject=$2 -imageFamily=$3 -zone=${4:-$DEFAULT_ZONE} - -# create disk -diskName=$vmName-disk -createDisk $vmName-disk $imageProject $imageFamily $zone - -# create image -imageName=$vmName-image -createImage $imageName $diskName $zone - -# create vm -createVM $1 $imageName $zone diff --git a/.github/scripts/setup_kimchi_ubuntu.sh b/.github/scripts/setup_kimchi_ubuntu.sh deleted file mode 100644 index 8998a87c4..000000000 --- a/.github/scripts/setup_kimchi_ubuntu.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -euxo pipefail - -function get_deps() { - echo $(python3 -c "import yaml;print(' '.join(yaml.load(open('dependencies.yaml'), Loader=yaml.FullLoader)[\"$1\"][\"$2\"]))") -} - - -# install deps -sudo apt update -sudo apt install -y python3-pip -sudo apt install -y $(get_deps development-deps common) -sudo apt install -y $(get_deps development-deps ubuntu) - -sudo apt install -y $(get_deps runtime-deps common) -sudo apt install -y $(get_deps runtime-deps ubuntu | sed 's/python3-cheetah//') - -pip3 install -r requirements-UBUNTU.txt -pip3 install -r requirements-dev.txt - -# autogen and make -./autogen.sh --system -make diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..546b463f5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,29 @@ +name: Build + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + # If you wish to fail your job when the Quality Gate is red, uncomment the + # following lines. This would typically be used to fail a deployment. + # We do not recommend to use this in a pull request. Prefer using pull request + # decoration instead. + # - uses: sonarsource/sonarqube-quality-gate-action@master + # timeout-minutes: 5 + # env: + # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 581901b038474f9e8b0ce5a021cfbe620a1b3258 Mon Sep 17 00:00:00 2001 From: Lukas Greve Date: Wed, 4 Jan 2023 15:17:38 +0100 Subject: [PATCH 10/10] remove requirements --- requirements-FEDORA.txt | 0 requirements-OPENSUSE-LEAP.txt | 1 - requirements-UBUNTU.txt | 0 requirements-dev.txt | 3 --- 4 files changed, 4 deletions(-) delete mode 100644 requirements-FEDORA.txt delete mode 100644 requirements-OPENSUSE-LEAP.txt delete mode 100644 requirements-UBUNTU.txt delete mode 100644 requirements-dev.txt diff --git a/requirements-FEDORA.txt b/requirements-FEDORA.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/requirements-OPENSUSE-LEAP.txt b/requirements-OPENSUSE-LEAP.txt deleted file mode 100644 index be6f8f4c7..000000000 --- a/requirements-OPENSUSE-LEAP.txt +++ /dev/null @@ -1 +0,0 @@ -pyparted diff --git a/requirements-UBUNTU.txt b/requirements-UBUNTU.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index b402c54fc..000000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,3 +0,0 @@ -cython -libsass -pre-commit