Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build subscription-manager-rhsm-certificates for OL8 and OL9 #13

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion oraclelinux8/build-rhsm-ol8.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash
#
# Copyright (c) 2021, 2023 Avi Miller
# Copyright (c) 2021, 2024 Avi Miller
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
#
# find the latest upstream version of the subscription-manager RPM
RHSM_NVR=$(docker run --rm -it -v "$PWD/scripts:/scripts" registry.access.redhat.com/ubi8/ubi rpm -q --queryformat="%{VERSION}:%{RELEASE}" subscription-manager)
RHSM_CERTS_VERSION=$(docker run --rm -it -v "$PWD/scripts:/scripts" registry.access.redhat.com/ubi8/ubi rpm -q --queryformat="%{VERSION}" subscription-manager-rhsm-certificates)
RHSM_VERSION=$(echo "$RHSM_NVR" | cut -d: -f1)
RHSM_REL=$(echo "$RHSM_NVR" | cut -d: -f2)
RHSM_RELEASE=$(echo "$RHSM_REL" | cut -d. -f1)
Expand All @@ -26,5 +27,6 @@ docker run --rm -it \
-e RHSM_VERSION="$RHSM_VERSION" \
-e RHSM_RELEASE="$RHSM_RELEASE" \
-e RHSM_DIST="$RHSM_DIST" \
-e RHSM_CERTS_VERSION="$RHSM_CERTS_VERSION" \
-e GPG_NAME_EMAIL \
"build-rhsm:ol8-$IMG_VER"
22 changes: 16 additions & 6 deletions oraclelinux8/scripts/build-rhsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,31 @@
# Copyright (c) 2021, 2024 Avi Miller
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

# Clone the repo
# Clone the repos
cd /root || exit
git clone https://github.com/candlepin/subscription-manager.git
git clone https://github.com/candlepin/subscription-manager-rhsm-certificates

# Checkout the release tag
# Checkout the subscription-manager release tag and build with tito
cd /root/subscription-manager || exit
git checkout "subscription-manager-$RHSM_VERSION-$RHSM_RELEASE"

# Use tito to build the source RPM
tito build --tag="subscription-manager-$RHSM_VERSION-$RHSM_RELEASE" --srpm --dist=".$RHSM_DIST" --offline

# Checkout the certificates and build with tito
cd /root/subscription-manager-rhsm-certificates || exit
git checkout "subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE"
tito build --tag="subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE" --srpm --dist=".$RHSM_DIST" --offline

# Copy the source RPMs to the RPM tree
cp "/tmp/tito/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" /root/rpmbuild/SRPMS/
cp "/tmp/tito/subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" /root/rpmbuild/SRPMS/

# Build the binary RPMs
dnf builddep -y "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
rpmbuild --rebuild "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
dnf builddep -y "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" \
"/root/rpmbuild/SRPMS/subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"

rpmbuild --rebuild "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" \
"/root/rpmbuild/SRPMS/subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"

# Sign the binary RPMs if the required files and envvar are provided
if [ -f /gpg/key.asc ] && [ -f /gpg/passphrase ] && [ "$GPG_NAME_EMAIL" ]; then
Expand Down
2 changes: 2 additions & 0 deletions oraclelinux9/build-rhsm-ol9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#
# find the latest upstream version of the subscription-manager RPM
RHSM_NVR=$(docker run --rm -it -v "$PWD/scripts:/scripts" registry.access.redhat.com/ubi9/ubi rpm -q --queryformat="%{VERSION}:%{RELEASE}" subscription-manager)
RHSM_CERTS_VERSION=$(docker run --rm -it -v "$PWD/scripts:/scripts" registry.access.redhat.com/ubi9/ubi rpm -q --queryformat="%{VERSION}" subscription-manager-rhsm-certificates)
RHSM_VERSION=$(echo "$RHSM_NVR" | cut -d: -f1)
RHSM_REL=$(echo "$RHSM_NVR" | cut -d: -f2)
RHSM_RELEASE=$(echo "$RHSM_REL" | cut -d. -f1)
Expand All @@ -25,6 +26,7 @@ docker run --rm -it \
-v "$PWD/output:/output" \
-e RHSM_VERSION="$RHSM_VERSION" \
-e RHSM_RELEASE="$RHSM_RELEASE" \
-e RHSM_CERTS_VERSION="$RHSM_CERTS_VERSION" \
-e RHSM_DIST="$RHSM_DIST" \
-e GPG_NAME_EMAIL \
"build-rhsm:ol9-$IMG_VER"
22 changes: 16 additions & 6 deletions oraclelinux9/scripts/build-rhsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,31 @@
# Copyright (c) 2021, 2024 Avi Miller
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

# Clone the repo
# Clone the repos
cd /root || exit
git clone https://github.com/candlepin/subscription-manager.git
git clone https://github.com/candlepin/subscription-manager-rhsm-certificates

# Checkout the release tag
# Checkout the release tag and use tito to build the source RPM
cd /root/subscription-manager || exit
git checkout "subscription-manager-$RHSM_VERSION-$RHSM_RELEASE"

# Use tito to build the source RPM
tito build --tag="subscription-manager-$RHSM_VERSION-$RHSM_RELEASE" --srpm --dist=".$RHSM_DIST" --offline

# Checkout the certificates and build with tito
cd /root/subscription-manager-rhsm-certificates || exit
git checkout "subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE"
tito build --tag="subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE" --srpm --dist=".$RHSM_DIST" --offline

# Copy the source RPMs to the RPM tree
cp "/tmp/tito/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" /root/rpmbuild/SRPMS/
cp "/tmp/tito/subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" /root/rpmbuild/SRPMS/

# Build the binary RPMs
dnf builddep -y "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
rpmbuild --rebuild "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"
dnf builddep -y "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" \
"/root/rpmbuild/SRPMS/subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"

rpmbuild --rebuild "/root/rpmbuild/SRPMS/subscription-manager-$RHSM_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm" \
"/root/rpmbuild/SRPMS/subscription-manager-rhsm-certificates-$RHSM_CERTS_VERSION-$RHSM_RELEASE.$RHSM_DIST.src.rpm"

# Sign the binary RPMs if the required files and envvar are provided
if [ -f /gpg/key.asc ] && [ -f /gpg/passphrase ] && [ "$GPG_NAME_EMAIL" ]; then
Expand Down
Loading