From 0ed877ce437e78c23cdaf4523ce0c115133aa482 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 03:31:13 +0000 Subject: [PATCH 1/5] Bump docker/build-push-action from 5 to 6 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v5...v6) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docker-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml index ea763e3..617cedd 100644 --- a/.github/workflows/docker-push.yml +++ b/.github/workflows/docker-push.yml @@ -159,7 +159,7 @@ jobs: - name: Build and push image if: ${{ steps.build_check.outputs.build == 'true' }} - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: push: true context: . From 7980e5e9735ba8dbf4ff49b0fa6197fe3553223b Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 3 Jul 2024 17:46:13 +0300 Subject: [PATCH 2/5] Remove CentOS 7 and OracleLinux 7 due to EOL --- .docker/centos7.docker | 53 --------------------------- .docker/node-centos7.docker | 57 ----------------------------- .docker/node-ol7.docker | 61 ------------------------------- .docker/ol7.docker | 57 ----------------------------- .github/workflows/ci.yml | 4 +- .github/workflows/docker-push.yml | 2 +- Makefile | 9 ----- README.md | 8 ---- rpmbuilder-farm | 10 +---- 9 files changed, 5 insertions(+), 256 deletions(-) delete mode 100644 .docker/centos7.docker delete mode 100644 .docker/node-centos7.docker delete mode 100644 .docker/node-ol7.docker delete mode 100644 .docker/ol7.docker diff --git a/.docker/centos7.docker b/.docker/centos7.docker deleted file mode 100644 index 1951583..0000000 --- a/.docker/centos7.docker +++ /dev/null @@ -1,53 +0,0 @@ -## REGISTRY CONFIGURATION ###################################################### - -ARG REGISTRY="docker.io" - -## FINAL IMAGE ################################################################# - -FROM ${REGISTRY}/essentialkaos/centos:7 - -ARG GOSU_VER=1.17 -ARG HOSTNAME="rpmbuilder-centos7.docker.local" - -LABEL org.opencontainers.image.title="RPMBuilder" \ - org.opencontainers.image.description="RPM package build helper (CentOS 7)" \ - org.opencontainers.image.vendor="ESSENTIAL KAOS" \ - org.opencontainers.image.authors="Anton Novojilov" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.url="https://kaos.sh/d/rpmbuilder" \ - org.opencontainers.image.source="https://github.com/essentialkaos/rpmbuilder" - -# hadolint ignore=DL3031,DL3033 -RUN echo "$HOSTNAME" > /etc/hostname && \ - yum -y -q install https://pkgs.kaos.st/kaos-repo-latest.el7.noarch.rpm && \ - yum -y -q install epel-release centos-release-scl && \ - yum -y -q install sudo make which file && \ - yum -y -q install rpm-build spec-builddep rpmdevtools sshpass epel-rpm-macros && \ - yum -y -q install perfecto rpmlint pwgen && \ - yum clean all && \ - rm -rf /var/cache/yum /var/log/yum.log && \ - curl -o /usr/local/bin/gosu -sSL "https://github.com/tianon/gosu/releases/download/$GOSU_VER/gosu-amd64" && \ - mkdir -p /home/builder/rpmbuild/BUILD /home/builder/rpmbuild/BUILDROOT \ - /home/builder/rpmbuild/RPMS /home/builder/rpmbuild/SOURCES \ - /home/builder/rpmbuild/SPECS /home/builder/rpmbuild/SRPMS && \ - mkdir -p /usr/libexec/rpmbuilder /home/builder/.config /rpmbuilder - -COPY SOURCES/conf/rpmmacros_el7 /home/builder/.rpmmacros -COPY SOURCES/conf/rpmlint /home/builder/.config/rpmlint - -COPY SOURCES/conf/builder.sudoers /etc/sudoers.d/rpmbuilder -COPY SOURCES/rpmbuilder /usr/bin/rpmbuilder -COPY SOURCES/libexec/* /usr/libexec/rpmbuilder/ - -COPY .docker/entrypoint /usr/local/bin/entrypoint - -RUN chmod +x /usr/local/bin/entrypoint \ - /usr/local/bin/gosu \ - /usr/bin/rpmbuilder - -VOLUME /rpmbuilder -WORKDIR /rpmbuilder - -ENTRYPOINT ["/usr/local/bin/entrypoint"] - -################################################################################ diff --git a/.docker/node-centos7.docker b/.docker/node-centos7.docker deleted file mode 100644 index 2045e27..0000000 --- a/.docker/node-centos7.docker +++ /dev/null @@ -1,57 +0,0 @@ -## REGISTRY CONFIGURATION ###################################################### - -ARG REGISTRY="docker.io" - -## FINAL IMAGE ################################################################# - -FROM ${REGISTRY}/essentialkaos/centos:7 - -ARG USER_ID=9001 -ARG PORT=2027 -ARG HOSTNAME="rpmbuilder-node-centos7.docker.local" - -ENV PUB_KEY="" -ENV SSH_PORT=$PORT - -LABEL org.opencontainers.image.title="RPMBuilder Node" \ - org.opencontainers.image.description="RPMBuilder Build Node (CentOS 7)" \ - org.opencontainers.image.vendor="ESSENTIAL KAOS" \ - org.opencontainers.image.authors="Anton Novojilov" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.url="https://kaos.sh/d/rpmbuilder" \ - org.opencontainers.image.source="https://github.com/essentialkaos/rpmbuilder" - -# hadolint ignore=DL3031,DL3033 -RUN echo "$HOSTNAME" > /etc/hostname && \ - yum -y -q install https://pkgs.kaos.st/kaos-repo-latest.el7.noarch.rpm && \ - yum -y -q install epel-release centos-release-scl && \ - yum -y -q install sudo make which file openssh-server openssh-clients && \ - yum -y -q install rpm-build spec-builddep rpmdevtools epel-rpm-macros && \ - yum -y -q install perfecto rpmlint pwgen && \ - yum clean all && \ - rm -rf /var/cache/yum /var/log/yum.log && \ - mkdir -p /home/builder/rpmbuild/BUILD /home/builder/rpmbuild/BUILDROOT /home/builder/rpmbuild/RPMS \ - /home/builder/rpmbuild/SOURCES /home/builder/rpmbuild/SPECS /home/builder/rpmbuild/SRPMS \ - /home/builder/.ssh /home/builder/.config && \ - touch /home/builder/.ssh/authorized_keys && \ - chmod 0600 /home/builder/.ssh/authorized_keys - -COPY --chown=$USER_ID SOURCES/conf/rpmmacros_el7 /home/builder/.rpmmacros -COPY --chown=$USER_ID SOURCES/conf/rpmlint /home/builder/.config/rpmlint -COPY --chown=$USER_ID SOURCES/initenv /home/builder/initenv -COPY --chown=$USER_ID SOURCES/nodeinfo /home/builder/nodeinfo - -COPY SOURCES/conf/builder.sudoers /etc/sudoers.d/rpmbuilder -COPY .docker/sshd_config /etc/ssh/sshd_config - -COPY .docker/node-entrypoint /usr/local/bin/entrypoint - -RUN chmod +x /usr/local/bin/entrypoint \ - /home/builder/initenv \ - /home/builder/nodeinfo - -EXPOSE $PORT - -CMD ["/usr/local/bin/entrypoint"] - -################################################################################ diff --git a/.docker/node-ol7.docker b/.docker/node-ol7.docker deleted file mode 100644 index cc99379..0000000 --- a/.docker/node-ol7.docker +++ /dev/null @@ -1,61 +0,0 @@ -## REGISTRY CONFIGURATION ###################################################### - -ARG REGISTRY="docker.io" - -## FINAL IMAGE ################################################################# - -FROM ${REGISTRY}/essentialkaos/oraclelinux:7 - -ARG USER_ID=9001 -ARG PORT=2037 -ARG HOSTNAME="rpmbuilder-node-ol7.docker.local" - -ENV PUB_KEY="" -ENV SSH_PORT=$PORT - -LABEL org.opencontainers.image.title="RPMBuilder Node" \ - org.opencontainers.image.description="RPMBuilder Build Node (OracleLinux 7)" \ - org.opencontainers.image.vendor="ESSENTIAL KAOS" \ - org.opencontainers.image.authors="Anton Novojilov" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.url="https://kaos.sh/d/rpmbuilder" \ - org.opencontainers.image.source="https://github.com/essentialkaos/rpmbuilder" - -# hadolint ignore=DL3031,DL3033 -RUN echo "$HOSTNAME" > /etc/hostname && \ - yum -y -q update oraclelinux-release && \ - yum -y -q install https://pkgs.kaos.st/kaos-repo-latest.el7.noarch.rpm && \ - yum -y -q install https://mirror.yandex.ru/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm && \ - yum -y -q install https://mirror.yandex.ru/centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm && \ - yum -y -q install https://mirror.yandex.ru/centos/7/extras/x86_64/Packages/centos-release-scl-2-3.el7.centos.noarch.rpm && \ - yum-config-manager --enable ol7_optional_latest >/dev/null 2>&1 /dev/null && \ - yum -y -q install sudo make which file openssh-server openssh-clients && \ - yum -y -q install rpm-build spec-builddep rpmdevtools epel-rpm-macros && \ - yum -y -q install perfecto rpmlint pwgen && \ - yum clean all && \ - rm -rf /var/cache/yum /var/log/yum.log && \ - mkdir -p /home/builder/rpmbuild/BUILD /home/builder/rpmbuild/BUILDROOT /home/builder/rpmbuild/RPMS \ - /home/builder/rpmbuild/SOURCES /home/builder/rpmbuild/SPECS /home/builder/rpmbuild/SRPMS \ - /home/builder/.ssh /home/builder/.config && \ - touch /home/builder/.ssh/authorized_keys && \ - chmod 0600 /home/builder/.ssh/authorized_keys - -COPY --chown=$USER_ID SOURCES/conf/rpmmacros_el7 /home/builder/.rpmmacros -COPY --chown=$USER_ID SOURCES/conf/rpmlint /home/builder/.config/rpmlint -COPY --chown=$USER_ID SOURCES/initenv /home/builder/initenv -COPY --chown=$USER_ID SOURCES/nodeinfo /home/builder/nodeinfo - -COPY SOURCES/conf/builder.sudoers /etc/sudoers.d/rpmbuilder -COPY .docker/sshd_config /etc/ssh/sshd_config - -COPY .docker/node-entrypoint /usr/local/bin/entrypoint - -RUN chmod +x /usr/local/bin/entrypoint \ - /home/builder/initenv \ - /home/builder/nodeinfo - -EXPOSE $PORT - -CMD ["/usr/local/bin/entrypoint"] - -################################################################################ diff --git a/.docker/ol7.docker b/.docker/ol7.docker deleted file mode 100644 index cc61c75..0000000 --- a/.docker/ol7.docker +++ /dev/null @@ -1,57 +0,0 @@ -## REGISTRY CONFIGURATION ###################################################### - -ARG REGISTRY="docker.io" - -## FINAL IMAGE ################################################################# - -FROM ${REGISTRY}/essentialkaos/oraclelinux:7 - -ARG GOSU_VER=1.17 -ARG HOSTNAME="rpmbuilder-ol7.docker.local" - -LABEL org.opencontainers.image.title="RPMBuilder" \ - org.opencontainers.image.description="RPM package build helper (OracleLinux 7)" \ - org.opencontainers.image.vendor="ESSENTIAL KAOS" \ - org.opencontainers.image.authors="Anton Novojilov" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.url="https://kaos.sh/d/rpmbuilder" \ - org.opencontainers.image.source="https://github.com/essentialkaos/rpmbuilder" - -# hadolint ignore=DL3031,DL3033 -RUN echo "$HOSTNAME" > /etc/hostname && \ - yum -y -q update oraclelinux-release && \ - yum -y -q install https://pkgs.kaos.st/kaos-repo-latest.el7.noarch.rpm && \ - yum -y -q install https://mirror.yandex.ru/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm && \ - yum -y -q install https://mirror.yandex.ru/centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm && \ - yum -y -q install https://mirror.yandex.ru/centos/7/extras/x86_64/Packages/centos-release-scl-2-3.el7.centos.noarch.rpm && \ - yum-config-manager --enable ol7_optional_latest >/dev/null 2>&1 && \ - yum -y -q install sudo make which file && \ - yum -y -q install rpm-build spec-builddep rpmdevtools sshpass epel-rpm-macros && \ - yum -y -q install perfecto rpmlint pwgen && \ - yum clean all && \ - rm -rf /var/cache/yum /var/log/yum.log && \ - curl -o /usr/local/bin/gosu -sSL "https://github.com/tianon/gosu/releases/download/$GOSU_VER/gosu-amd64" && \ - mkdir -p /home/builder/rpmbuild/BUILD /home/builder/rpmbuild/BUILDROOT \ - /home/builder/rpmbuild/RPMS /home/builder/rpmbuild/SOURCES \ - /home/builder/rpmbuild/SPECS /home/builder/rpmbuild/SRPMS && \ - mkdir -p /usr/libexec/rpmbuilder /home/builder/.config/rpmbuilder /rpmbuilder - -COPY SOURCES/conf/rpmmacros_el7 /home/builder/.rpmmacros -COPY SOURCES/conf/rpmlint /home/builder/.config/rpmlint - -COPY SOURCES/conf/builder.sudoers /etc/sudoers.d/rpmbuilder -COPY SOURCES/rpmbuilder /usr/bin/rpmbuilder -COPY SOURCES/libexec/* /usr/libexec/rpmbuilder/ - -COPY .docker/entrypoint /usr/local/bin/entrypoint - -RUN chmod +x /usr/local/bin/entrypoint \ - /usr/local/bin/gosu \ - /usr/bin/rpmbuilder - -VOLUME /rpmbuilder -WORKDIR /rpmbuilder - -ENTRYPOINT ["/usr/local/bin/entrypoint"] - -################################################################################ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 107db32..affeaa0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: - name: Check dockerfiles with Hadolint uses: essentialkaos/hadolint-action@v1 with: - files: .docker/centos7.docker .docker/ol7.docker .docker/ol8.docker .docker/ol9.docker .docker/node-centos7.docker .docker/node-ol7.docker .docker/node-ol8.docker .docker/node-ol9.docker + files: .docker/ol8.docker .docker/ol9.docker .docker/node-ol8.docker .docker/node-ol9.docker Typos: name: Typos @@ -84,7 +84,7 @@ jobs: strategy: matrix: - image: [ 'centos7', 'ol7', 'ol8', 'ol9', 'node-centos7', 'node-ol7', 'node-ol8', 'node-ol9' ] + image: [ 'ol8', 'ol9', 'node-ol8', 'node-ol9' ] steps: - name: Check event type diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml index ea763e3..0025fc4 100644 --- a/.github/workflows/docker-push.yml +++ b/.github/workflows/docker-push.yml @@ -28,7 +28,7 @@ jobs: strategy: matrix: - image: [ 'centos7', 'ol7', 'ol8', 'ol9', 'node-centos7', 'node-ol7', 'node-ol8', 'node-ol9' ] + image: [ 'ol8', 'ol9', 'node-ol8', 'node-ol9' ] steps: - name: Checkout diff --git a/Makefile b/Makefile index 5c1d2c5..b2b100c 100644 --- a/Makefile +++ b/Makefile @@ -71,14 +71,10 @@ endif build-images: build-images-base build-images-node ## Build all docker images build-images-base: ## Build base docker images - docker build -f .docker/centos7.docker -t $(IMAGE_REPO):centos7 . - docker build -f .docker/ol7.docker -t $(IMAGE_REPO):ol7 . docker build -f .docker/ol8.docker -t $(IMAGE_REPO):ol8 . docker build -f .docker/ol9.docker -t $(IMAGE_REPO):ol9 . build-images-node: ## Build node docker images - docker build -f .docker/node-centos7.docker -t $(IMAGE_REPO):node-centos7 . - docker build -f .docker/node-ol7.docker -t $(IMAGE_REPO):node-ol7 . docker build -f .docker/node-ol8.docker -t $(IMAGE_REPO):node-ol8 . docker build -f .docker/node-ol9.docker -t $(IMAGE_REPO):node-ol9 . @@ -86,23 +82,18 @@ push-images: push-images-base push-images-node ## Push all images to registry push-images-base: ## Push base images to registry ifneq (,$(wildcard ~/.docker/config.json)) - docker push $(IMAGE_REPO):centos7 - docker push $(IMAGE_REPO):ol7 docker push $(IMAGE_REPO):ol8 docker push $(IMAGE_REPO):ol9 endif push-images-node: ## Push node images to registry ifneq (,$(wildcard ~/.docker/config.json)) - docker push $(IMAGE_REPO):node-centos7 - docker push $(IMAGE_REPO):node-ol7 docker push $(IMAGE_REPO):node-ol8 docker push $(IMAGE_REPO):node-ol9 endif run-nodes: ## Run nodes containers ifneq (,$(wildcard $(PUB_KEY_FILE))) - docker run -e PUB_KEY="$(shell cat $(PUB_KEY_FILE))" -p 2037:2037 -d $(IMAGE_REPO):node-ol7 docker run -e PUB_KEY="$(shell cat $(PUB_KEY_FILE))" -p 2038:2038 -d $(IMAGE_REPO):node-ol8 docker run -e PUB_KEY="$(shell cat $(PUB_KEY_FILE))" -p 2039:2039 -d $(IMAGE_REPO):node-ol9 endif diff --git a/README.md b/README.md index f83ee1f..170be3e 100644 --- a/README.md +++ b/README.md @@ -47,23 +47,15 @@ We provide a big variety of Docker images available on [GitHub Container Registr Basic images: -- `ghcr.io/essentialkaos/rpmbuilder:centos7` (_CentOS 7_) -- `ghcr.io/essentialkaos/rpmbuilder:ol7` (_OracleLinux 7_) - `ghcr.io/essentialkaos/rpmbuilder:ol8` (_OracleLinux 8_) - `ghcr.io/essentialkaos/rpmbuilder:ol9` (_OracleLinux 9_) -- `essentialkaos/rpmbuilder:centos7` (_CentOS 7_) -- `essentialkaos/rpmbuilder:ol7` (_OracleLinux 7_) - `essentialkaos/rpmbuilder:ol8` (_OracleLinux 8_) - `essentialkaos/rpmbuilder:ol9` (_OracleLinux 9_) Build node images: -- `ghcr.io/essentialkaos/rpmbuilder:node-centos7` (_CentOS 7_ | Port: `2027`) -- `ghcr.io/essentialkaos/rpmbuilder:node-ol7` (_OracleLinux 7_ | Port: `2037`) - `ghcr.io/essentialkaos/rpmbuilder:node-ol8` (_OracleLinux 8_ | Port: `2038`) - `ghcr.io/essentialkaos/rpmbuilder:node-ol9` (_OracleLinux 9_ | Port: `2039`) -- `essentialkaos/rpmbuilder:node-centos7` (_CentOS 7_ | Port: `2027`) -- `essentialkaos/rpmbuilder:node-ol7` (_OracleLinux 7_ | Port: `2037`) - `essentialkaos/rpmbuilder:node-ol8` (_OracleLinux 8_ | Port: `2038`) - `essentialkaos/rpmbuilder:node-ol9` (_OracleLinux 9_ | Port: `2039`) diff --git a/rpmbuilder-farm b/rpmbuilder-farm index c3895bd..d6a8806 100755 --- a/rpmbuilder-farm +++ b/rpmbuilder-farm @@ -13,7 +13,7 @@ fi APP="rpmbuilder-farm" # App version -VER="1.2.1" +VER="1.2.2" # App description DESC="Helper for bootstrapping rpmbuilder build farm" @@ -54,7 +54,7 @@ START_PORT=10000 image="ghcr.io/essentialkaos/rpmbuilder" # List of images -images=("centos7" "ol7" "ol8" "ol9") +images=("ol8" "ol9") ############################################################################### @@ -1432,8 +1432,6 @@ isValidKey() { # Echo: Port (Number) getImagePort() { case "$1" in - "centos7") echo "27" ;; - "ol7") echo "37" ;; "ol8") echo "38" ;; "ol9") echo "39" ;; esac @@ -1507,8 +1505,6 @@ hasImage() { # Echo: Image name with color (String) getImageWithColor() { case "$1" in - "centos7") echo "{#75}$1{!}" ;; - "ol7") echo "{#113}$1{!}" ;; "ol8") echo "{#174}$1{!}" ;; "ol9") echo "{#99}$1{!}" ;; *) echo "$1" @@ -1523,8 +1519,6 @@ getImageWithColor() { # Echo: Image color tag (String) getImageColor() { case "$1" in - "centos7") echo "{#75}" ;; - "ol7") echo "{#113}" ;; "ol8") echo "{#174}" ;; "ol9") echo "{#99}" ;; esac From 9904be4b44c7fb2b1fab7639cf3df871ee647ef6 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 3 Jul 2024 17:49:19 +0300 Subject: [PATCH 3/5] Improve README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 170be3e..bc98c23 100644 --- a/README.md +++ b/README.md @@ -20,15 +20,15 @@ https://github.com/essentialkaos/rpmbuilder/assets/182020/d0ae6d9c-663e-46cf-a3f #### From [ESSENTIAL KAOS Public Repository](https://kaos.sh/kaos-repo) ```bash -sudo yum install -y https://pkgs.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm -sudo yum install rpmbuilder +sudo dnf install -y https://pkgs.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm +sudo dnf install rpmbuilder ``` Build node: ```bash -sudo yum install -y https://pkgs.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm -sudo yum install rpmbuilder-node +sudo dnf install -y https://pkgs.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm +sudo dnf install rpmbuilder-node ``` #### Using Makefile and Git From 8fc349163c07e379ba14e8ca9779d80ee7414853 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 21 Aug 2024 13:22:49 +0300 Subject: [PATCH 4/5] Improve spec validation --- SOURCES/libexec/build.shx | 3 +++ SOURCES/libexec/spec.shx | 13 ++++++++++++- SOURCES/rpmbuilder | 2 +- rpmbuilder.spec | 5 ++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/SOURCES/libexec/build.shx b/SOURCES/libexec/build.shx index 0c9536a..1a1e866 100644 --- a/SOURCES/libexec/build.shx +++ b/SOURCES/libexec/build.shx @@ -21,13 +21,16 @@ require "utils" # Echo: No startBuild() { local spec="$1" + local err if ! isSpecFile "$spec" ; then if isSpecFile "${spec}.spec" ; then [[ -r "${spec}.source" && -z "$source_list" ]] && source_list="$spec.source" spec="${spec}.spec" else + err=$(validateSpec "$spec") error "${CL_BL_RED}${spec}${CL_RED} is not a spec file!${CL_NORM}" + error "${CL_BL_RED}${err}${CL_NORM}" doExit $ERROR_SPEC fi fi diff --git a/SOURCES/libexec/spec.shx b/SOURCES/libexec/spec.shx index b2d2b33..3e9e013 100644 --- a/SOURCES/libexec/spec.shx +++ b/SOURCES/libexec/spec.shx @@ -22,13 +22,24 @@ isSpecFile() { return 1 fi - if ! grep -q "%prep" "$1" ; then + if ! spectool -n "$1" &> /dev/null ; then return 1 fi return 0 } +# Validate spec using spectool +# +# 1: Path to spec file (String) +# +# Code: Yes +# Echo: Validation error (String) +validateSpec() { + spectool -n "$1" 1>/dev/null + return $? +} + # Read options from spec file # # 1: Path to spec file (String) diff --git a/SOURCES/rpmbuilder b/SOURCES/rpmbuilder index f15c771..e234120 100755 --- a/SOURCES/rpmbuilder +++ b/SOURCES/rpmbuilder @@ -13,7 +13,7 @@ fi APP="RPMBuilder" # Utility version (String) -VER="3.3.2" +VER="3.3.3" # Utility description (String) DESC="RPM package build helper" diff --git a/rpmbuilder.spec b/rpmbuilder.spec index 476d2ec..e4ab81a 100644 --- a/rpmbuilder.spec +++ b/rpmbuilder.spec @@ -6,7 +6,7 @@ Summary: RPM package build helper Name: rpmbuilder -Version: 3.3.2 +Version: 3.3.3 Release: 0%{?dist} License: Apache License, Version 2.0 Group: Development/Tools @@ -63,6 +63,9 @@ rm -rf %{buildroot} ################################################################################ %changelog +* Wed Aug 21 2024 Anton Novojilov - 3.3.3-0 +- Improved spec validation + * Fri Jun 07 2024 Anton Novojilov - 3.3.2-0 - Improved formatting of help content From 0085c1bd29b67aec967d641d25c58efe44f60342 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 21 Aug 2024 14:05:55 +0300 Subject: [PATCH 5/5] buildmon init script replaced by systemd service --- SOURCES/buildmon.init | 55 --------------------- SOURCES/buildmon.service | 13 +++++ SOURCES/conf/rpmmacros_el7 | 24 --------- rpmbuilder-node.source | 4 +- rpmbuilder-node.spec | 99 +++++++++++--------------------------- 5 files changed, 44 insertions(+), 151 deletions(-) delete mode 100644 SOURCES/buildmon.init create mode 100644 SOURCES/buildmon.service delete mode 100644 SOURCES/conf/rpmmacros_el7 diff --git a/SOURCES/buildmon.init b/SOURCES/buildmon.init deleted file mode 100644 index 882836d..0000000 --- a/SOURCES/buildmon.init +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -# buildmon Startup script for buildmon - -# chkconfig: - 85 15 -# processname: buildmon -# pidfile: /var/run/buildmon.pid -# description: simple daemon for monitoring build process - -############################################################################### - -source /etc/init.d/kaosv - -############################################################################### - -kv[prog_name]="buildmon" - -user="builder" -srv_dir="/home/$user" -binary="$srv_dir/${kv[prog_name]}" - -kv[daemonize_user]="${user}" -kv[search_pattern]="$binary" - -############################################################################### - -kv.addHandler "start" "startServiceHandler" -kv.addHandler "stop" "stopServiceHandler" - -############################################################################### - -startServiceHandler() { - kv.daemonize $binary - - kv.getStartStatus - - return $? -} - -stopServiceHandler() { - local pid=`kv.getPid` - - kv.sendSignal "TERM" - - if kv.getStopStatus "$pid" ; then - return $ACTION_OK - else - kv.killProcess $pid - return $ACTION_FORCED - fi -} - -############################################################################### - -kv.go $@ diff --git a/SOURCES/buildmon.service b/SOURCES/buildmon.service new file mode 100644 index 0000000..713106e --- /dev/null +++ b/SOURCES/buildmon.service @@ -0,0 +1,13 @@ +[Unit] +Description=Startup script for buildmon +Documentation=https://kaos.sh/rpmbuilder +After=network-online.target remote-fs.target nss-lookup.target +Wants=network-online.target + +[Service] +Type=simple +User=builder +ExecStart=/home/builder/buildmon + +[Install] +WantedBy=multi-user.target diff --git a/SOURCES/conf/rpmmacros_el7 b/SOURCES/conf/rpmmacros_el7 deleted file mode 100644 index 83ed577..0000000 --- a/SOURCES/conf/rpmmacros_el7 +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ - -%_topdir %(echo $HOME)/rpmbuild - -# Use all available cores on build node -%_smp_mflags -j%(cat /proc/cpuinfo | grep -c processor) - -# Disable debug packages -%debug_package %{nil} - -# Added check-buildroot for post install actions -%__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot - -# Fix broken provides search -%_use_internal_dependency_generator 0 - -# Fix default dist name -%dist .el7 - -# Use xz compression for payload by default -%_source_payload w7T.xzdio -%_binary_payload w7T.xzdio - -################################################################################ diff --git a/rpmbuilder-node.source b/rpmbuilder-node.source index d9094eb..f9ddd40 100644 --- a/rpmbuilder-node.source +++ b/rpmbuilder-node.source @@ -1,9 +1,9 @@ SOURCES/conf/builder.sudoers -SOURCES/conf/rpmmacros_el7 SOURCES/conf/rpmmacros_el8 +SOURCES/conf/rpmmacros_el9 SOURCES/conf/rpmlint SOURCES/nodeinfo SOURCES/initenv SOURCES/buildmon -SOURCES/buildmon.init +SOURCES/buildmon.service LICENSE diff --git a/rpmbuilder-node.spec b/rpmbuilder-node.spec index 4497467..bc1c077 100644 --- a/rpmbuilder-node.spec +++ b/rpmbuilder-node.spec @@ -1,57 +1,13 @@ ################################################################################ -%define _posixroot / -%define _root /root -%define _bin /bin -%define _sbin /sbin -%define _srv /srv -%define _home /home -%define _lib32 %{_posixroot}lib -%define _lib64 %{_posixroot}lib64 -%define _libdir32 %{_prefix}%{_lib32} -%define _libdir64 %{_prefix}%{_lib64} -%define _logdir %{_localstatedir}/log -%define _rundir %{_localstatedir}/run -%define _lockdir %{_localstatedir}/lock/subsys -%define _cachedir %{_localstatedir}/cache -%define _spooldir %{_localstatedir}/spool -%define _crondir %{_sysconfdir}/cron.d -%define _loc_prefix %{_prefix}/local -%define _loc_exec_prefix %{_loc_prefix} -%define _loc_bindir %{_loc_exec_prefix}/bin -%define _loc_libdir %{_loc_exec_prefix}/%{_lib} -%define _loc_libdir32 %{_loc_exec_prefix}/%{_lib32} -%define _loc_libdir64 %{_loc_exec_prefix}/%{_lib64} -%define _loc_libexecdir %{_loc_exec_prefix}/libexec -%define _loc_sbindir %{_loc_exec_prefix}/sbin -%define _loc_bindir %{_loc_exec_prefix}/bin -%define _loc_datarootdir %{_loc_prefix}/share -%define _loc_includedir %{_loc_prefix}/include -%define _loc_mandir %{_loc_datarootdir}/man -%define _rpmstatedir %{_sharedstatedir}/rpm-state -%define _pkgconfigdir %{_libdir}/pkgconfig - -%define __ln %{_bin}/ln -%define __touch %{_bin}/touch -%define __service %{_sbin}/service -%define __chkconfig %{_sbin}/chkconfig -%define __ldconfig %{_sbin}/ldconfig -%define __groupadd %{_sbindir}/groupadd -%define __useradd %{_sbindir}/useradd -%define __userdel %{_sbindir}/userdel -%define __systemctl %{_bindir}/systemctl - -################################################################################ - -%define user_name builder -%define home_dir %{_home}/%{user_name} -%define service_name buildmon +%define user_name builder +%define home_dir /home/%{user_name} ################################################################################ Summary: Configuration package for rpmbuilder node Name: rpmbuilder-node -Version: 1.5.0 +Version: 1.6.0 Release: 0%{?dist} License: Apache License, Version 2.0 Group: Development/Tools @@ -63,8 +19,7 @@ BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Requires: rpm >= 4.8.0 rpm-build rpmdevtools -Requires: kaosv yum-utils spec-builddep +Requires: rpm >= 4.8.0 rpm-build rpmdevtools yum-utils spec-builddep Requires: perfecto >= 2.0 rpmlint Provides: %{name} = %{version}-%{release} @@ -84,16 +39,15 @@ utility. %install rm -rf %{buildroot} -install -dm 755 %{buildroot}%{_initddir} -install -dm 755 %{buildroot}%{_sysconfdir}/sysconfig -install -dm 755 %{buildroot}%{_sysconfdir}/sudoers.d -install -dm 755 %{buildroot}%{home_dir} -install -dm 755 %{buildroot}%{home_dir}/.config -install -dm 700 %{buildroot}%{home_dir}/.ssh +install -dDm 755 %{buildroot}%{_unitdir} +install -pm 644 buildmon.service %{buildroot}%{_unitdir}/ -install -pm 755 buildmon %{buildroot}%{home_dir}/ -install -pm 755 buildmon.init %{buildroot}%{_initddir}/%{service_name} +install -dDm 755 %{buildroot}%{_sysconfdir}/sudoers.d install -pm 644 builder.sudoers %{buildroot}%{_sysconfdir}/sudoers.d/%{user_name} + +install -dDm 755 %{buildroot}%{home_dir}/.config +install -dDm 700 %{buildroot}%{home_dir}/.ssh +install -pm 755 buildmon %{buildroot}%{home_dir}/ install -pm 755 nodeinfo %{buildroot}%{home_dir}/ install -pm 755 initenv %{buildroot}%{home_dir}/ install -pm 644 rpmlint %{buildroot}%{home_dir}/.config/ @@ -102,8 +56,8 @@ install -pm 644 rpmlint %{buildroot}%{home_dir}/.config/ install -pm 755 rpmmacros_el8 %{buildroot}%{home_dir}/.rpmmacros_rpmbuilder %endif -%if 0%{?rhel} == 7 -install -pm 755 rpmmacros_el7 %{buildroot}%{home_dir}/.rpmmacros_rpmbuilder +%if 0%{?rhel} == 9 +install -pm 755 rpmmacros_el9 %{buildroot}%{home_dir}/.rpmmacros_rpmbuilder %endif %clean @@ -113,7 +67,7 @@ rm -rf %{buildroot} %pre getent group %{user_name} >/dev/null || groupadd -r %{user_name} -getent passwd %{user_name} >/dev/null || useradd -r -g %{user_name} -d %{_home}/%{user_name} -s /bin/bash %{user_name} +getent passwd %{user_name} >/dev/null || useradd -r -g %{user_name} -d /home/%{user_name} -s /bin/bash %{user_name} %post chown -h -R %{user_name}:%{user_name} %{home_dir} @@ -129,24 +83,25 @@ if [[ $1 -eq 1 ]] ; then cat %{home_dir}/.rpmmacros_rpmbuilder > %{home_dir}/.rpmmacros - %{__service} %{service_name} start &> /dev/null || : - %{__chkconfig} --add %{service_name} - chown -h -R %{user_name}:%{user_name} %{home_dir} - %{__systemctl} restart sshd.service &>/dev/null || : + systemctl enable buildmon.service &>/dev/null || : + systemctl start buildmon.service &>/dev/null || : + + systemctl reload sshd.service &>/dev/null || : fi %preun if [[ $1 -eq 0 ]] ; then - %{__service} %{service_name} stop &> /dev/null || : + systemctl --no-reload disable buildmon.service &>/dev/null || : + systemctl stop buildmon.service &>/dev/null || : + userdel -r %{user_name} + rm -rf %{home_dir} fi %postun -if [[ $1 -eq 0 ]] ; then - %{__chkconfig} --del %{service_name} - %{__userdel} -r %{user_name} - rm -rf %{home_dir} +if [[ $1 -ge 1 ]] ; then + systemctl daemon-reload &>/dev/null || : fi ################################################################################ @@ -154,13 +109,17 @@ fi %files %defattr(-,root,root,-) %doc LICENSE -%{_initddir}/%{service_name} +%{_unitdir}/buildmon.service %{_sysconfdir}/sudoers.d/%{user_name} %{home_dir} ################################################################################ %changelog +* Wed Aug 21 2024 Anton Novojilov - 1.6.0-0 +- Removed EL 7 support +- Init script replaced by systemd service + * Mon Sep 25 2023 Anton Novojilov - 1.5.0-0 - Added spec-builddep to dependencies