From 134f0742a867420d995d45055b0a1bcd288710fb Mon Sep 17 00:00:00 2001 From: Michal Srb Date: Thu, 8 Feb 2024 03:16:51 +0100 Subject: [PATCH] Add dockerfile for rhel and gl ci config Signed-off-by: Michal Srb --- .gitlab-ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile.rhel | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 Dockerfile.rhel diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f3a35d5 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,48 @@ +stages: + - buildimage + +variables: + CI_REGISTRY: images.paas.redhat.com + CI_REGISTRY_REPO: osci/rpminspect + +image build: + rules: + - if: $CI_COMMIT_BRANCH == "master" + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + stage: buildimage + tags: + - docker + before_script: + - mkdir -p /kaniko/.docker + - cat "$DOCKER_AUTH_CONFIG" > /kaniko/.docker/config.json + script: + - > + /kaniko/executor + --skip-tls-verify + --context $CI_PROJECT_DIR + --dockerfile $CI_PROJECT_DIR/Dockerfile + --destination ${CI_REGISTRY}/${CI_REGISTRY_REPO}:${CI_COMMIT_SHORT_SHA} + --destination ${CI_REGISTRY}/${CI_REGISTRY_REPO}:latest + +merge request image build: + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + stage: buildimage + tags: + - docker + before_script: + - mkdir -p /kaniko/.docker + - cat "$DOCKER_AUTH_CONFIG" > /kaniko/.docker/config.json + script: + - > + /kaniko/executor + --skip-tls-verify + --context $CI_PROJECT_DIR + --dockerfile $CI_PROJECT_DIR/Dockerfile + --destination ${CI_REGISTRY}/${CI_REGISTRY_REPO}:mr-${CI_MERGE_REQUEST_IID} + --destination ${CI_REGISTRY}/${CI_REGISTRY_REPO}:mr-${CI_MERGE_REQUEST_IID}-${CI_COMMIT_SHORT_SHA} diff --git a/Dockerfile.rhel b/Dockerfile.rhel new file mode 100644 index 0000000..ddbc487 --- /dev/null +++ b/Dockerfile.rhel @@ -0,0 +1,47 @@ +FROM images.paas.redhat.com/osci/base-minimal +LABEL maintainer "OSCI" +LABEL description="rpminspect for RHEL" + +# https://copr.fedorainfracloud.org/coprs/dcantrell/rpminspect/ +ENV RPMINSPECT_PACKAGE_NAME=rpminspect +# https://copr.devel.redhat.com/coprs/dcantrell/rpminspect-data-redhat/ +ENV RPMINSPECT_DATA_PACKAGE_NAME=rpminspect-data-redhat + +ENV KOJI_BIN=/usr/bin/brew +ENV RPMINSPECT_CONFIG=/usr/share/rpminspect/redhat.yaml + +# Add repository for "brew" command +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 +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 +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 +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 + +# Update and install dependencies +RUN dnf -y update &&\ + dnf -y install --enablerepo=rhel-9-buildroot \ + ${RPMINSPECT_PACKAGE_NAME} \ + ${RPMINSPECT_DATA_PACKAGE_NAME} \ + clamav-update \ + python3-pyyaml \ + python3-click \ + python3-retry \ + python3-GitPython \ + koji \ + git \ + jq \ + brewkoji \ + && dnf clean all + +RUN freshclam + +COPY *.sh *.py /usr/local/bin/