Skip to content

Commit 27ea541

Browse files
author
Ubuntu
committed
debug ci
1 parent f251dab commit 27ea541

File tree

4 files changed

+137
-3
lines changed

4 files changed

+137
-3
lines changed

.github/workflows/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/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+

.github/workflows/ci-singlenode.yml

+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

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
- "bitnami"
1010
jobs:
1111
call-ci-singlenode:
12-
uses: ./.github/workflows/tests/ci-singlenode.yml
12+
uses: ./.github/workflows/ci-singlenode.yml
1313
call-ci-other:
14-
uses: ./.github/workflows/tests/ci-other.yml
14+
uses: ./.github/workflows/ci-other.yml
1515
call-ci-ha:
16-
uses: ./.github/workflows/tests/ci-ha.yml
16+
uses: ./.github/workflows/ci-ha.yml

0 commit comments

Comments
 (0)