Skip to content

Commit 7b8fe8e

Browse files
author
Ubuntu
committed
debug ci
1 parent 1022e6e commit 7b8fe8e

File tree

5 files changed

+187
-0
lines changed

5 files changed

+187
-0
lines changed

.github/actions/setup/action.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'Setup env'
2+
description: 'Greet someone'
3+
inputs:
4+
install-chaos:
5+
description: 'Setup ChaosMesh'
6+
required: true
7+
default: false
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Lint
12+
shell: bash
13+
run: |
14+
curl -fsSL -o /tmp/get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
15+
chmod 700 /tmp/get_helm.sh
16+
/tmp/get_helm.sh
17+
helm lint .
18+
- name: setup cluster
19+
shell: bash
20+
run: |
21+
curl -Lo /tmp/kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64
22+
chmod +x /tmp/kind
23+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
24+
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
25+
rm -f kubectl
26+
sudo apt update
27+
sudo apt-get install -y ldap-utils
28+
/tmp/kind create cluster --config=$GITHUB_WORKSPACE/.bin/kind-conf.yml --image=kindest/node:v1.29.4@sha256:3abb816a5b1061fb15c6e9e60856ec40d56b7b52bcea5f5f1350bc6e2320b6f8
29+
kubectl apply -f https://projectcontour.io/quickstart/contour.yaml
30+
kubectl patch daemonsets -n projectcontour envoy -p '{"spec":{"template":{"spec":{"nodeSelector":{"ingress-ready":"true"}}}}}'
31+
- name: setup chaos mesh
32+
shell: bash
33+
run: |
34+
curl -sSL https://mirrors.chaos-mesh.org/v2.6.2/install.sh | bash -s -- --local kind

.github/workflows/base/base.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Setup
2+
on:
3+
push:
4+
branches:
5+
- "*"
6+
pull_request:
7+
branches:
8+
- "master"
9+
- "bitnami"
10+
jobs:
11+
call-ci-singlenode:
12+
uses: ./.github/workflows/tests/ci-singlenode.yml
13+
call-ci-other:
14+
uses: ./.github/workflows/tests/ci-other.yml
15+
call-ci-ha:
16+
uses: ./.github/workflows/tests/ci-ha.yml
17+
18+
19+

.github/workflows/tests/ci-ha.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Test-HA
2+
on:
3+
workflow_call:
4+
jobs:
5+
qualif:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Check out code
9+
uses: actions/checkout@v1
10+
- name: Run custom action
11+
# Use the location in the repository (without action.yml)
12+
uses: ./.github/actions/setup
13+
with:
14+
install-chaos: true
15+
- name: setup certs
16+
shell: bash
17+
run: |
18+
openssl req -x509 -newkey rsa:4096 -nodes -subj '/CN=example.com' -keyout tls.key -out tls.crt -days 365
19+
cp tls.crt ca.crt
20+
kubectl create secret generic custom-cert --from-file=./tls.crt --from-file=./tls.key --from-file=./ca.crt
21+
- name: deploy openldap-stack-ha
22+
shell: bash
23+
run: |
24+
cd "$GITHUB_WORKSPACE"
25+
helm install openldap-stack-ha -f .bin/myval.yaml .
26+
kubectl rollout status sts openldap-stack-ha
27+
- name: verify deployment
28+
shell: bash
29+
run: |
30+
echo "test access to openldap database"
31+
sleep 10
32+
LDAPTLS_REQCERT=never ldapsearch -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -b 'dc=example,dc=org'
33+
- name: test phpldapadmin access
34+
shell: bash
35+
run: |
36+
echo "test access to phpldapadmin"
37+
echo "127.0.0.1 phpldapadmin.example ssl-ldap2.example" | sudo tee -a /etc/hosts
38+
curl phpldapadmin.example:8080
39+
- name: test self service pwd access
40+
shell: bash
41+
run: |
42+
echo "test access to ssp"
43+
curl ssl-ldap2.example:8080
44+
- name: verify certs
45+
shell: bash
46+
run: |
47+
echo "verify certificate"
48+
echo | openssl s_client -showcerts -servername example.com -connect localhost:30636 2>/dev/null | openssl x509 -inform pem -noout -text > /tmp/test-cert.txt
49+
if ! grep -q "CN = example.com" /tmp/test-cert.txt; then echo exit 1; fi
50+
- name: apply chaos tests
51+
shell: bash
52+
run: |
53+
echo "test access to openldap database"
54+
kubectl apply -f .bin/chaos.yaml
55+
- name: test write
56+
shell: bash
57+
run: |
58+
echo "Write test to openldap database"
59+
LDAPTLS_REQCERT=never ldapadd -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -f .bin/user.ldif
60+
LDAPTLS_REQCERT=never ldapsearch -o nettimeout=20 -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -b 'dc=example,dc=org' > /tmp/test-write.txt
61+
if ! grep "Einstein" /tmp/test-write.txt; then exit 1 ; fi
62+
if ! grep "objectClass: ownCloud" /tmp/test-write.txt; then echo 'no ownCloud entry found'; fi
63+
- name: test memberOf
64+
shell: bash
65+
run: |
66+
echo "MemberOf test to openldap database"
67+
LDAPTLS_REQCERT=never ldapsearch -o nettimeout=20 -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -b 'dc=example,dc=org' "(memberOf=cn=testgroup,ou=Group,dc=example,dc=org)" > /tmp/test-write.txt
68+
if [ $(grep "numResponses" /tmp/test-write.txt | cut -d ":" -f 2 | tr -d ' ') -ne 2 ]; then exit 1 ; fi
69+
if ! grep -q "uid=test1,ou=People,dc=example,dc=org" /tmp/test-write.txt; then echo exit 1; fi
70+
- name: chaos tests
71+
shell: bash
72+
run: |
73+
echo "test access to openldap database"
74+
for i in {1..20}; do LDAPTLS_REQCERT=never ldapsearch -o nettimeout=20 -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -b 'dc=example,dc=org' && sleep 60 ; done

