Skip to content

Commit b3c0b30

Browse files
authored
ci: add disable daily DB refresh flag
1 parent f7708c9 commit b3c0b30

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ on:
1717
default: true
1818
required: true
1919
type: boolean
20+
sandboxNoDbRefresh:
21+
description: 'Sandbox Disable Daily DB Refresh'
22+
default: false
23+
required: true
24+
type: boolean
2025
legacySandbox:
2126
description: 'Deploy to Legacy Sandbox'
2227
default: false
@@ -325,7 +330,7 @@ jobs:
325330
npm ci
326331
cd ../..
327332
echo "Start Deploy..."
328-
node ./dev/deploy-to-container/cli.js --branch ${{ github.ref_name }} --domain dev.ietf.org --appversion ${{ env.PKG_VERSION }} --commit ${{ github.sha }} --ghrunid ${{ github.run_id }}
333+
node ./dev/deploy-to-container/cli.js --branch ${{ github.ref_name }} --domain dev.ietf.org --appversion ${{ env.PKG_VERSION }} --commit ${{ github.sha }} --ghrunid ${{ github.run_id }} --nodbrefresh ${{ github.event.inputs.sandboxNoDbRefresh }}
329334
330335
- name: Cleanup old docker resources
331336
env:

dev/deploy-to-container/cli.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ async function main () {
175175
Image: 'ghcr.io/ietf-tools/datatracker-db:latest',
176176
name: `dt-db-${branch}`,
177177
Hostname: `dt-db-${branch}`,
178+
Labels: {
179+
...argv.nodbrefresh ?? { nodbrefresh: '1' }
180+
},
178181
HostConfig: {
179182
NetworkMode: 'shared',
180183
RestartPolicy: {
@@ -194,6 +197,9 @@ async function main () {
194197
Env: [
195198
`CELERY_PASSWORD=${mqKey}`
196199
],
200+
Labels: {
201+
...argv.nodbrefresh ?? { nodbrefresh: '1' }
202+
},
197203
HostConfig: {
198204
Memory: 4 * (1024 ** 3), // in bytes
199205
NetworkMode: 'shared',
@@ -222,6 +228,9 @@ async function main () {
222228
`CELERY_ROLE=${conConf.role}`,
223229
'UPDATE_REQUIREMENTS_FROM=requirements.txt'
224230
],
231+
Labels: {
232+
...argv.nodbrefresh ?? { nodbrefresh: '1' }
233+
},
225234
HostConfig: {
226235
Binds: [
227236
'dt-assets:/assets',
@@ -254,7 +263,8 @@ async function main () {
254263
appversion: `${argv.appversion}` ?? '0.0.0',
255264
commit: `${argv.commit}` ?? 'unknown',
256265
ghrunid: `${argv.ghrunid}` ?? '0',
257-
hostname
266+
hostname,
267+
...argv.nodbrefresh ?? { nodbrefresh: '1' }
258268
},
259269
HostConfig: {
260270
Binds: [

dev/deploy-to-container/refresh.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ async function main () {
2424
const containersToRestart = []
2525
for (const container of containers) {
2626
if (
27-
container.Names.some(n => n.startsWith('/dt-db-'))
27+
container.Names.some(n => n.startsWith('/dt-db-')) &&
28+
container.Labels?.nodbrefresh !== '1'
2829
) {
2930
console.info(`Terminating DB container ${container.Id}...`)
3031
dbContainersToCreate.push(container.Names.find(n => n.startsWith('/dt-db-')).substring(1))
@@ -37,9 +38,11 @@ async function main () {
3738
v: true
3839
})
3940
} else if (
40-
container.Names.some(n => n.startsWith('/dt-app-')) ||
41-
container.Names.some(n => n.startsWith('/dt-celery-')) ||
42-
container.Names.some(n => n.startsWith('/dt-beat-'))
41+
(
42+
container.Names.some(n => n.startsWith('/dt-app-')) ||
43+
container.Names.some(n => n.startsWith('/dt-celery-')) ||
44+
container.Names.some(n => n.startsWith('/dt-beat-'))
45+
) && container.Labels?.nodbrefresh !== '1'
4346
) {
4447
if (container.State === 'running') {
4548
const appContainer = dock.getContainer(container.Id)

0 commit comments

Comments
 (0)