Moved over to tag system
This commit is contained in:
parent
efe1e26b69
commit
7871cc868b
17
csccp.js
17
csccp.js
|
@ -3,17 +3,22 @@ const express = require('express')
|
||||||
const app = express()
|
const app = express()
|
||||||
const port = 2344
|
const port = 2344
|
||||||
|
|
||||||
const name = "cscclassprofilestaging"
|
|
||||||
const image = "registry.cloud.csclub.uwaterloo.ca/snedadah/csc-class-profile-staging"
|
|
||||||
|
|
||||||
app.get('/cscclassprofilestaging', async (req, res) => {
|
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 create deployment ${name} --image ${image} --port=80`);
|
||||||
await call(`kubectl expose deployment ${name}`);
|
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){
|
async function call(cmd){
|
||||||
|
@ -26,5 +31,5 @@ async function call(cmd){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log(`Example app listening on port ${port}`)
|
console.log(`Listening on port ${port}`)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue