-
Notifications
You must be signed in to change notification settings - Fork 1
173 lines (153 loc) · 5.7 KB
/
Copy pathmigration-fresh-install.yml
File metadata and controls
173 lines (153 loc) · 5.7 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
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
name: "Langflow Migration: Fresh PostgreSQL Install"
on:
schedule:
- cron: "0 8 * * *" # 05:00 BRT (UTC-3)
workflow_dispatch:
env:
LANGFLOW_PORT: 7860
LANGFLOW_URL: http://localhost:7860
PG_USER: langflow
PG_PASSWORD: langflow_test_pw
PG_DB: langflow
permissions:
contents: read
issues: write
jobs:
fresh-install:
name: Fresh PostgreSQL Install (nightly)
runs-on: ubuntu-latest
timeout-minutes: 20
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: langflow
POSTGRES_PASSWORD: langflow_test_pw
POSTGRES_DB: langflow
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v7
- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install dependencies
run: pip install requests
- name: Pull Langflow nightly
run: |
docker pull langflowai/langflow-nightly:latest
docker inspect langflowai/langflow-nightly:latest \
--format='{{index .RepoDigests 0}}' | tee /tmp/nightly-digest.txt
echo "Nightly digest: $(cat /tmp/nightly-digest.txt)"
- name: Start Langflow nightly on fresh PostgreSQL
run: |
docker run -d --name langflow \
--network host \
-e LANGFLOW_DATABASE_URL="postgresql://$PG_USER:$PG_PASSWORD@localhost:5432/$PG_DB" \
-e LANGFLOW_AUTO_LOGIN=true \
-e LANGFLOW_SUPERUSER=langflow \
-e LANGFLOW_SUPERUSER_PASSWORD=langflow123 \
-e LANGFLOW_STORE=false \
langflowai/langflow-nightly:latest
- name: Wait for Langflow nightly (includes migrations)
run: python tests/github-workflows/migration/wait_for_langflow.py --timeout 180
env:
LANGFLOW_URL: ${{ env.LANGFLOW_URL }}
- name: Verify fresh install via API
run: python tests/github-workflows/migration/verify_fresh_install.py
env:
LANGFLOW_URL: ${{ env.LANGFLOW_URL }}
- name: Save container logs
if: always()
run: docker logs langflow > /tmp/langflow-fresh-install.log 2>&1 || true
- name: Upload logs
if: always()
uses: actions/upload-artifact@v7
with:
name: fresh-install-${{ github.run_number }}
path: |
/tmp/langflow-fresh-install.log
/tmp/nightly-digest.txt
- name: Cleanup
if: always()
run: docker stop langflow 2>/dev/null; docker rm langflow 2>/dev/null; true
- name: Close issue on success
if: success()
uses: actions/github-script@v9
with:
script: |
const { data: existing } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'migration-fresh-install',
state: 'open',
});
if (existing.length > 0) {
const issue = existing[0];
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: [
`## ✅ Run #${context.runNumber} — ${new Date().toISOString().split('T')[0]}`,
'',
'Fresh install test passed. Closing this issue.',
'',
`[Workflow Run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`,
].join('\n'),
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: 'closed',
});
}
- name: Create or update issue on failure
if: failure()
uses: actions/github-script@v9
with:
script: |
const fs = require('fs');
const digest = fs.existsSync('/tmp/nightly-digest.txt')
? fs.readFileSync('/tmp/nightly-digest.txt', 'utf8').trim().slice(-20)
: 'unknown';
const { data: existing } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'migration-fresh-install',
state: 'open',
});
const body = [
`## Fresh Install Failure — Run #${context.runNumber}`,
'',
`- **Date:** ${new Date().toISOString().split('T')[0]}`,
`- **Image:** \`langflowai/langflow-nightly:latest\` (\`...${digest}\`)`,
`- **Scenario:** Fresh PostgreSQL install (empty database)`,
'',
`[Workflow Run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`,
'',
'/cc @lice-reis',
].join('\n');
if (existing.length > 0) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: existing[0].number,
body,
});
} else {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Langflow Nightly: Fresh PostgreSQL Install Failed',
body,
labels: ['migration-fresh-install', 'automated'],
});
}