-
Notifications
You must be signed in to change notification settings - Fork 15
176 lines (153 loc) · 6.59 KB
/
prod_tests.yaml
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: prod_tests
on:
workflow_dispatch:
schedule:
- cron: "2 * * * *" # “At minute 2.” https://crontab.guru
# pull_request: # temporary
# branches:
# - trunk
env:
SSHNP_ATSIGN: "@8incanteater"
SSHNPD_ATSIGN: "@8052simple"
SSHRVD_ATSIGN: "@8485wealthy51"
SSHRVD_AM_ATSIGN: "@rv_am"
SSHRVD_AP_ATSIGN: "@rv_ap"
SSHRVD_EU_ATSIGN: "@rv_eu"
DOCKER_COMPOSE_BUILD_CMD: "docker compose build"
DOCKER_COMPOSE_UP_CMD: "docker compose up --abort-on-container-exit"
jobs:
prod_rvd_test:
runs-on: ubuntu-latest
strategy:
fail-fast: false # if one job fails, do not fail the others
matrix:
rvd:
# - ${{ env.SSHRVD_ATSIGN }}
# - ${{ env.SSHRVD_AM_ATSIGN }}
# - ${{ env.SSHRVD_AP_ATSIGN }}
# - ${{ env.SSHRVD_EU_ATSIGN }}
- "@8485wealthy51"
- "@rv_am"
- "@rv_ap"
- "@rv_eu"
steps:
- name: Show Matrix Values
run: |
echo "rvd: ${{ matrix.rvd }}"
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Setup NP/NPD key env
run: |
SSHNP_ATKEYS="$(tr '[:lower:]' '[:upper:]' <<< '${{ env.SSHNP_ATSIGN }}')"
echo "SSHNP_ATKEYS=ATKEYS_${SSHNP_ATKEYS:1}" >> $GITHUB_ENV
SSHNPD_ATKEYS="$(tr '[:lower:]' '[:upper:]' <<< '${{ env.SSHNPD_ATSIGN }}')"
echo "SSHNPD_ATKEYS=ATKEYS_${SSHNPD_ATKEYS:1}" >> $GITHUB_ENV
SSHRVD_ATKEYS="$(tr '[:lower:]' '[:upper:]' <<< '${{ env.SSHRVD_ATSIGN }}')"
echo "SSHRVD_ATKEYS=ATKEYS_${SSHRVD_ATKEYS:1}" >> $GITHUB_ENV
- name: Setup NP/NPD keys
working-directory: tests/end2end_tests/contexts
run: |
echo "${{ secrets[env.SSHNP_ATKEYS] }}" > sshnp/.atsign/keys/${{ env.SSHNP_ATSIGN }}_key.atKeys
echo "${{ secrets[env.SSHNPD_ATKEYS] }}" > sshnpd/.atsign/keys/${{ env.SSHNPD_ATSIGN }}_key.atKeys
- name: Setup Devicename
# First two guarantee a unique # per workflow call
# Last two guarantee a unique # per job per strategy in matrix
run: |
echo "DEVICENAME=${{ github.run_id }}${{ github.run_attempt }}p${{ strategy.job-index }}" >> $GITHUB_ENV
- name: Set up NP/NPD entrypoints
working-directory: tests/end2end_tests/contexts/_init_
run: |
./setup-sshnp-entrypoint.sh \
${{ env.DEVICENAME }} \
${{ env.SSHNP_ATSIGN }} \
${{ env.SSHNPD_ATSIGN }} \
${{ matrix.rvd }} \
sshnp_entrypoint.sh
./setup-sshnpd-entrypoint.sh \
${{ env.DEVICENAME }} \
${{ env.SSHNP_ATSIGN }} \
${{ env.SSHNPD_ATSIGN }} \
sshnpd_entrypoint.sh
- name: Set up RVD keys and entrypoint
if: matrix.rvd == env.SSHRVD_ATSIGN
working-directory: tests/end2end_tests
run: |
# setup keys
echo "${{ secrets[env.SSHRVD_ATKEYS] }}" > contexts/sshrvd/.atsign/keys/${{ env.SSHRVD_ATSIGN }}_key.atKeys
# set up sshrvd entrypoint
cd contexts/_init_
./setup-sshrvd-entrypoint.sh \
${{ matrix.rvd }} \
sshrvd_entrypoint.sh
cd ../sshrvd
cat entrypoint.sh
- name: Ensure entrypoints exist
working-directory: tests/end2end_tests/contexts
run: |
cat sshnp/entrypoint.sh
cat sshnpd/entrypoint.sh
- name: Build docker-compose.yaml
working-directory: tests/end2end_tests/tests
run: |
cat docker-compose-blank-base.yaml > docker-compose.yaml
cat service-image-runtime-release.yaml >> docker-compose.yaml
echo " - release=latest" >> docker-compose.yaml
echo " image: atsigncompany/sshnp-e2e-runtime:latest" >> docker-compose.yaml
cat service-container-sshnp.yaml >> docker-compose.yaml
echo " image: atsigncompany/sshnp-e2e-runtime:latest" >> docker-compose.yaml
echo " depends_on:" >> docker-compose.yaml
echo " image-runtime-release:" >> docker-compose.yaml
echo " condition: service_started" >> docker-compose.yaml
echo " container-sshnpd:" >> docker-compose.yaml
echo " condition: service_healthy" >> docker-compose.yaml
if [ "${{ matrix.rvd }}" == "${{ env.SSHRVD_ATSIGN }}" ]; then
echo " container-sshrvd:" >> docker-compose.yaml
echo " condition: service_healthy" >> docker-compose.yaml
fi
cat service-container-sshnpd.yaml >> docker-compose.yaml
echo " image: atsigncompany/sshnp-e2e-runtime:latest" >> docker-compose.yaml
echo " depends_on:" >> docker-compose.yaml
echo " image-runtime-release:" >> docker-compose.yaml
echo " condition: service_started" >> docker-compose.yaml
if [ "${{ matrix.rvd }}" == "${{ env.SSHRVD_ATSIGN }}" ]; then
echo " container-sshrvd:" >> docker-compose.yaml
echo " condition: service_healthy" >> docker-compose.yaml
fi
- name: Add RVD service to docker-compose.yaml
if: matrix.rvd == env.SSHRVD_ATSIGN
working-directory: tests/end2end_tests/tests
run: |
cat service-container-sshrvd.yaml >> docker-compose.yaml
echo " image: atsigncompany/sshnp-e2e-runtime:latest" >> docker-compose.yaml
echo " depends_on:" >> docker-compose.yaml
echo " image-runtime-release:" >> docker-compose.yaml
echo " condition: service_started" >> docker-compose.yaml
- name: docker-compose.yaml
working-directory: tests/end2end_tests/tests
run: |
cat docker-compose.yaml
- name: Build
working-directory: tests/end2end_tests/tests
run: |
${{ env.DOCKER_COMPOSE_BUILD_CMD }}
- name: Test
working-directory: tests/end2end_tests/tests
run: |
${{ env.DOCKER_COMPOSE_UP_CMD }}
- name: Found "Test Passed" in Logs
if: always()
working-directory: tests/end2end_tests/tests
run: |
docker compose logs --timestamps | grep -q "Test Passed$"
- name: Logs
if: always()
continue-on-error: true # if this fails, do not fail the job
working-directory: tests/end2end_tests/tests
run: |
docker compose ps -a
docker compose logs --timestamps
- name: Tear down
if: always()
continue-on-error: true # if this fails, do not fail the job
working-directory: tests/end2end_tests/tests
run: |
docker compose down