Skip to content

CLI: command to set deployment hooks on a deployment config #9040

Closed

Description

@csrwng

The goal of this command is to make it straightforward to set (pre/mid/post) deployment hook commands on deployment configs.

Basic form:

oc set deployment-hook [dc/]DEPLOYMENT_CONFIG --pre|--mid|--post [options] -- COMMAND

Options:
--remove - removes the specified hook (any combination of --pre / --mid / --post ) is allowed
-e --env - sets the environment for the hook
-c --container - sets the container for the hook (if not specified, the first container is used)
-v --volumes - (comma-separated list) set the volumes from the pod template to use in the hook
--on-failure - set the failure policy, one of abort, retry, ignore

Notes:
The command only applies to deployment configs
--pre, --mid, and --post are mutually exclusive, except when --remove is specified.
If --remove is specified, other options besides --pre,--mid and --post are not allowed.

Activity

  1. csrwng commented on May 26, 2016

    @csrwng
    ContributorAuthor

    @bparees @jwforres @fabianofranz @Kargakis @smarterclayton any feedback on this command is greatly appreciated.

  2. 0xmichalis commented on May 26, 2016

    @0xmichalis
    Contributor

    Not only deployment configs will have hooks. oc set hook or oc set hooks. I still don't like that we have --remove on other set commands, is it time for a oc unset command?

  3. bparees commented on May 26, 2016

    @bparees
    Contributor

    @csrwng the command is also going to be used to set buildconfig hooks (or rather, a symmetrical command will exist for that, anyway).

  4. bparees commented on May 26, 2016

    @bparees
    Contributor

    @csrwng does this proposal align with the existing oc set triggers and oc set probe commands?

  5. bparees commented on May 26, 2016

    @bparees
    Contributor

    Not only deployment configs will have hooks. oc set hook or oc set hooks

    that becomes problematic when not everything has the same hook names. DCs have pre/mid/post. Buildconfigs have post (and that's really post-commit, as opposed to post build or post push).

  6. 0xmichalis commented on May 26, 2016

    @0xmichalis
    Contributor

    and that's really post-commit, as opposed to post build or post push

    ouch

    General question: what happens if someone wants to set a container hook inside their dc template? There are pre(stop) and post(start)

  7. bparees commented on May 26, 2016

    @bparees
    Contributor

    ouch

    not sure why "ouch", it's the logical step in the build lifecycle to let people take action, for our use case.

    General question: what happens if someone wants to set a container hook inside their dc template? There are pre(stop) and post(start)

    guessing we'd add an oc set container-hook command with --pre-stop and --post-start args?

  8. 0xmichalis commented on May 26, 2016

    @0xmichalis
    Contributor

    Or use subcommands (again)? oc set hook build, oc set hook deploy, oc set hook container, etc. I don't know if I like subcommands less or more than polluting set with different kinds of commands just for hooks. For example, oc create route has subcommands for the different types of tls termination.

  9. csrwng commented on May 26, 2016

    @csrwng
    ContributorAuthor

    @csrwng does this proposal align with the existing oc set triggers and oc set probe commands?

    sort of ... oc set-probe lets you select multiple objects to set a probe on (either through --all or using a --selector). I wasn't sure that it made sense to do the same for the deployment hooks.

  10. csrwng commented on May 26, 2016

    @csrwng
    ContributorAuthor

    @csrwng the command is also going to be used to set buildconfig hooks (or rather, a symmetrical command will exist for that, anyway).

    Yes, I was going to use a separate issue for that :) The options there are much simpler.

  11. csrwng commented on May 26, 2016

    @csrwng
    ContributorAuthor

    Or use subcommands (again)? oc set hook build, oc set hook deploy, oc set hook container

    I'm not sure that I'd prefer that as an end-user. It makes it harder to discover what kinds of things I can set.

  12. smarterclayton commented on May 26, 2016

    @smarterclayton
    Contributor

    I would expect a different command - oc set build-hooks. That's not
    unreasonable, build hooks are != deployment hooks, while build and
    deployment triggers should be aligned (there is nothing special about
    either trigger - they merely mutate fields)

    On Thu, May 26, 2016 at 1:39 PM, Cesar Wong [email protected]
    wrote:

    Or use subcommands (again)? oc set hook build, oc set hook deploy, oc set
    hook container

    I'm not sure that I'd prefer that as an end-user. It makes it harder to
    discover what kinds of things I can set.

    —
    You are receiving this because you were assigned.
    Reply to this email directly or view it on GitHub
    #9040 (comment)

  13. fabianofranz commented on May 30, 2016

    @fabianofranz
    Contributor

    I'm ok with having them as separate commands like oc set deployment-hook|build-hook given they are different enough in terms of command symmetry (different hooks, with different args and flags, etc). It's much less problematic to have a composed command name when it's not at the top level (like under set here). It's also much less problematic when it's "noun-noun" like deployment-hook and build-hook because we can have the same names under a different top-level verb, like unset.

    That said the only thing I really don't like here is to have one more command using the set --remove pattern. I think it's really time for an oc unset and I opened #9087 to track it.

  14. csrwng commented on May 31, 2016

    @csrwng
    ContributorAuthor

    oc set probe --selector and --all should apply to this case as well

  15. csrwng commented on May 31, 2016

    @csrwng
    ContributorAuthor

    The command should also take a -f or --filename argument like oc set probe does. Objects that it does not modify should be allowed to pass through. Other oc set commands should be fixed to allow objects to pass through.

  16. csrwng commented on May 31, 2016

    @csrwng
    ContributorAuthor

    For now the behavior of -f will be the same as for oc set probe. Objects will be taken from the input file and not read from the server (as in oc patch).

  17. csrwng commented on Jun 10, 2016

    @csrwng
    ContributorAuthor

    Implemented by #9817

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions