remove unused workflows

Signed-off-by: Max Brenner <xamrennerb@gmail.com>
This commit is contained in:
Max Brenner
2022-02-10 14:53:59 +01:00
parent 1b9b442abc
commit a20ad0ce09
2 changed files with 0 additions and 819 deletions

View File

@@ -1,297 +0,0 @@
name: 2.x sanity testing
env:
# thirdparties
DOCKER_SERVER: tip-tip-wlan-cloud-docker-repo.jfrog.io
DOCKER_USER_NAME: wlan-testing-cicd
DOCKER_USER_PASSWORD: ${{ secrets.DOCKER_USER_PASSWORD }}
# AWS credentials
AWS_EKS_NAME: tip-wlan-main
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: us-east-2
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }}
# Cloud SDK certs
CACERT: ${{ secrets.CACERT }}
CAKEY: ${{ secrets.CAKEY }}
ALLURE_CLI_VERSION: 2.14.0
on:
repository_dispatch:
types:
- new-ap-release
- new-cloud-release
workflow_dispatch:
inputs:
testbeds:
default: 'basic-01,basic-02,basic-03,basic-04,basic-05,basic-06,basic-07,basic-08'
description: 'Testbed(s) to test'
required: false
marker_expression:
default: 'uc_sanity'
description: 'Markers expression that will be passed to the pytest command.'
required: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
# checkout needed repositories
- name: Checkout Testing repo
uses: actions/checkout@v2
with:
path: wlan-testing
- name: Checkout LANforge scripts
uses: actions/checkout@v2
with:
path: wlan-lanforge-scripts
repository: Telecominfraproject/wlan-lanforge-scripts
- name: import LANforge scripts
working-directory: wlan-testing
run: ./sync_repos.bash
# build and push docker image
- name: docker login
run: docker login ${{ env.DOCKER_SERVER }} -u ${{ env.DOCKER_USER_NAME }} -p ${{ env.DOCKER_USER_PASSWORD }}
- name: build docker image
working-directory: wlan-testing
run: docker build -t ${{ env.DOCKER_SERVER }}/cloud-sdk-nightly:${{ github.run_id }} -f docker/Dockerfile .
- name: push docker image
run: docker push ${{ env.DOCKER_SERVER }}/cloud-sdk-nightly:${{ github.run_id }}
generate-matrix:
name: generate testbed matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: generate-matrix
id: set-matrix
run: |
TESTBEDS="${{ github.event.inputs.testbeds || 'basic-01,basic-02,basic-03,basic-04,basic-05,basic-06,basic-07,basic-08' }}"
TESTBEDS=$(echo $TESTBEDS | sed "s/,/\",\"/g" | sed 's/^/[\"/g' | sed 's/$/\"]/g')
TESTBEDS=$(echo "$TESTBEDS" | jq -c 'map({"testbed":.})')
echo "::set-output name=matrix::{\"include\":${TESTBEDS}}"
test:
runs-on: ubuntu-latest
needs: [ build, generate-matrix ]
strategy:
fail-fast: false
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
steps:
- name: get EKS access credentials
run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
- name: install Allure CLI tool
run: |
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/${{ env.ALLURE_CLI_VERSION }}/allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
tar -xzf allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
- name: set job name
id: job
run: echo "::set-output name=name::testing-${{ github.run_number }}"
- name: prepare namespace
id: namespace
run: |
NAMESPACE="testing-${{ github.run_id }}-${{ matrix.testbed }}"
kubectl create ns $NAMESPACE
kubectl config set-context --current --namespace=$NAMESPACE
echo "::set-output name=name::${NAMESPACE}"
- name: create configuration.py secret
run: |
cat << EOF > configuration.py
${{ secrets.LAB_CONFIGURATION }}
EOF
sed -i -r "s/'password': ('|\")openwifi('|\")/'password': '"${{ secrets.OWSEC_NEW_PASSWORD }}"'/" configuration.py
kubectl create secret generic configuration --from-file=configuration=./configuration.py
- name: run sanity tests
run: |
cat <<EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: "${{ steps.job.outputs.name }}"
spec:
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
containers:
- name: tests
image: ${{ env.DOCKER_SERVER }}/cloud-sdk-nightly:${{ github.run_id }}
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "250m"
command:
- /bin/bash
- -c
- |
cd tests
pytest -m "${{ github.event.inputs.marker_expression || 'uc_sanity' }}" -s -vvv --testbed="${{ matrix.testbed }}" --alluredir=/tmp/allure-results
ret=\$?
# sleep some time to be able to download the Allure results
sleep 60
exit \$ret
volumeMounts:
- name: configuration
mountPath: "/wlan-testing/tests/configuration.py"
subPath: configuration
readOnly: true
nodeSelector:
env: tests
tolerations:
- key: "tests"
operator: "Exists"
effect: "NoSchedule"
imagePullSecrets:
- name: tip-docker-registry-key
restartPolicy: Never
volumes:
- name: configuration
secret:
secretName: configuration
backoffLimit: 0
EOF
# wait for pod to spawn
sleep 1
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl wait "pod/$podname" --for condition=ready --timeout=600s
kubectl logs -f $podname &
until [ -s test_everything.xml ]
do
sleep 10
kubectl cp $podname:/wlan-testing/tests/test_everything.xml test_everything.xml >/dev/null 2>&1
done
echo "tests completed"
echo "downloading allure results..."
kubectl cp $podname:/tmp/allure-results allure-results >/dev/null 2>&1
echo "waiting for pod to exit"
kubectl logs -f $podname >/dev/null 2>&1
exit $(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}")
- name: print logs
if: always()
run: |
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl logs $podname
- name: upload Allure results as artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: allure-results-${{ matrix.testbed }}
path: allure-results
- name: cleanup
if: always()
run: |
kubectl delete ns "${{ steps.namespace.outputs.name }}" --wait=true
report:
runs-on: ubuntu-latest
needs: [ test, generate-matrix ]
if: always()
strategy:
max-parallel: 1
fail-fast: false
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
steps:
- name: install Allure CLI tool
run: |
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/${{ env.ALLURE_CLI_VERSION }}/allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
tar -xzf allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
- uses: actions/download-artifact@v2
with:
name: allure-results-${{ matrix.testbed }}
path: allure-results
- name: checkout testing repo
uses: actions/checkout@v2
with:
path: wlan-testing
- name: get reports branch
uses: actions/checkout@v2
continue-on-error: true
with:
ref: gh-pages
path: reports
- name: copy history into results
run: |
if [ -e "reports/sanity/${{ matrix.testbed }}/latest" ] ; then
cp -r reports/sanity/${{ matrix.testbed }}/latest/history/ allure-results/history
fi
- name: add report metadata
run: |
cat << EOF >> allure-results/environment.properties
Testbed=${{ matrix.testbed }}
Tests.CommitId=$(cd wlan-testing && git rev-parse --short HEAD)
CiRun.Id=${{ github.run_id }}
CiRun.Number=${{ github.run_number }}
CiRun.Url=https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
EOF
- name: generate Allure report
run: allure-${{ env.ALLURE_CLI_VERSION }}/bin/allure generate
- name: upload Allure report as artifact
uses: actions/upload-artifact@v2
with:
name: allure-report-${{ matrix.testbed }}
path: allure-report
# doing this to be able to aggregate multiple reports together later on
- name: copy results into report
run: cp -r allure-results allure-report/results
- name: copy new report
if: ${{ (github.event.inputs.marker_expression || 'uc_sanity') == 'uc_sanity' }}
run: |
mkdir -p reports/sanity/${{ matrix.testbed }}
cp -Tr allure-report reports/sanity/${{ matrix.testbed }}/${{ github.run_number }}
- name: update latest symlink
if: ${{ (github.event.inputs.marker_expression || 'uc_sanity') == 'uc_sanity' }}
working-directory: reports/sanity/${{ matrix.testbed }}
run: ln -fns ${{ github.run_number }} latest
- name: generate new index.html
run: python wlan-testing/.github/tools/generate_directory_index.py -r reports
- name: commit reports update
working-directory: reports
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Automated deployment: $(date -u)"
- name: push
if: github.ref == 'refs/heads/master'
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
directory: reports
delete-docker-image:
needs: [ test ]
runs-on: ubuntu-latest
if: always()
steps:
- name: cleanup Docker image
run: curl -u${{ env.DOCKER_USER_NAME }}:${{ env.DOCKER_USER_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-docker-repo/cloud-sdk-nightly/${{ github.run_id }}"

View File

@@ -1,522 +0,0 @@
name: 2.x sanity testing in dynamic environment
env:
# thirdparties
DOCKER_SERVER: tip-tip-wlan-cloud-docker-repo.jfrog.io
DOCKER_USER_NAME: wlan-testing-cicd
DOCKER_USER_PASSWORD: ${{ secrets.DOCKER_USER_PASSWORD }}
# AWS credentials
AWS_EKS_NAME: tip-wlan-main
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: us-east-2
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }}
# Cloud SDK certs
CACERT: ${{ secrets.CACERT }}
CAKEY: ${{ secrets.CAKEY }}
ALLURE_CLI_VERSION: 2.14.0
on:
workflow_dispatch:
inputs:
testbeds:
default: 'basic-01,basic-02,basic-03,basic-04,basic-05,basic-06,basic-07,basic-08'
description: 'Testbed(s) to test'
required: false
marker_expression:
default: 'uc_sanity'
description: 'Markers expression that will be passed to the pytest command.'
required: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
# checkout needed repositories
- name: Checkout Testing repo
uses: actions/checkout@v2
with:
path: wlan-testing
- name: Checkout LANforge scripts
uses: actions/checkout@v2
with:
path: wlan-lanforge-scripts
repository: Telecominfraproject/wlan-lanforge-scripts
- name: import LANforge scripts
working-directory: wlan-testing
run: ./sync_repos.bash
# build and push docker image
- name: docker login
run: docker login ${{ env.DOCKER_SERVER }} -u ${{ env.DOCKER_USER_NAME }} -p ${{ env.DOCKER_USER_PASSWORD }}
- name: build docker image
working-directory: wlan-testing
run: docker build -t ${{ env.DOCKER_SERVER }}/cloud-sdk-nightly:${{ github.run_id }} -f docker/Dockerfile .
- name: push docker image
run: docker push ${{ env.DOCKER_SERVER }}/cloud-sdk-nightly:${{ github.run_id }}
deploy-controller:
name: Deploy OpenWIFI Cloud SDK
runs-on: ubuntu-latest
outputs:
gateway_url: ${{ steps.gateway_url.outputs.value }}
sec_url: ${{ steps.sec_url.outputs.value }}
namespace: ${{ steps.namespace.outputs.value }}
steps:
- name: Checkout repo with Helm values
uses: actions/checkout@v2
with:
path: wlan-testing
- name: Prepare certificates from secrets
working-directory: wlan-testing/helm/ucentral
run: |
echo "${{ secrets.DIGICERT_CERT }}" | base64 -d > cert.pem
echo "${{ secrets.DIGICERT_KEY }}" | base64 -d > key.pem
- name: Fetch kubeconfig
run: |
aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
- name: Set namespace output
id: namespace
run: echo "::set-output name=value::openwifi-${{ github.run_id }}"
- name: Set gateway URL output
id: gateway_url
run: echo "::set-output name=value::gw-${{ github.run_id }}.cicd.lab.wlan.tip.build"
- name: Set sec service URL output
id: sec_url
run: echo "::set-output name=value::sec-${{ github.run_id }}.cicd.lab.wlan.tip.build"
- name: Deploy OpenWIFI Cloud SDK
working-directory: wlan-testing/helm/ucentral
run: |
export NAMESPACE=${{ github.run_id }}
export DEPLOY_METHOD=git
export CHART_VERSION=main
export OWGW_VERSION=master
export OWGWUI_VERSION=main
export OWSEC_VERSION=main
export OWFMS_VERSION=main
export OWPROV_VERSION=main
export OWPROVUI_VERSION=main
export VALUES_FILE_LOCATION=values.ucentral-qa.yaml
export RTTY_TOKEN=${{ secrets.RTTY_TOKEN }}
export OWGW_AUTH_USERNAME=${{ secrets.UCENTRALGW_AUTH_USERNAME }}
export OWGW_AUTH_PASSWORD=${{ secrets.UCENTRALGW_AUTH_PASSWORD }}
export OWFMS_S3_SECRET=${{ secrets.UCENTRALFMS_S3_SECRET }}
export OWFMS_S3_KEY=${{ secrets.UCENTRALFMS_S3_KEY }}
export CERT_LOCATION=cert.pem
export KEY_LOCATION=key.pem
export OWSEC_NEW_PASSWORD=${{ secrets.OWSEC_NEW_PASSWORD }}
./deploy.sh
- name: wait for DNS to propagate
run: sleep 300
- name: Show resource state on deployment failure
if: failure()
run: |
kubectl get pods --namespace openwifi-${{ github.run_id }}
kubectl get services --namespace openwifi-${{ github.run_id }}
kubectl get persistentvolumeclaims --namespace openwifi-${{ github.run_id }}
- name: Describe pods on deployment failure
if: failure()
run: |
kubectl describe pods --namespace openwifi-${{ github.run_id }}
- name: Describe services on deployment failure
if: failure()
run: |
kubectl describe services --namespace openwifi-${{ github.run_id }}
- name: Describe persistentvolumeclaims on deployment failure
if: failure()
run: |
kubectl describe persistentvolumeclaims --namespace openwifi-${{ github.run_id }}
generate-matrix:
name: generate testbed matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: generate-matrix
id: set-matrix
run: |
TESTBEDS="${{ github.event.inputs.testbeds || 'basic-01,basic-02,basic-03,basic-04,basic-05,basic-06,basic-07,basic-08' }}"
TESTBEDS=$(echo $TESTBEDS | sed "s/,/\",\"/g" | sed 's/^/[\"/g' | sed 's/$/\"]/g')
TESTBEDS=$(echo "$TESTBEDS" | jq -c 'map({"testbed":.})')
echo "::set-output name=matrix::{\"include\":${TESTBEDS}}"
set-redirector-url:
needs: [ deploy-controller, generate-matrix ]
strategy:
fail-fast: false
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
runs-on: self-hosted
steps:
- name: checkout testing repo
uses: actions/checkout@v2
with:
repository: Telecominfraproject/wlan-testing
path: wlan-testing
ref: WIFI-3620
- name: checkout pki cert scripts repo
uses: actions/checkout@v2
with:
repository: Telecominfraproject/wlan-pki-cert-scripts
path: wlan-pki-cert-scripts
- name: install dependencies
run: |
sudo apt-get install -y python3-pip
pip install paramiko scp allure-pytest
- name: create configuration.py file
run: |
cat << EOF > configuration.py
${{ secrets.LAB_CONFIGURATION }}
EOF
- name: set redirector URL
env:
DIGICERT_API_KEY: ${{ secrets.DIGICERT_API_KEY }}
run: |
for id in $(echo -e 'from configuration import CONFIGURATION\nfor ap in CONFIGURATION["${{ matrix.testbed }}"]["access_point"]: print(ap["serial"])' | python3)
do
./wlan-pki-cert-scripts/digicert-change-ap-redirector.sh $id "${{ needs.deploy-controller.outputs.gateway_url }}"
current_redirector=$(./wlan-pki-cert-scripts/digicert-get-ap-redirector.sh $id)
if [[ "$current_redirector" != "${{ needs.deploy-controller.outputs.gateway_url }}" ]]; then
echo "Current redirector in DigiCert ($current_redirector) is different from the required one (${{ needs.deploy-controller.outputs.gateway_url }})"
exit 1
fi
done
- name: factory reset APs
run: |
set -x
AP_LEN=$(echo -e "from configuration import CONFIGURATION\nprint(len(CONFIGURATION['${{ matrix.testbed }}']['access_point']) - 1)" | python3)
for index in $(seq 0 $AP_LEN)
do
HOST=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['ip'])" | python3)
JUMPHOST=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['jumphost'])" | python3)
TTY=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['jumphost_tty'])" | python3)
PORT=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['port'])" | python3)
USERNAME=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['username'])" | python3)
PASSWORD=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['password'])" | python3)
cd wlan-testing/tools
python3 ap_tools.py --host $HOST --jumphost $JUMPHOST --tty $TTY --port $PORT --username $USERNAME --password $PASSWORD --cmd "jffs2reset -y -r"
cd ../..
done
- name: wait for APs to come up again
run: sleep 300
test:
runs-on: ubuntu-latest
needs: [ build, generate-matrix, deploy-controller, set-redirector-url ]
strategy:
fail-fast: false
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
steps:
- name: get EKS access credentials
run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
- name: install Allure CLI tool
run: |
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/${{ env.ALLURE_CLI_VERSION }}/allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
tar -xzf allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
- name: set job name
id: job
run: echo "::set-output name=name::testing-${{ github.run_number }}"
- name: prepare namespace
id: namespace
run: |
NAMESPACE="testing-${{ github.run_id }}-${{ matrix.testbed }}"
kubectl create ns $NAMESPACE
kubectl config set-context --current --namespace=$NAMESPACE
echo "::set-output name=name::${NAMESPACE}"
- name: create configuration.py secret
run: |
cat << EOF > configuration.py
${{ secrets.LAB_CONFIGURATION }}
EOF
sed -i -r "s/'url': ('|\").*('|\")/'url': 'https:\/\/${{ needs.deploy-controller.outputs.sec_url }}:16001'/" configuration.py
sed -i -r "s/'password': ('|\")openwifi('|\")/'password': '"${{ secrets.OWSEC_NEW_PASSWORD }}"'/" configuration.py
kubectl create secret generic configuration --from-file=configuration=./configuration.py
- name: run sanity tests
run: |
cat <<EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: "${{ steps.job.outputs.name }}"
spec:
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
containers:
- name: tests
image: ${{ env.DOCKER_SERVER }}/cloud-sdk-nightly:${{ github.run_id }}
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "250m"
command:
- /bin/bash
- -c
- |
cd tests
pytest -m "${{ github.event.inputs.marker_expression || 'uc_sanity' }}" -s -vvv --testbed="${{ matrix.testbed }}" --alluredir=/tmp/allure-results
ret=\$?
# sleep some time to be able to download the Allure results
sleep 60
exit \$ret
volumeMounts:
- name: configuration
mountPath: "/wlan-testing/tests/configuration.py"
subPath: configuration
readOnly: true
nodeSelector:
env: tests
tolerations:
- key: "tests"
operator: "Exists"
effect: "NoSchedule"
imagePullSecrets:
- name: tip-docker-registry-key
restartPolicy: Never
volumes:
- name: configuration
secret:
secretName: configuration
backoffLimit: 0
EOF
# wait for pod to spawn
sleep 1
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl wait "pod/$podname" --for condition=ready --timeout=600s
kubectl logs -f $podname &
#sleep 30 # wait for the pod to come up
until [ -s test_everything.xml ]
do
sleep 10
kubectl cp $podname:/wlan-testing/tests/test_everything.xml test_everything.xml >/dev/null 2>&1
done
echo "tests completed"
echo "downloading allure results..."
kubectl cp $podname:/tmp/allure-results allure-results >/dev/null 2>&1
echo "waiting for pod to exit"
kubectl logs -f $podname >/dev/null 2>&1
exit $(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}")
- name: print logs
if: always()
run: |
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl logs $podname
- name: upload Allure results as artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: allure-results-${{ matrix.testbed }}
path: allure-results
- name: cleanup
if: always()
run: |
kubectl delete ns "${{ steps.namespace.outputs.name }}" --wait=true
report:
runs-on: ubuntu-latest
needs: [ test, generate-matrix ]
if: always()
strategy:
max-parallel: 1
fail-fast: false
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
steps:
- name: install Allure CLI tool
run: |
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/${{ env.ALLURE_CLI_VERSION }}/allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
tar -xzf allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
- uses: actions/download-artifact@v2
with:
name: allure-results-${{ matrix.testbed }}
path: allure-results
- name: checkout testing repo
uses: actions/checkout@v2
with:
path: wlan-testing
- name: get reports branch
uses: actions/checkout@v2
continue-on-error: true
with:
ref: gh-pages
path: reports
- name: copy history into results
run: |
if [ -e "reports/sanity/${{ matrix.testbed }}/latest" ] ; then
cp -r reports/sanity/${{ matrix.testbed }}/latest/history/ allure-results/history
fi
- name: add report metadata
run: |
cat << EOF >> allure-results/environment.properties
Testbed=${{ matrix.testbed }}
Tests.CommitId=$(cd wlan-testing && git rev-parse --short HEAD)
CiRun.Id=${{ github.run_id }}
CiRun.Number=${{ github.run_number }}
CiRun.Url=https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
EOF
- name: generate Allure report
run: allure-${{ env.ALLURE_CLI_VERSION }}/bin/allure generate
- name: upload Allure report as artifact
uses: actions/upload-artifact@v2
with:
name: allure-report-${{ matrix.testbed }}
path: allure-report
# doing this to be able to aggregate multiple reports together later on
- name: copy results into report
run: cp -r allure-results allure-report/results
- name: copy new report
if: ${{ (github.event.inputs.marker_expression || 'uc_sanity') == 'uc_sanity' }}
run: |
mkdir -p reports/sanity/${{ matrix.testbed }}
cp -Tr allure-report reports/sanity/${{ matrix.testbed }}/${{ github.run_number }}
- name: update latest symlink
if: ${{ (github.event.inputs.marker_expression || 'uc_sanity') == 'uc_sanity' }}
working-directory: reports/sanity/${{ matrix.testbed }}
run: ln -fns ${{ github.run_number }} latest
- name: generate new index.html
run: python wlan-testing/.github/tools/generate_directory_index.py -r reports
- name: commit reports update
working-directory: reports
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Automated deployment: $(date -u)"
- name: push
if: github.ref == 'refs/heads/master'
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
directory: reports
delete-docker-image:
needs: [ test ]
runs-on: ubuntu-latest
if: always()
steps:
- name: cleanup Docker image
run: curl -u${{ env.DOCKER_USER_NAME }}:${{ env.DOCKER_USER_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-docker-repo/cloud-sdk-nightly/${{ github.run_id }}"
destroy-controller:
needs: [ test ]
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout repo with Helm values
uses: actions/checkout@v2
with:
path: wlan-testing
- name: Fetch kubeconfig
run: |
aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
- name: Delete namespace
run: kubectl delete ns --ignore-not-found=true "openwifi-${{ github.run_id }}"
reset-redirector-url:
needs: [ test, generate-matrix ]
if: always()
strategy:
fail-fast: false
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
runs-on: self-hosted
steps:
- name: checkout testing repo
uses: actions/checkout@v2
with:
repository: Telecominfraproject/wlan-testing
path: wlan-testing
ref: WIFI-3620
- name: checkout pki cert scripts repo
uses: actions/checkout@v2
with:
repository: Telecominfraproject/wlan-pki-cert-scripts
path: wlan-pki-cert-scripts
- name: install dependencies
run: |
pip install paramiko scp allure-pytest
- name: create configuration.py file
run: |
cat << EOF > configuration.py
${{ secrets.LAB_CONFIGURATION }}
EOF
- name: reset redirector URL
env:
DIGICERT_API_KEY: ${{ secrets.DIGICERT_API_KEY }}
run: |
for id in $(echo -e 'from configuration import CONFIGURATION\nfor ap in CONFIGURATION["${{ matrix.testbed }}"]["access_point"]: print(ap["serial"])' | python3)
do
./wlan-pki-cert-scripts/digicert-change-ap-redirector.sh $id gw-qa01.cicd.lab.wlan.tip.build
current_redirector=$(./wlan-pki-cert-scripts/digicert-get-ap-redirector.sh $id)
if [[ "$current_redirector" != "gw-qa01.cicd.lab.wlan.tip.build" ]]; then
echo "Current redirector in DigiCert ($current_redirector) is different from the required one (gw-qa01.cicd.lab.wlan.tip.build)"
exit 1
fi
done
- name: factory reset APs
run: |
AP_LEN=$(echo -e "from configuration import CONFIGURATION\nprint(len(CONFIGURATION['${{ matrix.testbed }}']['access_point']) - 1)" | python3)
for index in $(seq 0 $AP_LEN)
do
HOST=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['ip'])" | python3)
JUMPHOST=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['jumphost'])" | python3)
TTY=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['jumphost_tty'])" | python3)
PORT=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['port'])" | python3)
USERNAME=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['username'])" | python3)
PASSWORD=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['password'])" | python3)
cd wlan-testing/tools
python3 ap_tools.py --host $HOST --jumphost $JUMPHOST --tty $TTY --port $PORT --username $USERNAME --password $PASSWORD --cmd "jffs2reset -y -r"
cd ../..
done
- name: wait for APs to come up again
run: sleep 300