Skip to content

Commit

Permalink
Replace yum-cron with dnf-automatic to support centos 8 (#2547)
Browse files Browse the repository at this point in the history
Both CentOS 7 and CentOS 8 support dnf-automatic, so using that for cron update is preferred. This should enable using the same package on both systems.
  • Loading branch information
onetechnical authored Jul 14, 2021
1 parent ef53c00 commit 01248d2
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 51 deletions.
2 changes: 2 additions & 0 deletions installer/rpm/algorand/0dnf-algorand-hourly.cron
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec /usr/bin/dnf-automatic /etc/dnf/dnf-cron-algorand.conf
2 changes: 0 additions & 2 deletions installer/rpm/algorand/0yum-algorand-hourly.cron

This file was deleted.

23 changes: 14 additions & 9 deletions installer/rpm/algorand/algorand.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Release: 1
Summary: Algorand node software
URL: https://www.algorand.com
License: AGPL-3+
Requires: yum-cron
Requires: dnf-automatic

Requires: systemd
Requires(pre): shadow-utils

Expand Down Expand Up @@ -42,16 +43,19 @@ install -m 644 ${REPO_DIR}/installer/algorand.service %{buildroot}/lib/systemd/s
install -m 644 ${REPO_DIR}/installer/algorand@.service %{buildroot}/lib/systemd/system/algorand@.service

mkdir -p %{buildroot}/etc/cron.hourly
install -m 755 ${REPO_DIR}/installer/rpm/algorand/0yum-algorand-hourly.cron %{buildroot}/etc/cron.hourly/0yum-algorand-hourly.cron
install -m 755 ${REPO_DIR}/installer/rpm/algorand/0dnf-algorand-hourly.cron %{buildroot}/etc/cron.hourly/0dnf-algorand-hourly.cron


mkdir -p %{buildroot}/etc/dnf
install -m 644 ${REPO_DIR}/installer/rpm/algorand/dnf-cron-algorand.conf %{buildroot}/etc/dnf/dnf-cron-algorand.conf

mkdir -p %{buildroot}/etc/yum
install -m 644 ${REPO_DIR}/installer/rpm/algorand/yum-cron-algorand.conf %{buildroot}/etc/yum/yum-cron-algorand.conf

mkdir -p %{buildroot}/etc/pki/rpm-gpg
install -m 644 ${REPO_DIR}/installer/rpm/RPM-GPG-KEY-Algorand %{buildroot}/etc/pki/rpm-gpg/RPM-GPG-KEY-Algorand

mkdir -p %{buildroot}/usr/lib/algorand/yum.repos.d
install -m 644 ${REPO_DIR}/installer/rpm/algorand/algorand.repo %{buildroot}/usr/lib/algorand/yum.repos.d/algorand.repo
mkdir -p %{buildroot}/usr/lib/algorand/dnf.repos.d
install -m 644 ${REPO_DIR}/installer/rpm/algorand/algorand.repo %{buildroot}/usr/lib/algorand/dnf.repos.d/algorand.repo


mkdir -p %{buildroot}/var/lib/algorand/genesis
if [ "%{RELEASE_GENESIS_PROCESS}" != "x" ]; then
Expand Down Expand Up @@ -88,10 +92,11 @@ fi
%endif
/lib/systemd/system/algorand.service
/lib/systemd/system/algorand@.service
%config(noreplace) /etc/cron.hourly/0yum-algorand-hourly.cron
%config(noreplace) /etc/yum/yum-cron-algorand.conf
%config(noreplace) /etc/cron.hourly/0dnf-algorand-hourly.cron
%config(noreplace) /etc/dnf/dnf-cron-algorand.conf

/etc/pki/rpm-gpg/RPM-GPG-KEY-Algorand
/usr/lib/algorand/yum.repos.d/algorand.repo
/usr/lib/algorand/dnf.repos.d/algorand.repo

%changelog

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ reposdir = /usr/lib/algorand/yum.repos.d
# -4: critical
# -3: critical+errors
# -2: critical+errors+warnings (default)
debuglevel = -2
debuglevel = 2

# skip_broken = True
mdpolicy = group:main
Expand Down
1 change: 1 addition & 0 deletions scripts/build_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ if [ "${CHANNEL}" = "" ]; then
fi

VARIATION_ARRAY=(${VARIATIONS})
echo "Variation Array: ${VARIATION_ARRAY}"

# Set the TIMESTAMP to use for the genesis.json file - set here so all packages use the same number
TIMESTAMP=
Expand Down
5 changes: 4 additions & 1 deletion scripts/compute_package_name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
CHANNEL=${1:-stable}
NAME=${2:-algorand}

if [ ! -z ${PACKAGE_NAME_EXTENSION} ]; then
NAME="${NAME}-${PACKAGE_NAME_EXTENSION}"
fi

if [ "$CHANNEL" = beta ]; then
echo "$NAME-beta"
elif [ "$CHANNEL" = nightly ]; then
echo "$NAME-nightly"
else
echo "$NAME"
fi

4 changes: 2 additions & 2 deletions scripts/release/mule/Makefile.mule
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ mule-docker:

mule-package-%: PKG_TYPE=$*
mule-package-%:
echo Building algorand package...
echo Building algorand package $(PKG_TYPE)...
scripts/release/mule/package/$(PKG_TYPE)/package.sh algorand
echo Building algorand-devtools package...
echo Building algorand-devtools package $(PKG_TYPE)...
scripts/release/mule/package/$(PKG_TYPE)/package.sh algorand-devtools

mule-releases-page:
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/mule/package/rpm/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ find tmp/node_pkgs -name "*${CHANNEL}*linux*${VERSION}*.tar.gz" | cut -d '/' -f3
INSTALLER_DIR=algorand
fi
trap 'rm -rf $TEMPDIR' 0
< "./installer/rpm/$INSTALLER_DIR/$INSTALLER_DIR.spec" \
< "./installer/rpm/$INSTALLER_DIR/$ALGORAND_PACKAGE_NAME.spec" \
sed -e "s,@PKG_NAME@,$ALGORAND_PACKAGE_NAME," \
-e "s,@VER@,$VERSION," \
-e "s,@ARCH@,$ARCH_UNAME," \
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/mule/test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ else
# We need to install this since it's not being installed by a package manager.
# Normally, this is installed for us b/c it's a dependency.
# See `./installer/rpm/algorand/algorand.spec`.
yum install yum-cron -y
dnf install dnf-automatic -y
#
# Note that the RPM package DOES NOT have the CHANNEL in its filename (unlike DEB),
# instead it contains the package name.
Expand Down
10 changes: 1 addition & 9 deletions scripts/release/test/util/test_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,9 @@ set -ex

. "${HOME}"/build_env

# TODO: The following error happens on centos:8
#
# Error:
# Problem: conflicting requests
# - nothing provides yum-cron needed by algorand-2.0.4-1.x86_64
# (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
# smoke_test.sh: line 47: algod: command not found

OS_LIST=(
centos:7
# centos:8
centos:8
fedora:28
ubuntu:16.04
ubuntu:18.04
Expand Down
25 changes: 0 additions & 25 deletions test/muleCI/mule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,6 @@ agents:
buildArgs:
- GOLANG_VERSION=`./scripts/get_golang_version.sh`
- ARCH=amd64
- name: cicd.centos8.amd64
dockerFilePath: docker/build/cicd.centos8.Dockerfile
image: algorand/go-algorand-ci-linux-centos8
version: scripts/configure_dev-deps.sh
arch: amd64
env:
- TRAVIS_BRANCH=${GIT_BRANCH}
- NETWORK=$NETWORK
- VERSION=$VERSION
- BUILD_NUMBER=$BUILD_NUMBER
buildArgs:
- GOLANG_VERSION=`./scripts/get_golang_version.sh`
- ARCH=amd64
- name: cicd.ubuntu.arm64
dockerFilePath: docker/build/cicd.ubuntu.Dockerfile
image: algorand/go-algorand-ci-linux-ubuntu
Expand Down Expand Up @@ -111,21 +98,11 @@ tasks:
agent: cicd.centos.amd64
target: archive

- task: docker.Make
name: archive.amd64.centos8
agent: cicd.centos8.amd64
target: archive

- task: docker.Make
name: rpm.amd64
agent: cicd.centos.amd64
target: mule-package-rpm

- task: docker.Make
name: rpm.amd64.centos8
agent: cicd.centos8.amd64
target: mule-package-rpm

- task: docker.Make
name: deb.amd64
agent: cicd.ubuntu.amd64
Expand Down Expand Up @@ -230,13 +207,11 @@ jobs:
- stash.Unstash.linux-arm
- docker.Make.deb.amd64
- docker.Make.rpm.amd64
- docker.Make.rpm.amd64.centos8
- stash.Stash.packages
archive-linux-amd64:
tasks:
- stash.Unstash.packages
- docker.Make.archive.amd64
- docker.Make.archive.amd64.centos8
package-docker:
tasks:
- docker.Make.docker-image
Expand Down

0 comments on commit 01248d2

Please sign in to comment.