Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
test: add auth.json into /etc/ostree for registry auth
Browse files Browse the repository at this point in the history
All test repos have been moved to redhat_emp1 repo, all test repos
have to do auth before pull
  • Loading branch information
henrywang committed Feb 1, 2024
1 parent 7da13ad commit d1bcf56
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions os-replace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ case "$TEST_OS" in
SSH_USER="cloud-user"
sed "s/REPLACE_ME/${DOWNLOAD_NODE}/g" files/rhel-9-4.template | tee rhel-9-4.repo > /dev/null
ADD_REPO="COPY rhel-9-4.repo /etc/yum.repos.d/rhel-9-4.repo"
sed "s/REPLACE_ME/$(echo -n "${QUAY_USERNAME}:${QUAY_PASSWORD}" | base64 -w 0)/g" files/auth.template | tee auth.json > /dev/null
ADD_AUTH="COPY auth.json /etc/ostree/auth.json"
if [[ "$PLATFORM" == "aws" ]]; then
SSH_USER="ec2-user"
REPLACE_CLOUD_USER='RUN sed -i "s/name: cloud-user/name: ec2-user/g" /etc/cloud/cloud.cfg'
Expand All @@ -45,7 +43,6 @@ case "$TEST_OS" in
TIER1_IMAGE_URL="quay.io/centos-bootc/${IMAGE_NAME}:stream9"
SSH_USER="cloud-user"
ADD_REPO=""
ADD_AUTH=""
if [[ "$PLATFORM" == "aws" ]]; then
SSH_USER="ec2-user"
REPLACE_CLOUD_USER='RUN sed -i "s/name: cloud-user/name: ec2-user/g" /etc/cloud/cloud.cfg'
Expand All @@ -56,7 +53,6 @@ case "$TEST_OS" in
TIER1_IMAGE_URL="quay.io/centos-bootc/${IMAGE_NAME}:eln"
SSH_USER="fedora"
ADD_REPO=""
ADD_AUTH=""
;;
*)
redprint "Variable TEST_OS has to be defined"
Expand All @@ -67,13 +63,14 @@ esac
TEST_IMAGE_NAME="${IMAGE_NAME}-os_replace"
TEST_IMAGE_URL="quay.io/redhat_emp1/${TEST_IMAGE_NAME}:${QUAY_REPO_TAG}"

sed "s/REPLACE_ME/$(echo -n "${QUAY_USERNAME}:${QUAY_PASSWORD}" | base64 -w 0)/g" files/auth.template | tee auth.json > /dev/null
greenprint "Create $TEST_OS installation Containerfile"
tee "$INSTALL_CONTAINERFILE" > /dev/null << EOF
FROM "$TIER1_IMAGE_URL"
$ADD_REPO
RUN dnf -y install python3 cloud-init && \
dnf -y clean all
$ADD_AUTH
COPY auth.json /etc/ostree/auth.json
$REPLACE_CLOUD_USER
EOF

Expand Down

0 comments on commit d1bcf56

Please sign in to comment.