.github/workflows/tests/ci-other.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Test-Other
2+
on:
3+
workflow_call:
4+
jobs:
5+
qualif:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Check out code
9+
uses: actions/checkout@v1
10+
- name: Run custom action
11+
# Use the location in the repository (without action.yml)
12+
uses: ./.github/actions/setup
13+
with:
14+
install-chaos: false
15+
- name: deploy openldap-stack-ha-disable-ldap-port
16+
shell: bash
17+
run: |
18+
cd "$GITHUB_WORKSPACE"
19+
helm install openldap-stack-ha -n no-ldap-port --create-namespace -f .bin/disableLdapPort.yaml .
20+
kubectl -n no-ldap-port create secret generic custom-cert --from-file=./tls.crt --from-file=./tls.key --from-file=./ca.crt
21+
kubectl -n no-ldap-port rollout status sts openldap-stack-ha -n no-ldap-port
22+
- name: verify no ldap port deployment
23+
shell: bash
24+
run: |
25+
echo "test access to openldap database"
26+
echo "Write test to openldap database"
27+
LDAPTLS_REQCERT=never ldapadd -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -f .bin/simpleUser.ldif
28+
LDAPTLS_REQCERT=never ldapsearch -o nettimeout=20 -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -b 'dc=example,dc=org' > /tmp/test-write.txt
29+
cat /tmp/test-write.txt
30+
if [ $(grep "numResponses" /tmp/test-write.txt | cut -d ":" -f 2 | tr -d ' ') -ne 3 ]; then exit 1 ; fi
31+
32+
33+
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test-SingleNode
2+
on:
3+
workflow_call:
4+
jobs:
5+
qualif:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Check out code
9+
uses: actions/checkout@v1
10+
- name: Run custom action
11+
# Use the location in the repository (without action.yml)
12+
uses: ./.github/actions/setup
13+
with:
14+
install-chaos: false
15+
- name: deploy openldap-stack-ha-single-node
16+
shell: bash
17+
run: |
18+
cd "$GITHUB_WORKSPACE"
19+
helm install openldap-stack-ha -n single --create-namespace -f .bin/singleNode.yaml .
20+
kubectl rollout status sts openldap-stack-ha -n single
21+
- name: verify single node deployment
22+
shell: bash
23+
run: |
24+
echo "test access to openldap database"
25+
LDAPTLS_REQCERT=never ldapsearch -x -D 'cn=admin,dc=singlenode,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -b 'dc=singlenode,dc=org' > /tmp/test-single-node.txt
26+
cat /tmp/test-single-node.txt
27+
if [ $(grep "numResponses" /tmp/test-single-node.txt | cut -d ":" -f 2 | tr -d ' ') -ne 6 ]; then exit 1 ; fi

0 commit comments

Comments
 (0)