Skip to content

Nightly-Portal-E2E-Pipeline #510

Nightly-Portal-E2E-Pipeline

Nightly-Portal-E2E-Pipeline #510

name: Nightly-Portal-E2E-Pipeline
on:
schedule:
- cron: "30 22 * * *" # Daily 04:30 AM in midnight
# All Environments variables declared and set here.
env:
TAG: "ci"
MODULE: "All"
SELF_AGENT: "self-agent"
EXTERNAL_AGENT: "external-agent"
CS_MODE_NAMESPACE: "litmus"
NS_MODE_NAMESPACE: "default"
# Jobs for deploying and testing litmus-portal on a KinD Cluster
jobs:
Cluster-Scope-Mode:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
AcessType: [NodePort, Ingress, LoadBalancer]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 14
- uses: AbsaOSS/k3d-action@v2
name: Create 1st Cluster
with:
cluster-name: ${{ env.SELF_AGENT }}
k3d-version: v5.2.2
args: >
--agents 3
--k3s-arg "--no-deploy=traefik, metrics-server@server:*"
- name: Configuring and Testing the Cluster Installation
run: |
kubectl cluster-info --context k3d-${{ env.SELF_AGENT }}
kubectl get nodes
kubectl get pods -n kube-system
- name: Deploying Litmus-Portal using **k8s-manifest**
run: |
chmod 755 ./litmus/install-portal.sh
./litmus/install-portal.sh
env:
PORTAL_VERSION: ${{ env.TAG }}
ACCESS_TYPE: ${{ matrix.AcessType }}
NAMESPACE: ${{ env.CS_MODE_NAMESPACE }}
INSTALLATION_MODE: "CS-MODE"
# Fetching Access Point & Token for accessing kube api server
- run: |
kubectl config view -o jsonpath='{"Cluster name\tServer\n"}{range .clusters[*]}{.name}{"\t"}{.cluster.server}{"\n"}{end}'
export CLUSTER_NAME=k3d-${SELF_AGENT}
KUBE_API_SERVER=$(kubectl config view -o jsonpath="{.clusters[?(@.name==\"$CLUSTER_NAME\")].cluster.server}")
KUBE_API_TOKEN=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}"|base64 --decode)
echo "KUBE_API_SERVER=$KUBE_API_SERVER" >> $GITHUB_ENV
echo "KUBE_API_TOKEN=$KUBE_API_TOKEN" >> $GITHUB_ENV
# RBAC for allowing Cypress Runner to access Cluster resources
- run: |
kubectl apply -f Cypress/cypress-rbac.yml
- name: Running basic tests (Login and Onboarding Tests)
uses: cypress-io/github-action@v2
continue-on-error: false
with:
spec: cypress/integration/Basic_Setup/**/*.spec.js
working-directory: Cypress/
config-file: cypress.prod.json
env: true
env:
CYPRESS_BASE_URL: ${{ env.URL }}
- name: Verifying the execution-plane components
if: always()
run: |
kubectl config use-context k3d-${{ env.SELF_AGENT }}
source ./litmus/utils.sh
verify_all_components ${COMPONENTS} ${NAMESPACE}
wait_for_pods ${NAMESPACE} 720
env:
COMPONENTS: subscriber,chaos-exporter,chaos-operator-ce,event-tracker,workflow-controller
NAMESPACE: ${{ env.CS_MODE_NAMESPACE }}
- name: Running Post-Authentication Tests
uses: cypress-io/github-action@v2
if: always()
continue-on-error: false
with:
spec: cypress/integration/Parallel_Tests/**/*.spec.js
working-directory: Cypress/
config-file: cypress.prod.json
env: true
env:
CYPRESS_BASE_URL: ${{ env.URL }}
CYPRESS_KUBE_API_TOKEN: ${{ env.KUBE_API_TOKEN }}
CYPRESS_KUBE_API_SERVER: ${{ env.KUBE_API_SERVER}}
CYPRESS_AGENT_NAMESPACE: ${{ env.CS_MODE_NAMESPACE}}
CYPRESS_AGENT: "Self-Agent"
CYPRESS_TARGET_APP_NS: "default"
# TODO: Additional Tests will be added from here
- name: Portal Cleanup
if: always()
run: |
kubectl config use-context k3d-${{ env.SELF_AGENT }}
chmod 755 ./litmus/uninstall-portal.sh
./litmus/uninstall-portal.sh
env:
PORTAL_VERSION: ${{ env.TAG }}
- uses: actions/upload-artifact@v1
if: failure()
with:
name: Cluster-Scope-Mode-${{ matrix.AcessType }}-screenshots
path: Cypress/cypress/screenshots
Namespaced-Scope-Mode:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
AcessType: [NodePort, Ingress, LoadBalancer]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 14
- uses: AbsaOSS/k3d-action@v2
name: Create 1st Cluster
with:
cluster-name: ${{ env.SELF_AGENT }}
k3d-version: v5.2.2
args: >
--agents 3
--k3s-arg "--no-deploy=traefik, metrics-server@server:*"
- name: Configuring and Testing the Cluster Installation
run: |
kubectl cluster-info --context k3d-${{ env.SELF_AGENT }}
kubectl get nodes
kubectl get pods -n kube-system
- name: Deploying Litmus-Portal using **k8s-manifest**
run: |
chmod 755 ./litmus/install-portal.sh
./litmus/install-portal.sh
env:
PORTAL_VERSION: ${{ env.TAG }}
ACCESS_TYPE: ${{ matrix.AcessType }}
NAMESPACE: ${{ env.NS_MODE_NAMESPACE }}
INSTALLATION_MODE: "NS-MODE"
# Fetching Access Point & Token for accessing kube api server
- run: |
kubectl config view -o jsonpath='{"Cluster name\tServer\n"}{range .clusters[*]}{.name}{"\t"}{.cluster.server}{"\n"}{end}'
export CLUSTER_NAME=k3d-${SELF_AGENT}
KUBE_API_SERVER=$(kubectl config view -o jsonpath="{.clusters[?(@.name==\"$CLUSTER_NAME\")].cluster.server}")
KUBE_API_TOKEN=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}"|base64 --decode)
echo "KUBE_API_SERVER=$KUBE_API_SERVER" >> $GITHUB_ENV
echo "KUBE_API_TOKEN=$KUBE_API_TOKEN" >> $GITHUB_ENV
# RBAC for allowing Cypress Runner to access Cluster resources
- run: |
kubectl apply -f Cypress/cypress-rbac.yml
- name: Running basic tests (Login and Onboarding Tests)
uses: cypress-io/github-action@v2
continue-on-error: false
with:
spec: cypress/integration/Basic_Setup/**/*.spec.js
working-directory: Cypress/
config-file: cypress.prod.json
env: true
env:
CYPRESS_BASE_URL: ${{ env.URL }}
- name: Verifying the execution-plane components
if: always()
run: |
kubectl config use-context k3d-${{ env.SELF_AGENT }}
source ./litmus/utils.sh
verify_all_components ${COMPONENTS} ${NAMESPACE}
wait_for_pods ${NAMESPACE} 720
env:
COMPONENTS: subscriber,chaos-exporter,chaos-operator-ce,event-tracker,workflow-controller
NAMESPACE: ${{ env.NS_MODE_NAMESPACE }}
- name: Running Post-Authentication Tests
uses: cypress-io/github-action@v2
if: always()
continue-on-error: false
with:
spec: cypress/integration/Parallel_Tests/**/*.spec.js
working-directory: Cypress/
config-file: cypress.prod.json
env: true
env:
CYPRESS_BASE_URL: ${{ env.URL }}
CYPRESS_KUBE_API_TOKEN: ${{ env.KUBE_API_TOKEN }}
CYPRESS_KUBE_API_SERVER: ${{ env.KUBE_API_SERVER}}
CYPRESS_AGENT_NAMESPACE: ${{ env.NS_MODE_NAMESPACE}}
CYPRESS_AGENT: "Self-Agent"
CYPRESS_TARGET_APP_NS: ${{ env.NS_MODE_NAMESPACE}}
# TODO: Additional Tests will be added from here
- name: Portal Cleanup
if: always()
run: |
kubectl config use-context k3d-${{ env.SELF_AGENT }}
chmod 755 ./litmus/uninstall-portal-namespaced.sh
./litmus/uninstall-portal-namespaced.sh
env:
PORTAL_VERSION: ${{ env.TAG }}
PORTAL_NAMESPACE: ${{ env.NS_MODE_NAMESPACE }}
- uses: actions/upload-artifact@v1
if: failure()
with:
name: Namespaced-Scope-Mode-${{ matrix.AcessType }}-screenshots
path: Cypress/cypress/screenshots