Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add auto checks #1234

Merged
merged 9 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: workflow
  • Loading branch information
moabu committed Apr 21, 2022
commit ebb034242adc78134792838a148a63ecbbef2c8b
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
/jans-linux-setup/ @mbaser @smansoft @yuriyz
/jans-linux-setup/jans_setup/setup_app/version.py @moabu
/jans-linux-setup/static/scripts/admin_ui_plugin.py @mbaser @duttarnab
/super-jans @harsukhbir @NazarYavornytskyy
/super-jans @harsukhbir
71 changes: 10 additions & 61 deletions .github/workflows/microk8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ on:
- "automation/startjanssendemo.sh"
workflow_dispatch:
jobs:
mysql:
microk8s:
strategy:
max-parallel: 6
matrix:
istio: ["true", "false"]
# add '"pgsql" when supported
persistence-backends: ["LDAP","MYSQL"]
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -27,63 +34,5 @@ jobs:
run: |
ip=$(ifconfig eth0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
chmod u+x automation/startjanssendemo.sh
sudo bash ./automation/startjanssendemo.sh demoexample.jans.io MYSQL true $ip

- name: Test Janssen authorization server
id: test_kubernetes
run: |
sudo microk8s kubectl get po -n jans --kubeconfig="$PWD/config"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=600s deploy/janssen-auth-server --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh auth "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"
sudo microk8s kubectl logs -l APP_NAME=persistence-loader -c persistence -n jans --kubeconfig="$PWD/config" || echo "Not Found"
sudo microk8s kubectl logs -l APP_NAME=configurator -c config -n jans --kubeconfig="$PWD/config" || echo "Not Found"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-client-api --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh client-api "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-fido2 --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh fido2 "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-scim --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh scim "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"
ldap:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Test dev setup
id: start_up_script
run: |
ip=$(ifconfig eth0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
chmod u+x automation/startjanssendemo.sh
sudo bash ./automation/startjanssendemo.sh demoexample.jans.io LDAP true $ip

- name: Test Janssen authorization server
id: test_kubernetes
run: |
sudo microk8s kubectl get po -n jans --kubeconfig="$PWD/config"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=600s deploy/janssen-auth-server --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh auth "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"
sudo microk8s kubectl logs -l APP_NAME=persistence-loader -c persistence -n jans --kubeconfig="$PWD/config" || echo "Not Found"
sudo microk8s kubectl logs -l APP_NAME=configurator -c config -n jans --kubeconfig="$PWD/config" || echo "Not Found"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-client-api --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh client-api "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-fido2 --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh fido2 "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-scim --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh scim "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"

ldap-istio:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Test dev setup
id: start_up_script
run: |
ip=$(ifconfig eth0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
chmod u+x automation/startjanssendemo.sh
sudo bash ./automation/startjanssendemo.sh demoexample.jans.io LDAP true $ip true

- name: Test Janssen authorization server
id: test_kubernetes
run: |
sudo microk8s kubectl get po -n jans --kubeconfig="$PWD/config"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=600s deploy/janssen-auth-server --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh auth "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"
sudo microk8s kubectl logs -l APP_NAME=persistence-loader -c persistence -n jans --kubeconfig="$PWD/config" || echo "Not Found"
sudo microk8s kubectl logs -l APP_NAME=configurator -c config -n jans --kubeconfig="$PWD/config" || echo "Not Found"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-client-api --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh client-api "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-fido2 --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh fido2 "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"
sudo microk8s kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-scim --kubeconfig="$PWD/config" || sudo bash ./automation/collect_logs.sh scim "${{ secrets.MOAUTO_ROCKETCHAT_ID }}" "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" || echo "Not Found"

sudo bash ./automation/startjanssendemo.sh demoexample.jans.io ${{ matrix.persistence-backends }} true $ip ${{ matrix.istio }}
sudo bash ./automation/analyze_test_microk8s_setup.sh "${{ secrets.MOAUTO_ROCKETCHAT_TOKEN }}" "${{ secrets.MOAUTO_ROCKETCHAT_ID }}"
40 changes: 40 additions & 0 deletions automation/analyze_test_microk8s_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
set -euo pipefail

collect_logs() {
DATE=$(date +%F_%H-%M-%S)
SERVICE=$1
APP="janssen-$SERVICE"
BUILD=""
if [[ $SERVICE == "auth" ]];then
APP="janssen-$SERVICE-server"
fi
POD_NAME=$(kubectl get pods --selector=app="$APP" --output=jsonpath={.items[0]..metadata.name} -n jans)
IFS="=" read name BUILD <<< "$(kubectl exec "$POD_NAME" -n jans -- printenv | grep "CN_BUILD_DATE=")"
echo "Found $POD_NAME built on $BUILD"
if [[ $SERVICE == "client-api" ]];then
kubectl cp -n jans "$POD_NAME":opt/client-api/logs/ jans-"$SERVICE"-logs && zip -r jans-"$SERVICE"-logs-"$DATE".zip jans-"$SERVICE"-logs && rm -rf jans-"$SERVICE"-logs/
else
kubectl cp -n jans "$POD_NAME":opt/jans/jetty/jans-"$SERVICE"/logs jans-"$SERVICE"-logs && zip -r jans-"$SERVICE"-logs-"$DATE".zip jans-"$SERVICE"-logs && rm -rf jans-"$SERVICE"-logs/
fi

curl "https://chat.gluu.org/api/v1/rooms.upload/YNz6rg7eNpngiygkv" \
-F "file=@jans-$SERVICE-logs-$DATE.zip" \
-F "msg=$APP built on $BUILD ran into an issue. Here are the logs." \
-F "description=These logs were autogenerated from an ephemeral environment" \
-H "X-Auth-Token: $2" \
-H "X-User-Id: $3"
}

kubectl get po -n jans
echo "--------------------------------------Outputting persistence loader logs--------------------------------------"
sudo microk8s kubectl logs -l APP_NAME=persistence-loader -c persistence -n jans
echo "--------------------------------------------------------------------------------------------------------------"
echo "--------------------------------------Outputting configurator logs--------------------------------------------"
sudo microk8s kubectl logs -l APP_NAME=configurator -c config -n jans
echo "--------------------------------------------------------------------------------------------------------------"

SERVICES="auth-server client-api fido2 scim"
for SERVICE in $SERVICES; do
kubectl -n jans wait --for=condition=available --timeout=30s deploy/janssen-"$SERVICE" || collect_logs "${SERVICE%-server}" "$1" "$2"
done
25 changes: 0 additions & 25 deletions automation/collect_logs.sh

This file was deleted.

8 changes: 6 additions & 2 deletions automation/startjanssendemo.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -euo pipefail
JANS_FQDN=$1
JANS_PERSISTENCE=$2
JANS_CI_CD_RUN=$3
Expand Down Expand Up @@ -204,6 +204,10 @@ auth-server:
initialDelaySeconds: 300
periodSeconds: 25
timeoutSeconds: 5
opendj:
image:
repository: gluufedertaion/opendj
tag: 5.0.0_dev
EOF
sudo helm repo add janssen https://janssenproject.github.io/jans/charts
sudo helm repo update
Expand All @@ -223,6 +227,6 @@ echo -e "Testing fido2-configuration endpoint.. \n"
curl -k https://$JANS_FQDN/.well-known/fido2-configuration
cd ..
EOF
sudo microk8s.kubectl -n jans wait --for=condition=available --timeout=600s deploy/janssen-auth-server --kubeconfig="$KUBECONFIG" || echo "Couldn't find deployment running tests anyways..."
sudo microk8s.kubectl -n jans wait --for=condition=available --timeout=300s deploy/janssen-auth-server --kubeconfig="$KUBECONFIG" || echo "Couldn't find deployment running tests anyways..."
sudo bash testendpoints.sh
echo -e "You may re-execute bash testendpoints.sh to do a quick test to check the openid-configuration endpoint."