Repository navigation
143 lines (126 loc) · 4.73 KB
/
Copy pathpullpreview-openproject.yml
File metadata and controls
143 lines (126 loc) · 4.73 KB
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
name: pullpreview_openproject
on:
schedule:
- cron: "45 5 * * *"
pull_request:
types: [labeled, unlabeled, synchronize, closed, reopened, opened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: read
pull-requests: write
jobs:
deploy_smoke_1:
runs-on: ubuntu-slim
if: >-
github.event_name == 'schedule' ||
github.event.label.name == 'pullpreview-openproject' ||
((github.event.action == 'opened' ||
github.event.action == 'reopened' ||
github.event.action == 'synchronize' ||
github.event.action == 'closed') &&
contains(github.event.pull_request.labels.*.name, 'pullpreview-openproject'))
outputs:
live: ${{ steps.pullpreview.outputs.live }}
timeout-minutes: 55
steps:
- uses: actions/checkout@v6
- name: Deploy OpenProject Helm smoke app (v1)
id: pullpreview
uses: "./"
with:
label: pullpreview-openproject
admins: "@collaborators/push"
app_path: .
provider: hetzner
region: ash
image: ubuntu-24.04
dns: rev2.click
instance_type: cpx21
max_domain_length: 40
deployment_target: helm
chart: openproject
chart_repository: https://charts.openproject.org
chart_set: 'develop=true,openproject.https=true,service.type=ClusterIP,openproject.host={{ pullpreview_public_dns }},resources.limits.cpu=2,persistence.accessModes[0]=ReadWriteOnce'
proxy_tls: '{{ release_name }}-openproject:8080'
ttl: 1h
env:
HCLOUD_TOKEN: "${{ secrets.HCLOUD_TOKEN }}"
HETZNER_CA_KEY: "${{ secrets.HETZNER_CA_KEY }}"
- name: Assert deploy v1
if: steps.pullpreview.outputs.live == 'true'
shell: bash
env:
PREVIEW_URL: ${{ steps.pullpreview.outputs.url }}
run: |
set -euo pipefail
if [[ "${PREVIEW_URL}" != https://* ]]; then
echo "::error::Expected https preview URL when proxy_tls is enabled, got ${PREVIEW_URL}"
exit 1
fi
body=""
for attempt in $(seq 1 90); do
body="$(curl -fsSL --max-time 30 "${PREVIEW_URL}" || true)"
if grep -Eqi 'OpenProject|Sign in' <<<"${body}"; then
echo "OpenProject smoke v1 checks passed for ${PREVIEW_URL}"
exit 0
fi
echo "Attempt ${attempt}/90: waiting for OpenProject v1 response from ${PREVIEW_URL}"
sleep 10
done
echo "::error::Unexpected OpenProject response from ${PREVIEW_URL}"
printf '%s\n' "${body}"
exit 1
deploy_smoke_2:
runs-on: ubuntu-slim
needs: deploy_smoke_1
if: needs.deploy_smoke_1.result == 'success' && needs.deploy_smoke_1.outputs.live == 'true'
timeout-minutes: 55
steps:
- uses: actions/checkout@v6
- name: Redeploy OpenProject Helm smoke app (v2)
id: pullpreview
uses: "./"
with:
label: pullpreview-openproject
admins: "@collaborators/push"
app_path: .
provider: hetzner
region: ash
image: ubuntu-24.04
dns: rev2.click
instance_type: cpx21
max_domain_length: 40
deployment_target: helm
chart: openproject
chart_repository: https://charts.openproject.org
chart_set: 'develop=true,openproject.https=true,service.type=ClusterIP,openproject.host={{ pullpreview_public_dns }},resources.limits.cpu=2,persistence.accessModes[0]=ReadWriteOnce'
proxy_tls: '{{ release_name }}-openproject:8080'
ttl: 1h
env:
HCLOUD_TOKEN: "${{ secrets.HCLOUD_TOKEN }}"
HETZNER_CA_KEY: "${{ secrets.HETZNER_CA_KEY }}"
- name: Assert deploy v2
if: steps.pullpreview.outputs.live == 'true'
shell: bash
env:
PREVIEW_URL: ${{ steps.pullpreview.outputs.url }}
run: |
set -euo pipefail
if [[ "${PREVIEW_URL}" != https://* ]]; then
echo "::error::Expected https preview URL when proxy_tls is enabled, got ${PREVIEW_URL}"
exit 1
fi
body=""
for attempt in $(seq 1 90); do
body="$(curl -fsSL --max-time 30 "${PREVIEW_URL}" || true)"
if grep -Eqi 'OpenProject|Sign in' <<<"${body}"; then
echo "OpenProject smoke v2 checks passed for ${PREVIEW_URL}"
exit 0
fi
echo "Attempt ${attempt}/90: waiting for OpenProject v2 response from ${PREVIEW_URL}"
sleep 10
done
echo "::error::Unexpected OpenProject response from ${PREVIEW_URL}"
printf '%s\n' "${body}"
exit 1