From 4bd8efdb28f4370b575405b6802e8f4c56f5a2a4 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Tue, 20 Feb 2024 15:12:28 +0100 Subject: [PATCH 1/2] pre-commit config --- .pre-commit-config.yaml | 21 +++++++++++++++++++++ README.md | 1 - docs/development.md | 10 +++++----- 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..5e59b8f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +# HOWTO: https://pre-commit.com/#usage +# dnf install pre-commit +# pre-commit install + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-merge-conflict + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.1.0 + hooks: + - id: prettier + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.9.0.6 + hooks: + - id: shellcheck + args: [--severity=error] diff --git a/README.md b/README.md index 71bb144..cb3c938 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ This repository contains bits needed to build a container image for [rpminspect](https://github.com/rpminspect/rpminspect). This image can be later used by Fedora CI. - ## Example usage `rpminspect_runner.sh` takes three parameters: `` `` `` diff --git a/docs/development.md b/docs/development.md index ff87cf8..cee5617 100644 --- a/docs/development.md +++ b/docs/development.md @@ -4,21 +4,22 @@ The runner script tries to update rpminspect (and data package) to the latest version every time it runs. - ## How to build and run the container image locally - Build the image using podman: + ```shell $ podman build -t quay.io/fedoraci/rpminspect:devel . ``` You can also force-update base image and dependencies with `--pull` and `--no-cache` options: + ```shell $ podman build --pull --no-cache -t quay.io/fedoraci/rpminspect:devel . ``` Run the image: + ```shell $ podman run -ti --rm quay.io/fedoraci/rpminspect:devel /bin/bash @@ -31,7 +32,6 @@ $ rpminspect_runner.sh 84688996 f37-updates license ... ``` - ## rpminspect-image CI/CD Push to the master branch triggers a new image build in [Quay.io](https://quay.io/repository/fedoraci/rpminspect). Once the build is finished, you can pull the image from the registry (replace the image tag): @@ -49,6 +49,7 @@ If Quay.io fails to build the image (infra/network errors...), it is possible to Only owners of the [`fedoraci` namespace](https://quay.io/organization/fedoraci/teams/owners) can push images manually. Build the image using podman: + ```shell $ podman build --pull --no-cache -t quay.io/fedoraci/rpminspect:$(git rev-parse --short HEAD) . ``` @@ -56,16 +57,15 @@ $ podman build --pull --no-cache -t quay.io/fedoraci/rpminspect:$(git rev-parse Create a new [robot account](https://quay.io/repository/fedoraci/rpminspect?tab=settings), then click on the account name and select the "Docker Login" tab. Copy the login command and replace "docker" with "podman". Push the image: + ```shell podman push quay.io/fedoraci/rpminspect:$(git rev-parse --short HEAD) ``` - ## Promote new image to production Update image tag in [rpminspect.fmf](https://github.com/fedora-ci/rpminspect-pipeline/blob/master/rpminspect.fmf). - ### Test the image end-to-end in CI Opening a pull-request in [fedora-ci/rpminspect-pipeline](https://github.com/fedora-ci/rpminspect-pipeline) repository will automatically create a test pipeline in [Fedora CI Jenkins](https://osci-jenkins-1.ci.fedoraproject.org/job/fedora-ci/job/rpminspect-pipeline/view/change-requests/). This pipeline contains changes from the pull-request, so it is possible to update the image reference in the [rpminspect.fmf](https://github.com/fedora-ci/rpminspect-pipeline/blob/master/rpminspect.fmf) file and then test the whole pipeline end-to-end in Jenkins. From 7f1cad5dddafbfd1d682e1cd2880f2fe7f1025c2 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Tue, 20 Feb 2024 15:33:16 +0100 Subject: [PATCH 2/2] Install fedora-license-data from Copr and update it during run Copr repo: https://copr.fedorainfracloud.org/coprs/g/osci/fedora-license-data https://issues.redhat.com/browse/OSCI-6263 --- Dockerfile.rhel | 10 +++++++--- rpminspect_runner.sh | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile.rhel b/Dockerfile.rhel index ddbc487..e56bd4a 100644 --- a/Dockerfile.rhel +++ b/Dockerfile.rhel @@ -14,18 +14,22 @@ ENV RPMINSPECT_CONFIG=/usr/share/rpminspect/redhat.yaml RUN cd /etc/yum.repos.d/ && \ curl -L -O https://download.devel.redhat.com/rel-eng/RCMTOOLS/rcm-tools-rhel-9-baseos.repo -# Add COPR reposiroty with rpminspect +# Add COPR repository with rpminspect RUN cd /etc/yum.repos.d/ && \ curl -L -O https://copr.fedorainfracloud.org/coprs/g/osci/rpminspect/repo/epel-9/group_osci-rpminspect-epel-9.repo -# Add COPR reposiroty with rpminspect data package +# Add COPR repository with rpminspect data package RUN cd /etc/yum.repos.d/ && \ curl -L -O https://copr.devel.redhat.com/coprs/dcantrell/rpminspect-data-redhat/repo/epel-9/dcantrell-rpminspect-data-redhat-epel-9.repo -# Add COPR reposiroty with rpminspect data package dependencies +# Add COPR repository with rpminspect data package dependencies RUN cd /etc/yum.repos.d/ && \ curl -L -O https://copr.fedorainfracloud.org/coprs/g/osci/rpminspect-data-deps/repo/epel-9/group_osci-rpminspect-data-deps-epel-9.repo +# Add COPR repository with latest fedora-license-data +RUN cd /etc/yum.repos.d/ && \ + curl -L -O https://copr.fedorainfracloud.org/coprs/g/osci/fedora-license-data/repo/epel-9/group_osci-fedora-license-data-epel-9.repo + # Update and install dependencies RUN dnf -y update &&\ dnf -y install --enablerepo=rhel-9-buildroot \ diff --git a/rpminspect_runner.sh b/rpminspect_runner.sh index 49afadd..8a74612 100755 --- a/rpminspect_runner.sh +++ b/rpminspect_runner.sh @@ -230,8 +230,8 @@ fi # We can uncomment this once the latest annocheck can be installed from a stable repo. #dnf update -y annobin* > update_annobin.log 2>&1 || : -# Update the data package, but from COPR, not from the official Fedora repositories -dnf update --disablerepo="fedora*" -y ${RPMINSPECT_PACKAGE_NAME} ${RPMINSPECT_DATA_PACKAGE_NAME} > update_rpminspect.log 2>&1 || : +# Update the data packages, but from COPR, not from the official Fedora repositories +dnf -y update --disablerepo="fedora*" "${RPMINSPECT_PACKAGE_NAME}" "${RPMINSPECT_DATA_PACKAGE_NAME}" fedora-license-data > update_rpminspect.log 2>&1 || : output_filename=${TMT_TEST_DATA:-.}/result.json verbose_log=${TMT_TEST_DATA:-.}/verbose.log