Skip to content

Commit 4f52495

Browse files
committed
Force registration
1 parent 2f6e3f3 commit 4f52495

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/lockfile-generators/helpers/hermeto-fetch-rpm.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ CERT_DIR="${CERT_DIR:-${SUBSCRIPTION_CERT_DIR:-}}"
7878
ACTIVATION_KEY="${ACTIVATION_KEY:-${SUBSCRIPTION_ACTIVATION_KEY:-}}"
7979
ORG="${ORG:-${SUBSCRIPTION_ORG:-}}"
8080

81+
# Auto-detect entitlement certs left by the GHA "Add subscriptions" step,
82+
# which writes PEM files to entitlement/ and configures mounts.conf.
83+
if [[ -z "$CERT_DIR" ]] && ls entitlement/*.pem &>/dev/null; then
84+
echo "--- Auto-detected entitlement/ directory from GHA subscription step ---"
85+
CERT_DIR="entitlement"
86+
fi
87+
8188
# Build the hermeto JSON input — add SSL config when using RHEL subscription
8289
# so hermeto can authenticate to cdn.redhat.com for entitled content.
8390
HERMETO_JSON='{"type": "rpm"}'
@@ -118,7 +125,7 @@ elif [[ -n "$ACTIVATION_KEY" ]] && [[ -n "$ORG" ]]; then
118125
-e SM_ORG="$ORG" \
119126
-e SM_KEY="$ACTIVATION_KEY" \
120127
"$UBI9_IMAGE" \
121-
sh -c 'subscription-manager register --org="$SM_ORG" --activationkey="$SM_KEY" >/dev/null && tar -cf - /etc/pki/entitlement/ /etc/rhsm/ca/' \
128+
sh -c 'subscription-manager register --force --org="$SM_ORG" --activationkey="$SM_KEY" >/dev/null && tar -cf - /etc/pki/entitlement/ /etc/rhsm/ca/' \
122129
> "$CERT_TAR" 2>"$REG_LOG" || true
123130
"$_xtrace_was_set" && set -x
124131
if [[ -s "$CERT_TAR" ]]; then

0 commit comments

Comments
 (0)