mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
rework updates and deployments
This commit is contained in:
parent
3676dfaf70
commit
4639d11a7e
2 changed files with 51 additions and 19 deletions
33
commands/message/dev/deploy.js
Normal file
33
commands/message/dev/deploy.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
const { createEmbed } = require('../../../labscore/utils/embed')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
|
||||
module.exports = {
|
||||
name: "update",
|
||||
label: "flags",
|
||||
metadata: {
|
||||
description: `Queries pb manager to trigger a deploy and restart flow`,
|
||||
description_short: '[MANAGER] Query deploy',
|
||||
examples: ['update'],
|
||||
category: 'dev',
|
||||
usage: 'update'
|
||||
},
|
||||
onBefore: context => context.user.isClientOwner,
|
||||
onCancel: () => { },
|
||||
run: async (context) => {
|
||||
if (process.env.environment == "prodnew") return await editOrReply(context, createEmbed("error", "Cannot deploy on this instance."))
|
||||
await editOrReply(context, createEmbed("loading", context, "Querying deploy..."))
|
||||
|
||||
try {
|
||||
const t = Date.now()
|
||||
|
||||
// Call server to query update
|
||||
await superagent.post(`${process.env.PB_MANAGER_HOST}_pbs/DeployPbService`)
|
||||
.set("Authorization", process.env.PB_MANAGER_KEY)
|
||||
|
||||
return await editOrReply(context, createEmbed("success", "Deployment queried at manager. Shutting down."))
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return await editOrReply(context, createEmbed("error", "Manager reported error during deploy query."))
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue