Skip to content

Commit

Permalink
test: disable openshift in edge-installer
Browse files Browse the repository at this point in the history
  • Loading branch information
mcattamoredhat committed Jun 12, 2024
1 parent 5d6cfc2 commit 092d65b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
33 changes: 16 additions & 17 deletions ostree-ng.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ UEFI_GUEST_ADDRESS=192.168.100.51
HTTP_GUEST_ADDRESS=192.168.100.52
PROD_REPO=/var/www/html/repo
STAGE_REPO_ADDRESS=192.168.200.1
STAGE_OCP4_ADDRESS=192.168.200.2
STAGE_OCP4_SERVER_NAME="edge-stage-server"
STAGE_OCP4_REPO_URL="http://${STAGE_OCP4_SERVER_NAME}-${QUAY_REPO_TAG}-rhel-edge.apps.ocp-c1.prod.psi.redhat.com/repo/"
STAGE_OCP4_REPO_URL="http://${STAGE_OCP4_ADDRESS}:8080/repo/"
CONTAINER_IMAGE_TYPE=edge-container
INSTALLER_IMAGE_TYPE=edge-installer
CONTAINER_FILENAME=container.tar
Expand Down Expand Up @@ -675,28 +676,22 @@ fi
greenprint "Prepare container network"
sudo podman network inspect edge >/dev/null 2>&1 || sudo podman network create --driver=bridge --subnet=192.168.200.0/24 --gateway=192.168.200.254 edge

# Run stage repo in OCP4
greenprint "Running stage repo in OCP4"
oc login --token="${OCP4_TOKEN}" --server=https://api.ocp-c1.prod.psi.redhat.com:6443 -n rhel-edge --insecure-skip-tls-verify
oc process -f tools/edge-stage-server-template.yaml -p EDGE_STAGE_REPO_TAG="${QUAY_REPO_TAG}" -p EDGE_STAGE_SERVER_NAME="${STAGE_OCP4_SERVER_NAME}" | oc apply -f -
# Run stage repo in podman instead of OCP4
QUAY_REPO_URL_AUX=$(echo ${QUAY_REPO_URL} | grep -oP '(quay.*)')
sudo podman pull "${QUAY_REPO_URL_AUX}:${QUAY_REPO_TAG}"
sudo podman images
STAGE_PODMAN_IMAGE_ID=$(sudo podman images --format "{{.ID}}")
sudo podman run -d --name test-ocp4-container --network edge --ip "${STAGE_OCP4_ADDRESS}" "${STAGE_PODMAN_IMAGE_ID}"

for _ in $(seq 0 60); do
RETURN_CODE=$(curl -o /dev/null -s -w "%{http_code}" "${STAGE_OCP4_REPO_URL}refs/heads/${OSTREE_REF}")
if [[ $RETURN_CODE == 200 ]]; then
echo "Stage repo is ready"
break
fi
sleep 10
done
# Wait for container to be running
until [ "$(sudo podman inspect -f '{{.State.Running}}' test-ocp4-container)" == "true" ]; do
sleep 1;
done;

# Sync installer ostree content
greenprint "Sync ostree repo with stage repo"
sudo ostree --repo="$PROD_REPO" pull --mirror edge-stage-ocp4 "$OSTREE_REF"

# Clean up OCP4
greenprint "Clean up OCP4"
oc delete pod,rc,service,route,dc -l app="${STAGE_OCP4_SERVER_NAME}-${QUAY_REPO_TAG}"

# Clean compose and blueprints.
greenprint "🧹 Clean up compose"
sudo composer-cli compose delete "${COMPOSE_ID}" > /dev/null
Expand All @@ -705,6 +700,10 @@ sudo composer-cli blueprints delete container > /dev/null
greenprint "Remove tag from quay.io repo"
skopeo delete --creds "${QUAY_USERNAME}:${QUAY_PASSWORD}" "${QUAY_REPO_URL}:${QUAY_REPO_TAG}"

greenprint "Remove OCP4 container and image"
sudo podman rm -f test-ocp4-container
sudo podman rmi -f "${OCP4_IMAGE_ID}"

########################################################
##
## rhel-edge installer image building from container image
Expand Down
3 changes: 0 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ function greenprint {
sudo dnf install -y glibc-langpack-en
sudo localectl set-locale LANG=en_US.UTF-8

# Install openshift client
curl https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz | sudo tar -xz -C /usr/local/bin/

# Install required packages
greenprint "Install required packages"
sudo dnf install -y --nogpgcheck httpd osbuild osbuild-composer composer-cli podman skopeo wget firewalld lorax xorriso curl jq expect qemu-img qemu-kvm libvirt-client libvirt-daemon-kvm libvirt-daemon virt-install rpmdevtools createrepo_c
Expand Down

0 comments on commit 092d65b

Please sign in to comment.