2 min wait

This commit is contained in:
Aditya Thakral 2021-06-14 19:08:42 -04:00
parent b0d57a30bb
commit 92a154d16b
1 changed files with 7 additions and 5 deletions

View File

@ -14,7 +14,7 @@ const base64 = Buffer.from(
app.use(Express.static(__dirname + "/out")); app.use(Express.static(__dirname + "/out"));
app.post("/", async (req, res) => { app.post("/", (req, res) => {
const header = req.header("authorization"); const header = req.header("authorization");
if (header == null) { if (header == null) {
@ -39,23 +39,25 @@ app.post("/", async (req, res) => {
return; return;
} }
res.send("Updating website ...");
await sleep(15);
updateWebsite(); updateWebsite();
res.send("Updating website ...");
}); });
app.listen(PORT, () => { app.listen(PORT, () => {
console.log(`👀 http://localhost:${PORT}`); console.log(`👀 http://localhost:${PORT}`);
}); });
function updateWebsite() { async function updateWebsite() {
const branch = "main"; const branch = "main";
const job = "staging"; const job = "staging";
const url = `https://git.uwaterloo.ca/csc/website/-/jobs/artifacts/${branch}/download?job=${job}`; const url = `https://git.uwaterloo.ca/csc/website/-/jobs/artifacts/${branch}/download?job=${job}`;
const zipPath = `zips/${branch}.zip`; const zipPath = `zips/${branch}.zip`;
// Wait for pipeline to succeed and artifacts to be available
await sleep(120);
execSync(`wget -O ${zipPath} '${url}'`); execSync(`wget -O ${zipPath} '${url}'`);
execSync(`yes All | unzip ${zipPath}`); execSync(`yes All | unzip ${zipPath}`);
} }