Moved over to tag system

This commit is contained in:
Shahan Nedadahandeh 2022-06-09 00:30:52 -04:00
parent efe1e26b69
commit 7871cc868b
1 changed files with 11 additions and 6 deletions

View File

@ -3,17 +3,22 @@ const express = require('express')
const app = express()
const port = 2344
const name = "cscclassprofilestaging"
const image = "registry.cloud.csclub.uwaterloo.ca/snedadah/csc-class-profile-staging"
app.get('/cscclassprofilestaging', async (req, res) => {
await call(`kubectl delete deployment ${name}`);
const buildId = req.query.ref;
const name = `${buildId}-cscclassprofilestaging`
const publicUrl = `${name}-snedadah.k8s.csclub.cloud`
const image = `registry.cloud.csclub.uwaterloo.ca/snedadah/csc-class-profile-staging:${buildId}`
console.log("branch is " + req.query.ref, req.query);
await call(`kubectl delete deployment ${name}`);
await call(`kubectl create deployment ${name} --image ${image} --port=80`);
await call(`kubectl expose deployment ${name}`);
await call(`kubectl create ingress ${name} --rule='${name}-snedadah.k8s.csclub.cloud/*=${name}:80'`);
await call(`kubectl create ingress ${name} --rule='${publicUrl}/*=${name}:80'`);
console.log("Deploying on " + publicUrl);
res.send('Finished redeploy!')
res.send(publicUrl);
})
async function call(cmd){
@ -26,5 +31,5 @@ async function call(cmd){
}
}
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
console.log(`Listening on port ${port}`)
})