You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
max_attempts: 5# Retry the wait-for with a short timeout in case it gets stuck and times out. If it fails after multiple tries it's probably a real error.
66
-
command: |
67
-
# Wait for everything to be ready except kratos-external-idp-integrator
68
-
# which will remain as blocked as we're not using an external identity provider.
69
-
juju wait-for model iam --timeout=1m --query='forEach(applications, app => (app.name == "kratos-external-idp-integrator" && app.status=="blocked") || (app.name != "kratos-external-idp-integrator" && app.status=="active"))'
- name: Create IAM offers for cross-model relations
71
73
shell: bash
72
74
run: |
@@ -76,11 +78,12 @@ runs:
76
78
shell: bash
77
79
run: juju config kratos enforce_mfa=False
78
80
- name: Wait for Kratos
79
-
uses: nick-fields/retry@v3
81
+
uses: ./.github/actions/juju-wait-for
80
82
with:
83
+
type: unit
84
+
name: kratos/0
81
85
timeout_minutes: 1
82
-
max_attempts: 5# Retry the wait-for with a short timeout in case it gets stuck and times out. If it fails after multiple tries it's probably a real error.
max_attempts: 5# Retry the wait-for with a short timeout in case it gets stuck and times out. If it fails after multiple tries it's probably a real error.
105
-
command: juju wait-for unit postgresql/0 --timeout=1m # Wait for postgres to prevent issues when relating to other apps: https://github.com/canonical/openfga-operator/issues/25.
109
+
juju-version: ${{ inputs.juju-version }}
106
110
- name: Add JIMM relations
107
111
shell: bash
108
112
run: |
109
113
juju relate jimm:nginx-route ingress
110
114
juju relate jimm:openfga openfga
111
115
juju relate jimm:database postgresql
112
-
- name: Wait for Postgres
113
-
uses: nick-fields/retry@v3
116
+
- name: Wait for Postgres (before openfga)
117
+
uses: ./.github/actions/juju-wait-for
114
118
with:
119
+
type: unit
120
+
name: postgresql/0
115
121
timeout_minutes: 1
116
-
max_attempts: 5# Retry the wait-for with a short timeout in case it gets stuck and times out. If it fails after multiple tries it's probably a real error.
117
-
command: juju wait-for unit postgresql/0 --timeout=1m # Wait for postgres to prevent issues when relating to openfga: https://github.com/canonical/openfga-operator/issues/25.
122
+
juju-version: ${{ inputs.juju-version }}
118
123
- name: Add openfga relation
119
124
shell: bash
120
125
run: juju relate openfga:database postgresql
126
+
- name: Check and fix openfga error state
127
+
shell: bash
128
+
run: |
129
+
STATUS=$(juju status --format json | yq .applications.openfga.application-status.current)
130
+
if [ "$STATUS" == "error" ]; then
131
+
# Sometimes the postgresql unit has a PrematureDataAccessError error so remove the relation and try again.
132
+
echo "OpenFGA is in error state, removing and re-adding relation..."
133
+
juju remove-relation openfga:database postgresql
134
+
fi
135
+
- name: Wait for openfga to be blocked
136
+
if: ${{ success() }}
137
+
uses: ./.github/actions/juju-wait-for
138
+
with:
139
+
type: application
140
+
name: openfga
141
+
timeout_minutes: 1
142
+
status: blocked
143
+
juju-version: ${{ inputs.juju-version }}
144
+
- name: Re-relate openfga if needed
145
+
if: ${{ success() }}
146
+
shell: bash
147
+
run: |
148
+
STATUS=$(juju status --format json | yq .applications.openfga.application-status.current)
149
+
if [ "$STATUS" == "blocked" ]; then
150
+
juju relate openfga:database postgresql
151
+
fi
121
152
- name: Wait for openfga
122
-
uses: nick-fields/retry@v3
153
+
uses: ./.github/actions/juju-wait-for
123
154
with:
155
+
type: unit
156
+
name: openfga/0
124
157
timeout_minutes: 1
125
-
max_attempts: 5# Retry the wait-for with a short timeout in case it gets stuck and times out. If it fails after multiple tries it's probably a real error.
126
-
command: |
127
-
STATUS=$(juju status --format json | yq .applications.openfga.application-status.current)
128
-
if [ "$STATUS" == "error" ]; then
129
-
# Sometimes the postgresql unit has a PrematureDataAccessError error so remove the relation and try again.
130
-
juju remove-relation openfga:database postgresql
131
-
# The unit will be blocked when it is waiting for the relation
STATUS=$(juju status --format json | yq .applications.ingress.application-status.current)
180
+
if [ "$STATUS" == "error" ]; then
181
+
# Sometimes the ingress unit will get into an error state, so resolve and try again.
182
+
echo "Ingress is in error state, resolving..."
183
+
juju resolved ingress/0
184
+
fi
153
185
- name: Wait for ingress
154
-
uses: nick-fields/retry@v3
186
+
uses: ./.github/actions/juju-wait-for
155
187
with:
188
+
type: unit
189
+
name: ingress/0
156
190
timeout_minutes: 1
157
-
max_attempts: 5# Retry the wait-for with a short timeout in case it gets stuck and times out. If it fails after multiple tries it's probably a real error.
158
-
command: |
159
-
STATUS=$(juju status --format json | yq .applications.ingress.application-status.current)
160
-
if [ "$STATUS" == "error" ]; then
161
-
# Sometimes the ingress unit will get into an error state, so resolve and try again.
162
-
juju resolved ingress/0
163
-
fi
164
-
juju wait-for unit ingress/0 --timeout=1m
191
+
juju-version: ${{ inputs.juju-version }}
165
192
- name: Set up ingress hostname and certs
166
193
shell: bash
167
194
run: |
@@ -170,11 +197,12 @@ runs:
170
197
juju run --wait=2m jimm-cert/0 get-ca-certificate --quiet | yq .ca-certificate | sudo tee /usr/local/share/ca-certificates/jimm-test.crt
171
198
sudo update-ca-certificates --fresh
172
199
- name: Wait for JIMM
173
-
uses: nick-fields/retry@v3
200
+
uses: ./.github/actions/juju-wait-for
174
201
with:
202
+
type: unit
203
+
name: jimm/0
175
204
timeout_minutes: 1
176
-
max_attempts: 5# Retry the wait-for with a short timeout in case it gets stuck and times out. If it fails after multiple tries it's probably a real error.
177
-
command: juju wait-for unit jimm/0 --timeout=1m # Wait for JIMM to be ready if it's still making config changes.
max_attempts: 5# Retry the wait-for with a short timeout in case it gets stuck and times out. If it fails after multiple tries it's probably a real error.
STATUS=$(juju status --format json | yq .applications.jimm.application-status.current)
254
+
if [ "$STATUS" == "error" ]; then
255
+
# Sometimes the jimm unit will get into an error state, so resolve and try again.
256
+
echo "JIMM is in error state, resolving..."
257
+
juju resolved jimm/0
258
+
fi
220
259
- name: Wait for JIMM pod to be recreated
221
-
uses: nick-fields/retry@v3
260
+
continue-on-error: true
261
+
uses: ./.github/actions/juju-wait-for
222
262
with:
263
+
type: application
264
+
name: jimm
223
265
timeout_minutes: 1
224
-
max_attempts: 5# Retry the wait-for with a short timeout in case it gets stuck and times out. If it fails after multiple tries it's probably a real error.
225
-
continue_on_error: true # Sometimes the error persists after a retry but it seems to work anyway.
STATUS=$(juju status --format json | yq .applications.dashboard.application-status.current)
83
+
if [ "$STATUS" == "error" ]; then
84
+
# Sometimes the dashboard unit will get into an error state, so resolve and try again.
85
+
echo "Dashboard is in error state, resolving..."
86
+
juju resolved dashboard/0
87
+
fi
76
88
- name: Wait for charm to be ready
77
-
uses: nick-fields/retry@v3
89
+
uses: ./.github/actions/juju-wait-for
78
90
with:
91
+
type: application
92
+
name: dashboard
79
93
timeout_minutes: 1
80
-
max_attempts: 5# Retry the wait-for with a short timeout in case it gets stuck and times out. If it fails after multiple tries it's probably a real error.
81
-
command: |
82
-
STATUS=$(juju status --format json | yq .applications.dashboard.application-status.current)
83
-
if [ "$STATUS" == "error" ]; then
84
-
# Sometimes the dashboard unit will get into an error state, so resolve and try again.
0 commit comments