@@ -166,7 +166,7 @@ function performPostRequest(requestUrl, payload, token) {
166166 }
167167 });
168168}
169- function parseAndCheckAlembic(response) {
169+ function parseAndCheckAlembic(response, source_directory ) {
170170 return __awaiter(this, void 0, void 0, function* () {
171171 try {
172172 const output = response.output;
@@ -175,7 +175,7 @@ function parseAndCheckAlembic(response) {
175175 return false;
176176 }
177177 const lines = output.split("\r\n").filter((line) => line.trim() !== "");
178- const alembicFound = lines.some((line) => line.includes("**Alembic found **"));
178+ const alembicFound = lines.some((line) => line.includes("****"));
179179 if (alembicFound) {
180180 console.log("Alembic found!");
181181 return true;
@@ -249,6 +249,13 @@ function run() {
249249 let web_app = yield setupWebApp(baseWebAppUrl, api_token, domain_name);
250250 // Virtual Environment and Database Setup
251251 const consoleRequestUrl = `${baseApiUrl}/consoles/${consoleId}/send_input/`;
252+ // Git Pull
253+ try {
254+ yield postConsoleInput(consoleRequestUrl, api_token, `git -C ${web_app.source_directory} pull\n`, "Repository Pulled.");
255+ }
256+ catch (error) {
257+ throw new Error(`Error during pulling repository: ${error.message}`);
258+ }
252259 if (framework_type == 'django') {
253260 try {
254261 yield postConsoleInput(consoleRequestUrl, api_token, `source ${web_app.virtualenv_path}/bin/activate\n`, "Virtual Environment Activated.");
@@ -268,14 +275,13 @@ function run() {
268275 else if (framework_type == 'flask') {
269276 try {
270277 const alembicIniPath = `${web_app.source_directory}/alembic.ini`;
271- yield postConsoleInput(consoleRequestUrl, api_token, `if [ -f ${alembicIniPath} ]; then echo "**Alembic found**"; else echo "Alembic not found"; fi \n`, "Alembic configuration check completed.");
278+ yield postConsoleInput(consoleRequestUrl, api_token, `find ${web_app.source_directory} -type f -name "alembic.ini" -print \n`, "Alembic configuration check completed.");
272279 const alembicResponse = yield getLatestConsoleOutput(baseApiUrl, consoleId, api_token, "Alembic.ini Checking.");
273- const isAlembicUsing = yield parseAndCheckAlembic(alembicResponse);
280+ const isAlembicUsing = yield parseAndCheckAlembic(alembicResponse, web_app.source_directory );
274281 yield postConsoleInput(consoleRequestUrl, api_token, `source ${web_app.virtualenv_path}/bin/activate\n`, "Virtual Environment Activated.");
275282 yield postConsoleInput(consoleRequestUrl, api_token, `pip install -r ${web_app.source_directory}/requirements.txt\n`, "Requirements Installed.");
276283 if (isAlembicUsing) {
277284 console.log("Alembic migration starting...");
278- yield postConsoleInput(consoleRequestUrl, api_token, `source ${web_app.virtualenv_path}/bin/activate\n`, "Virtual Environment Activated.");
279285 yield postConsoleInput(consoleRequestUrl, api_token, `alembic upgrade head\n`, "Alembic migrations applied.");
280286 }
281287 }
0 commit comments