forked from rancher/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6039e6
commit 262ccfd
Showing
4 changed files
with
196 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: temp test | ||
on: | ||
push: | ||
branches: | ||
- e2e-k3s | ||
|
||
env: | ||
TEST_USERNAME: admin | ||
TEST_PASSWORD: password | ||
CATTLE_BOOTSTRAP_PASSWORD: password | ||
TEST_BASE_URL: https://127.0.0.1:8005 | ||
API: https://127.0.0.1 | ||
TEST_PROJECT_ID: rancher-dashboard | ||
CYPRESS_API_URL: http://139.59.134.103:1234/ | ||
TEST_RUN_ID: ${{github.run_number}}-${{github.run_attempt}}-${{github.event.pull_request.title || github.event.head_commit.message}} | ||
# Build the dashboard to use in tests. When set to false it will grab `latest` from CDN (useful for running e2e tests quickly) | ||
BUILD_DASHBOARD: false | ||
|
||
E2E_BUILD_DIST_NAME: dist | ||
E2E_BUILD_DIST_DIR: dist | ||
E2E_BUILD_DIST_EMBER_NAME: dist_ember | ||
E2E_BUILD_DIST_EMBER_DIR: dist_ember | ||
|
||
jobs: | ||
# e2e-ui-build: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# with: | ||
# fetch-depth: 1 | ||
# - uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: '14.x' | ||
# cache: 'yarn' | ||
# - name: Install packages | ||
# run: yarn install:ci | ||
# - name: Build e2e | ||
# run: yarn e2e:build | ||
# - name: Upload e2e build | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: ${{ env.E2E_BUILD_DIST_NAME }} | ||
# path: ${{ env.E2E_BUILD_DIST_DIR }}/ | ||
# if-no-files-found: error | ||
# retention-days: 10 | ||
# compression-level: 9 | ||
# - name: Upload e2e build ember | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: ${{ env.E2E_BUILD_DIST_EMBER_NAME }} | ||
# path: ${{ env.E2E_BUILD_DIST_EMBER_DIR }}/ | ||
# if-no-files-found: error | ||
# retention-days: 10 | ||
# compression-level: 9 | ||
test-k3s: | ||
# needs: e2e-ui-build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- name: Run Rancher | ||
run: yarn e2e:k3s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
#!/usr/bin/env bash | ||
|
||
K3S_VERSION=v1.28.8+k3s1 | ||
|
||
# Image version | ||
# RANCHER_IMG_VERSION=v2.9-c9be13b09329bbee60a5f6419d500198f83c44d1-head | ||
RANCHER_IMG_VERSION=v2.9-head | ||
DASHBOARD_URL=127.0.0.1.sslip.io | ||
|
||
DIR=$(cd $(dirname $0)/..; pwd) | ||
|
||
# See `script/build-e2e`. This is the ui builds we wish to test | ||
DASHBOARD_DIST=${DIR}/dist | ||
EMBER_DIST=${DIR}/dist_ember | ||
|
||
echo "Installing k3s (with kubectl)....." | ||
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION="$K3S_VERSION" sh - | ||
|
||
sudo k3s kubectl get nodes | ||
k3s kubectl get nodes | ||
kubectl get nodes | ||
|
||
|
||
# okay=0 | ||
|
||
# while [ $okay -lt 20 ]; do | ||
# STATUS=$(curl --silent --head -k http://localhost:8080/version | awk '/^HTTP/{print $2}') | ||
|
||
# echo "Status: $STATUS (Try: $okay)" | ||
|
||
# okay=$((okay+1)) | ||
|
||
# if [ "$STATUS" == "200" ]; then | ||
# okay=100 | ||
# else | ||
# sleep 5 | ||
# fi | ||
# done | ||
|
||
# if [ "$STATUS" != "200" ]; then | ||
# echo "Dashboard did not become available in a reasonable time" | ||
# exit 1 | ||
# fi | ||
|
||
|
||
|
||
echo "Installing helm....." | ||
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | ||
chmod 700 get_helm.sh | ||
./get_helm.sh | ||
|
||
echo "Installing cert-manager....." | ||
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.7.1/cert-manager.crds.yaml | ||
helm repo add jetstack https://charts.jetstack.io | ||
helm repo update | ||
helm install cert-manager jetstack/cert-manager \ | ||
--namespace cert-manager \ | ||
--create-namespace \ | ||
--version v1.7.1 | ||
|
||
echo "Wait for cert manager to come up..... TODO: RC" | ||
kubectl get pods --namespace cert-manager | ||
|
||
echo "Setting up Rancher Repo....." | ||
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest | ||
helm repo update | ||
|
||
# TODO: RC wire in host name to e2e tests | ||
|
||
echo "Installing Rancher....." | ||
kubectl create ns cattle-system | ||
helm install rancher rancher-latest/rancher \ | ||
--namespace cattle-system \ | ||
--set hostname=$DASHBOARD_URL \ | ||
--set replicas=1 \ | ||
--set 'extraEnv[0].name=CATTLE_AGENT_IMAGE' \ | ||
--set 'extraEnv[0].value=rancher/rancher:$RANCHER_IMG_VERSION' \ | ||
--set rancherImage=rancher/rancher \ | ||
--set rancherImageTag=$RANCHER_IMG_VERSION \ | ||
--set rancherImagePullPolicy=Always \ | ||
--set 'extraEnv[0].name=CATTLE_UI_OFFLINE_PREFERRED' \ | ||
--set 'extraEnv[0].value=true' \ | ||
--set 'extraEnv[0].name=CATTLE_BOOTSTRAP_PASSWORD' \ | ||
--set 'extraEnv[0].value=password' \ | ||
--set passwordMinLength=3 \ | ||
|
||
echo "Waiting for Rancher to come up..." | ||
# Wait for Rancher to come up | ||
kubectl -n cattle-system rollout status deploy/rancher | ||
|
||
echo "Waiting for dashboard UI to be reachable (initial 20s wait) ..." | ||
|
||
sleep 20 | ||
|
||
echo "Waiting for dashboard UI to be reachable ..." | ||
|
||
okay=0 | ||
|
||
while [ $okay -lt 20 ]; do | ||
STATUS=$(curl --silent --head -k $DASHBOARD_URL/dashboard/ | awk '/^HTTP/{print $2}') | ||
|
||
echo "Status: $STATUS (Try: $okay)" | ||
|
||
okay=$((okay+1)) | ||
|
||
if [ "$STATUS" == "200" ]; then | ||
okay=100 | ||
else | ||
sleep 5 | ||
fi | ||
done | ||
|
||
if [ "$STATUS" != "200" ]; then | ||
echo "Dashboard did not become available in a reasonable time" | ||
exit 1 | ||
fi | ||
|
||
echo "Updating UI within Rancher container" | ||
|
||
# Map latest build into Rancher TODO: RC | ||
POD_NAME=${kubectl get pods --selector=app=rancher -n cattle-system | tail -n 1 | cut -d ' ' -f1|tr '\n' ' '} | ||
echo "POD NAME: $POD_NAME" | ||
|
||
# Note - these will pick the first container within the pod, so replicas=1 above is imporatnt | ||
kubectl cp $DASHBOARD_DIST $POD_NAME:/usr/share/rancher/ui-dashboard/dashboard # TODO: RC probably copeis folder INTO target folder | ||
kubectl cp $EMBER_DIST $POD_NAME:/usr/share/rancher/ui # TODO: RC probably copeis folder INTO target folder | ||
# -v ${DASHBOARD_DIST}:/usr/share/rancher/ui-dashboard/dashboard \ | ||
# -v ${EMBER_DIST}:/usr/share/rancher/ui \ | ||
|
||
echo "Dashboard UI is ready" |