forked from dogtagpki/pki
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (139 loc) · 5.45 KB
/
qe-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: QE Tests
on: [push, pull_request]
jobs:
init:
name: Initializing Workflow
runs-on: ubuntu-latest
container: fedora:latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set up test matrix
id: set-matrix
run: |
export latest=$(cat /etc/fedora-release | awk '{ print $3 }')
export previous=$(cat /etc/fedora-release | awk '{ print $3 - 1}')
echo "Running CI against Fedora $previous and $latest"
if [ "${{ secrets.MATRIX }}" == "" ]
then
echo "::set-output name=matrix::{\"os\":[\"$previous\", \"$latest\"]}"
else
echo "::set-output name=matrix::${{ secrets.MATRIX }}"
fi
# docs/development/Building_PKI.md
build:
name: Building PKI
needs: init
runs-on: ubuntu-latest
env:
COPR_REPO: "@pki/master"
strategy:
matrix: ${{ fromJSON(needs.init.outputs.matrix) }}
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build runner image
uses: docker/build-push-action@v2
with:
context: .
build-args: |
OS_VERSION=${{ matrix.os }}
COPR_REPO=${{ env.COPR_REPO }}
BUILD_OPTS=--with-timestamp --with-commit-id
tags: pki-runner
target: pki-runner
outputs: type=docker,dest=/tmp/pki-runner.tar
- name: Upload runner image
uses: actions/upload-artifact@v2
with:
name: pki-runner-${{ matrix.os }}
path: /tmp/pki-runner.tar
# Tier 0
installation-sanity:
# This job uses Ansible playbooks in the tests dir to setup a PKI deployment.
# All 5 subsystems are deployed on "discrete" instances
name: Testing installation sanity
needs: [init, build]
runs-on: ubuntu-latest
env:
BUILDDIR: /tmp/workdir
PKIDIR: /tmp/workdir/pki
COPR_REPO: "@pki/master"
strategy:
matrix: ${{ fromJSON(needs.init.outputs.matrix) }}
steps:
- name: Clone the repository
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install python3-pip
pip3 install -r tests/dogtag/pytest-ansible/requirements.txt
pip3 install -e tests/dogtag/pytest-ansible
- name: Download runner image
uses: actions/download-artifact@v2
with:
name: pki-runner-${{ matrix.os }}
path: /tmp
- name: Load runner image
run: docker load --input /tmp/pki-runner.tar
- name: Run master container
run: |
IMAGE=pki-runner \
NAME=pki1 \
HOSTNAME=pki1.example.com \
tests/bin/runner-init.sh
- name: Install dependencies in master container
run: docker exec pki1 dnf install -y 389-ds-base python3-pip
- name: Set up inventory
run: |
sed -e "s/TOPOLOGY/topology-02/g" tests/inventory > inventory
ansible -i inventory -m setup master
- name: Set up topology-02
run: |
mkdir -p /tmp/test_dir
ansible-playbook \
-b \
-i inventory \
-l all \
-M tests/dogtag/pytest-ansible/common-modules \
-vvv \
tests/dogtag/pytest-ansible/installation/main.yml
- name: Run sanity test
run: |
pytest \
--ansible-host-pattern master \
--ansible-inventory inventory \
--ansible-module-path tests/dogtag/pytest-ansible/common-modules \
--junit-xml pki_cert_junit.xml \
-qsvvv \
tests/dogtag/pytest-ansible/pytest/sanity/test_role_users.py
- name: Gather artifacts
if: always()
run: |
tests/bin/ds-artifacts-save.sh pki1 topology-02-testingmaster
mkdir -p /tmp/artifacts/pki1/etc/pki
mkdir -p /tmp/artifacts/pki1/var/log
docker exec pki1 ls -la /etc/pki
docker cp pki1:/etc/pki/pki.conf /tmp/artifacts/pki1/etc/pki
docker cp pki1:/etc/pki/topology-02-CA /tmp/artifacts/pki1/etc/pki
docker cp pki1:/etc/pki/topology-02-KRA /tmp/artifacts/pki1/etc/pki
docker cp pki1:/etc/pki/topology-02-OCSP /tmp/artifacts/pki1/etc/pki
docker cp pki1:/etc/pki/topology-02-TKS /tmp/artifacts/pki1/etc/pki
docker cp pki1:/etc/pki/topology-02-TPS /tmp/artifacts/pki1/etc/pki
docker exec pki1 ls -la /var/log/pki
docker cp pki1:/var/log/pki /tmp/artifacts/pki1/var/log
docker exec pki1 journalctl -u pki-tomcatd@topology-02-CA > /tmp/artifacts/pki1/var/log/pki/topology-02-CA/systemd.log
docker exec pki1 journalctl -u pki-tomcatd@topology-02-KRA > /tmp/artifacts/pki1/var/log/pki/topology-02-KRA/systemd.log
docker exec pki1 journalctl -u pki-tomcatd@topology-02-OCSP > /tmp/artifacts/pki1/var/log/pki/topology-02-OCSP/systemd.log
docker exec pki1 journalctl -u pki-tomcatd@topology-02-TKS > /tmp/artifacts/pki1/var/log/pki/topology-02-TKS/systemd.log
docker exec pki1 journalctl -u pki-tomcatd@topology-02-TPS > /tmp/artifacts/pki1/var/log/pki/topology-02-TPS/systemd.log
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: sanity-${{ matrix.os }}
path: |
/tmp/artifacts/pki1