From d1390d900f760a6348bf74612a7138ce9ca6a42e Mon Sep 17 00:00:00 2001 From: zguo Date: Tue, 17 Jun 2025 14:48:04 +0800 Subject: [PATCH 1/9] Migrate to pre-commit.ci --- .github/workflows/pre-commit.yml | 14 -------------- .pre-commit-config.yaml | 12 ++++++++++-- 2 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 7f579af..0000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [master] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa26480..f02394f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ repos: - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.4.2 + rev: v0.11.13 hooks: - id: ruff args: [--fix] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-case-conflict - id: check-ast @@ -21,3 +21,11 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace args: [--markdown-linebreak-ext=md] + +ci: + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit.com hooks + + For more information, see https://pre-commit.ci + autofix_prs: true + autoupdate_schedule: monthly From a81b5cbb4f779ed8f764c42c339efdc12770b4b5 Mon Sep 17 00:00:00 2001 From: zguo Date: Tue, 17 Jun 2025 16:21:08 +0800 Subject: [PATCH 2/9] Add CodeQL security scanning --- .github/workflows/codeql.yml | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..3ec8054 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,39 @@ +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + queries: security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From 22e3dc7aa162c33eef1f9bf0cc066795b8bdbdc9 Mon Sep 17 00:00:00 2001 From: zguo Date: Wed, 18 Jun 2025 09:52:33 +0800 Subject: [PATCH 3/9] Disable pre-commit.ci autofix --- .pre-commit-config.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f02394f..508d4ab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,10 +22,15 @@ repos: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] + - repo: https://github.com/packit/pre-commit-hooks + rev: v1.3.0 + hooks: + - id: validate-config + ci: autofix_commit_msg: | [pre-commit.ci] auto fixes from pre-commit.com hooks For more information, see https://pre-commit.ci - autofix_prs: true + autofix_prs: false autoupdate_schedule: monthly From cad373d378d0e0e69ae9e3358b587bd0783f2efd Mon Sep 17 00:00:00 2001 From: zguo Date: Thu, 19 Jun 2025 16:45:59 +0800 Subject: [PATCH 4/9] Add Packit configuration --- .packit.yaml | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .packit.yaml diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 0000000..eb8d95a --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,44 @@ +--- +# Basic configuration for Packit +# See documentation: https://packit.dev/docs/configuration/ + +specfile_path: fedora/python-targetcli-fb.spec + +upstream_package_name: targetcli-fb +# In Fedora, Python packages are prefixed with 'python-' +downstream_package_name: python3-targetcli + +# Use hatch to create the source archive +actions: + create-archive: + - hatch build -t sdist + - bash -c "ls -1t ./dist/*.tar.gz | head -n 1" + +srpm_build_deps: + - python3-devel + - python3-pip + - hatch + - python3-hatchling + - python3-hatch-vcs + +jobs: + # Test PRs in COPR + - job: copr_build + trigger: pull_request + targets: + - fedora-all + - epel-9 + + # Run tests + - job: tests + trigger: pull_request + targets: + - fedora-all + - epel-9 + + # Sync with Fedora when a new release is created + - job: propose_downstream + trigger: release + dist_git_branches: + - fedora-all + - epel-9 From 67736f9af56d9ee2ee2603b3d7b192aa6ff49b66 Mon Sep 17 00:00:00 2001 From: zguo Date: Thu, 19 Jun 2025 16:47:08 +0800 Subject: [PATCH 5/9] Add a spec file --- fedora/python-targetcli-fb.spec | 72 +++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 fedora/python-targetcli-fb.spec diff --git a/fedora/python-targetcli-fb.spec b/fedora/python-targetcli-fb.spec new file mode 100644 index 0000000..e6af9c2 --- /dev/null +++ b/fedora/python-targetcli-fb.spec @@ -0,0 +1,72 @@ +Name: python-targetcli-fb +Version: {{{ version }}} +Release: 1%{?dist} +Summary: Command shell for managing the Linux LIO kernel target + +License: Apache-2.0 +URL: https://github.com/open-iscsi/targetcli-fb +Source: %{pypi_source targetcli} + +BuildArch: noarch +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-hatchling +BuildRequires: python3-hatch-vcs +BuildRequires: python3-pytest +BuildRequires: python3-pytest-cov +BuildRequires: python3-pytest-mock + +# Runtime dependencies from pyproject.toml +Requires: python3-gobject +Requires: python3-configshell-fb +Requires: python3-rtslib-fb +Requires: python3-six +Requires: python3-dbus + +%description +An administration shell for configuring iSCSI, FCoE, and other SCSI targets, +using the TCM/LIO kernel target subsystem. + +%package -n python3-targetcli-fb +Summary: %{summary} +Requires: python3-configshell-fb +Requires: python3-rtslib-fb +Requires: python3-gobject +%{?python_provide:%python_provide python3-targetcli-fb} + +%description -n python3-targetcli-fb +An administration shell for configuring iSCSI, FCoE, and other SCSI targets, +using the TCM/LIO kernel target subsystem. + +%prep +%autosetup -n targetcli-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%pyproject_save_files targetcli + +# Install systemd files +install -d %{buildroot}%{_unitdir} +install -p -m 644 systemd/targetclid.service %{buildroot}%{_unitdir}/ +install -p -m 644 systemd/targetclid.socket %{buildroot}%{_unitdir}/ + +# Install man pages +install -d %{buildroot}%{_mandir}/man8 +install -p -m 644 targetcli.8 %{buildroot}%{_mandir}/man8/ +install -p -m 644 targetclid.8 %{buildroot}%{_mandir}/man8/ + +%files -n python3-targetcli-fb -f %{pyproject_files} +%license COPYING +%doc README.md THANKS +%{_bindir}/targetcli +%{_bindir}/targetclid +%{_mandir}/man8/targetcli.8* +%{_mandir}/man8/targetclid.8* +%{_unitdir}/targetclid.service +%{_unitdir}/targetclid.socket + +%changelog +%autochangelog From 595cf3eef297ea7ba8d529e591f5bb61310fd8b4 Mon Sep 17 00:00:00 2001 From: zguo Date: Fri, 20 Jun 2025 10:15:57 +0800 Subject: [PATCH 6/9] Adjust spec file --- fedora/python-targetcli-fb.spec | 53 ++++++++++++++++----------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/fedora/python-targetcli-fb.spec b/fedora/python-targetcli-fb.spec index e6af9c2..f91986f 100644 --- a/fedora/python-targetcli-fb.spec +++ b/fedora/python-targetcli-fb.spec @@ -1,6 +1,6 @@ Name: python-targetcli-fb -Version: {{{ version }}} -Release: 1%{?dist} +Version: 2.1.58 +Release: %autorelease Summary: Command shell for managing the Linux LIO kernel target License: Apache-2.0 @@ -9,34 +9,31 @@ Source: %{pypi_source targetcli} BuildArch: noarch BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-hatchling +BuildRequires: python3-pip +BuildRequires: hatch BuildRequires: python3-hatch-vcs -BuildRequires: python3-pytest -BuildRequires: python3-pytest-cov -BuildRequires: python3-pytest-mock - -# Runtime dependencies from pyproject.toml -Requires: python3-gobject -Requires: python3-configshell-fb -Requires: python3-rtslib-fb -Requires: python3-six -Requires: python3-dbus +BuildRequires: python3-hatchling +BuildRequires: systemd-rpm-macros -%description +%global _description %{expand: An administration shell for configuring iSCSI, FCoE, and other SCSI targets, using the TCM/LIO kernel target subsystem. +} -%package -n python3-targetcli-fb +%description +%{_description} + +%package -n targetcli Summary: %{summary} -Requires: python3-configshell-fb -Requires: python3-rtslib-fb -Requires: python3-gobject -%{?python_provide:%python_provide python3-targetcli-fb} +Requires: python3-configshell +Requires: python3-rtslib +Requires: target-restore +Requires: python3-six +Requires: python3-dbus +Requires: python3-gobject-base -%description -n python3-targetcli-fb -An administration shell for configuring iSCSI, FCoE, and other SCSI targets, -using the TCM/LIO kernel target subsystem. +%description -n targetcli +%{_description} %prep %autosetup -n targetcli-%{version} @@ -48,17 +45,15 @@ using the TCM/LIO kernel target subsystem. %pyproject_install %pyproject_save_files targetcli -# Install systemd files +mkdir -p %{buildroot}%{_sysconfdir}/target/backup install -d %{buildroot}%{_unitdir} install -p -m 644 systemd/targetclid.service %{buildroot}%{_unitdir}/ install -p -m 644 systemd/targetclid.socket %{buildroot}%{_unitdir}/ - -# Install man pages install -d %{buildroot}%{_mandir}/man8 install -p -m 644 targetcli.8 %{buildroot}%{_mandir}/man8/ install -p -m 644 targetclid.8 %{buildroot}%{_mandir}/man8/ -%files -n python3-targetcli-fb -f %{pyproject_files} +%files -n targetcli -f %{pyproject_files} %license COPYING %doc README.md THANKS %{_bindir}/targetcli @@ -67,6 +62,8 @@ install -p -m 644 targetclid.8 %{buildroot}%{_mandir}/man8/ %{_mandir}/man8/targetclid.8* %{_unitdir}/targetclid.service %{_unitdir}/targetclid.socket +%dir %{_sysconfdir}/target +%dir %{_sysconfdir}/target/backup %changelog -%autochangelog +%autochangelog \ No newline at end of file From 820c321e28ab41de797a2de78a1c8159ba74af9b Mon Sep 17 00:00:00 2001 From: zguo Date: Fri, 20 Jun 2025 14:25:22 +0800 Subject: [PATCH 7/9] Add tmt test plan --- ci-tests/sts.fmf | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 ci-tests/sts.fmf diff --git a/ci-tests/sts.fmf b/ci-tests/sts.fmf new file mode 100644 index 0000000..6632211 --- /dev/null +++ b/ci-tests/sts.fmf @@ -0,0 +1,4 @@ +plan: + import: + url: https://gitlab.com/rh-kernel-stqe/sts + name: /plans/lio/core From 0dfbee3bf8c017b1da79978fdd53edefa84e9ae5 Mon Sep 17 00:00:00 2001 From: zguo Date: Fri, 20 Jun 2025 16:08:22 +0800 Subject: [PATCH 8/9] Add .fmf/version --- .fmf/version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .fmf/version diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 From fc2ce9b56b7097351b43f1e4cbc89edc523c01f6 Mon Sep 17 00:00:00 2001 From: zguo Date: Wed, 24 Sep 2025 10:41:11 +0800 Subject: [PATCH 9/9] Update packit config --- .packit.yaml | 6 +++--- .pre-commit-config.yaml | 4 +--- fedora/python-targetcli-fb.spec => python-targetcli-fb.spec | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) rename fedora/python-targetcli-fb.spec => python-targetcli-fb.spec (99%) diff --git a/.packit.yaml b/.packit.yaml index eb8d95a..cfd879b 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -2,7 +2,7 @@ # Basic configuration for Packit # See documentation: https://packit.dev/docs/configuration/ -specfile_path: fedora/python-targetcli-fb.spec +specfile_path: python-targetcli-fb.spec upstream_package_name: targetcli-fb # In Fedora, Python packages are prefixed with 'python-' @@ -26,14 +26,14 @@ jobs: - job: copr_build trigger: pull_request targets: - - fedora-all + - fedora-latest-stable - epel-9 # Run tests - job: tests trigger: pull_request targets: - - fedora-all + - fedora-latest-stable - epel-9 # Sync with Fedora when a new release is created diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 508d4ab..06f17b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,8 +29,6 @@ repos: ci: autofix_commit_msg: | - [pre-commit.ci] auto fixes from pre-commit.com hooks - - For more information, see https://pre-commit.ci + Auto fixes from pre-commit.com hooks autofix_prs: false autoupdate_schedule: monthly diff --git a/fedora/python-targetcli-fb.spec b/python-targetcli-fb.spec similarity index 99% rename from fedora/python-targetcli-fb.spec rename to python-targetcli-fb.spec index f91986f..f19acf2 100644 --- a/fedora/python-targetcli-fb.spec +++ b/python-targetcli-fb.spec @@ -66,4 +66,4 @@ install -p -m 644 targetclid.8 %{buildroot}%{_mandir}/man8/ %dir %{_sysconfdir}/target/backup %changelog -%autochangelog \ No newline at end of file +%autochangelog