Post-deploy abra.sh hooks #292
Labels
Clear labels
bug
build
ci/cd
critical fix
design
documentation
duplicate
easy-first-issue
enhancement
help wanted
i10n
i18n
installer
invalid
question
release
release-candidate
security
tech-debt
test
wontfix
Something is not working
go build related issues
Building things with CI/CD
https://docs.coopcloud.tech/federation/resolutions/passed/010/
UI/UX
Documenting all the things
This issue or pull request already exists
Something for new people to get stuck into. We hope it's easy!
New feature
Need some help
Everything to do with localisation
Everything to do with internationalisation
Everything to do with the install script.
Something is wrong
More information is needed
Release management
Related to the new release candidate
Security related
Unit/integration testing
This won't be fixed
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
3wordchant
aadil (Aadil Ayub)
abra-bot (Abra Bot)
ammaratef45
amras (Sarma)
Apfelwurm
BornDeleuze
Brooke
carla
cas (Cassowary)
coopcloud
cyrnel
decentral1se (d1)
dede
devydave
fauno (fauno)
iexos
jade (Jade Ambrose)
jjsfunhouse
jmakdah2 (Jackie Makdah)
joe-irving (Joe Irving)
kawaiipunk (KawaiiPunk)
knoflook
kolaente
lambdabundesverband
linnealovespie (April)
moosemower
moritz
notplants
oxaliq (sorrel)
p4u1
pharaohgraphy (Andrew 🐦🔥❤️🔥✴️)
renovate-bot (Comrade Renovate Bot)
ripclap
simon
sixsmith (Sixsmith)
stevensting
trav (Trav Fryer)
val (val (he/him))
yksflip
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: toolshed/abra#292
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This solves coop-cloud/organising#235
To execute commands after each
abra app deployadd the env:POST_DEPLOY_CMDS="<container> <command> <arguments>|<container> <command2> <arguments2>|... "To execute commands after each
abra app upgradeadd the env:POST_UPGRADE_CMDS="<container> <command> <arguments>|..."It is important that the health checks are working correctly and the timeout is high enough, because the commands are only executed after the services converged successfully.
LGTM! Some minor comments. Can you also throw up some docs for this new functionality as well? Thanks!
@@ -207,1 +207,4 @@postDeployCmds, ok := app.Env["POST_UPGRADE_CMDS"]if ok && !internal.DontWaitConverge {logrus.Debugf("Run the following post-deploy commands: %s", postDeployCmds)nitpick:
Run->runsince the rest of the codebase uses lowercase@@ -208,0 +209,4 @@if ok && !internal.DontWaitConverge {logrus.Debugf("Run the following post-deploy commands: %s", postDeployCmds)if err := internal.PostCmds(cl, app, postDeployCmds); err != nil {logrus.Fatal(err)logrus.Fatalf("attempting to run post deploy commands, saw: %s", err)?@@ -7,2 +20,4 @@"github.com/sirupsen/logrus")func RunCmdRemote(cl *dockerClient.Client, app config.App, abraSh, serviceName, cmdName, cmdArgs string) error {Missing docstring?
@@ -8,1 +22,4 @@func RunCmdRemote(cl *dockerClient.Client, app config.App, abraSh, serviceName, cmdName, cmdArgs string) error {filters := filters.NewArgs()filters.Add("name", fmt.Sprintf("^%s_%s", app.StackName(), serviceName))I'd recommend using the
app.Filtersif possible due to the often bizarre handling of filters in the Docker API. You'd passexactMatch = truewhich I think is more readable for our future selves.I just moved this function from
cli/app/cmd.gowithout touching it.I think
app.Filtersdoesn't make sense here, because it filters for all services and in this case only a filter forserviceNameis required.@@ -166,1 +167,4 @@postDeployCmds, ok := app.Env["POST_DEPLOY_CMDS"]if ok && !DontWaitConverge {logrus.Debugf("Run the following post-deploy commands: %s", postDeployCmds)nitpick: Run -> run since the rest of the codebase uses lowercase
@@ -167,0 +169,4 @@if ok && !DontWaitConverge {logrus.Debugf("Run the following post-deploy commands: %s", postDeployCmds)if err := PostCmds(cl, app, postDeployCmds); err != nil {logrus.Fatal(err)logrus.Fatalf("attempting to run post deploy commands, saw: %s", err)?
@@ -167,0 +176,4 @@return nil}func PostCmds(cl *dockerClient.Client, app config.App, commands string) error {Missing doc string?
@@ -167,0 +196,4 @@if len(commandParts) > 2 {parsedCmdArgs = fmt.Sprintf("%s ", strings.Join(commandParts[2:], " "))}logrus.Infof("Running post-command '%s %s' in container %s", cmdName, parsedCmdArgs, targetServiceName)nitpick: Running -> running since the rest of the codebase uses lowercase
6c993e812cto14bdb57ac7Some docs: https://docs.coopcloud.tech/maintainers/handbook/#global-environment-variables