Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Possiblity to run shell-commands as actions #2257

Closed
argoyle opened this issue Jun 20, 2024 · 2 comments
Closed

Feature Request: Possiblity to run shell-commands as actions #2257

argoyle opened this issue Jun 20, 2024 · 2 comments
Labels
enhancement New feature or request resource-shell Resource of kind Shell

Comments

@argoyle
Copy link

argoyle commented Jun 20, 2024

Is your feature request related to a problem?

I have a case where I want to run kubectl kustomize after updating some values using updatecli but before creating a pull request.

Solution you'd like

Either a way to run shell-commands as actions or a way to run everything except the actions (so I can run another shell-script and then run the full pipeline)

Alternatives you've considered

No response

Anything else?

No response

@olblak
Copy link
Member

olblak commented Jun 25, 2024

Thanks for suggesting this feature request. It's problem I stumble a while ago, Updatecli being declarative vs imperative.

The way we resolved this is by chaining targets together for example in the following snippet

name: example issue 2257
  
sources:
  chart:
    kind: helmchart
    name: Get latest Rancher Helm Chart version
    spec:
      url: https://releases.rancher.com/server-charts/latest
      name: rancher

targets:
  manifest:
    kind: yaml
    name: Update rancher/manifest.yaml
    spec:
      file: rancher/manifest.yaml
      key: $.version
    sourceid: chart

  kubectl:
    name: run kubectl when manifest.yaml changed
    kind: shell
    dependson:
      - manifest
    dependsonchange: true
    disablesourceinput: true
    spec:
      command: "kubectl apply -f rancher/manifest.yaml"

We use dependson + dependsonchange in the second target to only execute the command kubectl if rancher/manifest.yaml changed.

I still have a lot to document for the shell plugin.

@olblak olblak added resource-shell Resource of kind Shell enhancement New feature or request labels Jun 25, 2024
@olblak
Copy link
Member

olblak commented Jun 27, 2024

@argoyle I am closing this issue as I think my proposal solves your problem.
Feel free to reopen for further discussion.

@olblak olblak closed this as completed Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request resource-shell Resource of kind Shell
Projects
Status: Done
Development

No branches or pull requests

2 participants