diff --git a/ci-operator/step-registry/openshift/microshift/e2e/metal-tests/openshift-microshift-e2e-metal-tests-commands.sh b/ci-operator/step-registry/openshift/microshift/e2e/metal-tests/openshift-microshift-e2e-metal-tests-commands.sh index bdd87ab8503fb..a534140430440 100644 --- a/ci-operator/step-registry/openshift/microshift/e2e/metal-tests/openshift-microshift-e2e-metal-tests-commands.sh +++ b/ci-operator/step-registry/openshift/microshift/e2e/metal-tests/openshift-microshift-e2e-metal-tests-commands.sh @@ -166,6 +166,21 @@ EOF # If more tests are to be run in parallel the code should go in here # ###################################################################### +# Copy the scenario settings from the remote host back here so the +# test runner has access to them. +scp -r "${INSTANCE_PREFIX}:/home/${HOST_USER}/microshift/_output/test-images/scenario-info" "${ARTIFACT_DIR}" + +# Run the scenario tests, if the phase script exists +# (we can clean this up after the main PR lands) +cd /microshift/test || true +if [ -f ./bin/ci_phase_test.sh ]; then + ./bin/ci_phase_test.sh +fi + +# Copy the scenario settings from the remote host here *again* to +# include the log files and other outputs. +scp -r "${INSTANCE_PREFIX}:/home/${HOST_USER}/microshift/_output/test-images/scenario-info" "${ARTIFACT_DIR}" + # VM mapping # e2e: vm0 # cncf: vm1, vm2 diff --git a/ci-operator/step-registry/openshift/microshift/infra/aws/ec2/openshift-microshift-infra-aws-ec2-commands.sh b/ci-operator/step-registry/openshift/microshift/infra/aws/ec2/openshift-microshift-infra-aws-ec2-commands.sh index 0661c1b2b954a..1ae5f16ffea48 100644 --- a/ci-operator/step-registry/openshift/microshift/infra/aws/ec2/openshift-microshift-infra-aws-ec2-commands.sh +++ b/ci-operator/step-registry/openshift/microshift/infra/aws/ec2/openshift-microshift-infra-aws-ec2-commands.sh @@ -221,9 +221,10 @@ Resources: FromPort: 6443 ToPort: 6453 CidrIp: 0.0.0.0/0 + # Range for all dynamic port-forwarding for scenario tests, see boot phase for use - IpProtocol: tcp FromPort: 7000 - ToPort: 7010 + ToPort: 8000 CidrIp: 0.0.0.0/0 - IpProtocol: tcp FromPort: 30000 diff --git a/ci-operator/step-registry/openshift/microshift/infra/iso-boot/openshift-microshift-infra-iso-boot-commands.sh b/ci-operator/step-registry/openshift/microshift/infra/iso-boot/openshift-microshift-infra-iso-boot-commands.sh index 5717799879d4b..bde233fe40bb4 100644 --- a/ci-operator/step-registry/openshift/microshift/infra/iso-boot/openshift-microshift-infra-iso-boot-commands.sh +++ b/ci-operator/step-registry/openshift/microshift/infra/iso-boot/openshift-microshift-infra-iso-boot-commands.sh @@ -7,8 +7,11 @@ IP_ADDRESS="$(cat "${SHARED_DIR}"/public_address)" HOST_USER="$(cat "${SHARED_DIR}"/ssh_user)" INSTANCE_PREFIX="${HOST_USER}@${IP_ADDRESS}" +# May need to update openshift-microshift-infra-aws-ec2-commands.sh to +# open other ports if changing these settings. SSH_EXTERNAL_BASE_PORT=7000 -API_EXTERNAL_BASE_PORT=6000 +API_EXTERNAL_BASE_PORT=7100 +LB_EXTERNAL_BASE_PORT=7500 echo "Using Host $IP_ADDRESS" @@ -42,7 +45,6 @@ do set -xeuo pipefail cd ~/microshift -./scripts/devenv-builder/manage-vm.sh config ISO_FILE=\$(find ~/microshift/_output/image-builder -name "*.iso") sudo bash -c " \ @@ -60,7 +62,7 @@ sudo bash -c " \ " VM_IP=\$(./scripts/devenv-builder/manage-vm.sh ip -n ${VM_NAME}) -timeout 5m bash -c "until ssh -oStrictHostKeyChecking=accept-new redhat@\${VM_IP} 'echo hello'; do sleep 5; done" +timeout 8m bash -c "until ssh -oStrictHostKeyChecking=accept-new redhat@\${VM_IP} 'echo hello'; do sleep 5; done" cat << EOF2 > /tmp/config.yaml apiServer: @@ -93,8 +95,8 @@ set -xeuo pipefail cd ~/microshift VM_IP=\$(./scripts/devenv-builder/manage-vm.sh ip -n ${VM_NAME}) -timeout 5m bash -c "until ssh redhat@\${VM_IP} hostname; do sleep 5; done" -timeout 5m bash -c "date; until ssh redhat@\${VM_IP} \"sudo systemctl status greenboot-healthcheck | grep 'active (exited)'\"; do sleep 5; done; date" +timeout 8m bash -c "until ssh redhat@\${VM_IP} hostname; do sleep 5; done" +timeout 8m bash -c "date; until ssh redhat@\${VM_IP} \"sudo systemctl status greenboot-healthcheck | grep 'active (exited)'\"; do sleep 5; done; date" # Setup external access with port forwarding to allow running commands and tests from the CI container. sudo /sbin/iptables -I FORWARD -o virbr0 -p tcp -d \${VM_IP} --dport 6443 -j ACCEPT @@ -127,3 +129,19 @@ do echo "${SSH_EXTERNAL_PORT}" > "${SHARED_DIR}/vm_ssh_port_${i}" echo "redhat" > "${SHARED_DIR}/vm_user_${i}" done + +# Install the settings for the scenario runner. The ssh keys have +# already been copied into place in the iso-build step. +SETTINGS_FILE="${SHARED_DIR}/scenario_settings.sh" +cat <"${SETTINGS_FILE}" +PUBLIC_IP=${IP_ADDRESS} +SSH_PUBLIC_KEY=~/.ssh/id_rsa.pub +SSH_PRIVATE_KEY=~/.ssh/id_rsa +EOF +scp "${SETTINGS_FILE}" "${INSTANCE_PREFIX}:/home/${HOST_USER}/microshift/test/" + +# Run the in-repo ci phase script to create the VMs for the test scenarios. +ssh "${INSTANCE_PREFIX}" "/home/${HOST_USER}/microshift/test/bin/ci_phase_iso_boot.sh ${API_EXTERNAL_PORT} ${SSH_EXTERNAL_PORT} ${LB_EXTERNAL_BASE_PORT}" + +# Copy the scenario info directory from the host to our artifact directory. +scp -r "${INSTANCE_PREFIX}:/home/${HOST_USER}/microshift/_output/test-images/scenario-info" "${ARTIFACT_DIR}" diff --git a/ci-operator/step-registry/openshift/microshift/infra/iso-build/openshift-microshift-infra-iso-build-commands.sh b/ci-operator/step-registry/openshift/microshift/infra/iso-build/openshift-microshift-infra-iso-build-commands.sh index 98efe00f03485..bdacb45221b77 100644 --- a/ci-operator/step-registry/openshift/microshift/infra/iso-build/openshift-microshift-infra-iso-build-commands.sh +++ b/ci-operator/step-registry/openshift/microshift/infra/iso-build/openshift-microshift-infra-iso-build-commands.sh @@ -24,6 +24,12 @@ cat < /tmp/iso.sh #!/bin/bash set -xeuo pipefail +if ! sudo subscription-manager status >&/dev/null; then + sudo subscription-manager register \ + --org="\$(cat /tmp/subscription-manager-org)" \ + --activationkey="\$(cat /tmp/subscription-manager-act-key)" +fi + chmod 0755 ~ mkdir ~/rpms tar -xf /tmp/rpms.tar -C ~/rpms @@ -33,28 +39,29 @@ cp /tmp/ssh-publickey ~/.ssh/id_rsa.pub cp /tmp/ssh-privatekey ~/.ssh/id_rsa chmod 0400 ~/.ssh/id_rsa* -sudo subscription-manager register \ - --org="$(cat /var/run/rhsm/subscription-manager-org)" \ - --activationkey="$(cat /var/run/rhsm/subscription-manager-act-key)" +# Set up the pull secret in the expected location +export PULL_SECRET="\${HOME}/.pull-secret.json" +cp /tmp/pull-secret "\${PULL_SECRET}" cd ~/microshift -# Get firewalld and repos in place. Use scripts to get the right repos -# for each branch. -./scripts/devenv-builder/configure-vm.sh --no-build-deps --force-firewall /tmp/pull-secret -./scripts/image-builder/configure.sh -./scripts/image-builder/build.sh -pull_secret_file /tmp/pull-secret -microshift_rpms ~/rpms -authorized_keys_file /tmp/ssh-publickey -open_firewall_ports 6443:tcp + +./test/bin/ci_phase_iso_build.sh + +./scripts/image-builder/build.sh -pull_secret_file "\${PULL_SECRET}" -microshift_rpms ~/rpms -authorized_keys_file ~/.ssh/id_rsa.pub -open_firewall_ports 6443:tcp EOF chmod +x /tmp/iso.sh tar czf /tmp/microshift.tgz /microshift scp \ - /rpms.tar \ - /tmp/iso.sh \ - "${CLUSTER_PROFILE_DIR}/pull-secret" \ - ${CLUSTER_PROFILE_DIR}/ssh-privatekey \ - ${CLUSTER_PROFILE_DIR}/ssh-publickey \ - /tmp/microshift.tgz \ - "${INSTANCE_PREFIX}:/tmp" + /rpms.tar \ + /tmp/iso.sh \ + /var/run/rhsm/subscription-manager-org \ + /var/run/rhsm/subscription-manager-act-key \ + "${CLUSTER_PROFILE_DIR}/pull-secret" \ + "${CLUSTER_PROFILE_DIR}/ssh-privatekey" \ + "${CLUSTER_PROFILE_DIR}/ssh-publickey" \ + /tmp/microshift.tgz \ + "${INSTANCE_PREFIX}:/tmp" ssh "${INSTANCE_PREFIX}" "/tmp/iso.sh"