woodpecker-ci / woodpecker

Woodpecker is a simple, yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
4.32k stars 373 forks source link

Add Manual workflow Trigger #1668

Closed tiny-pangolin closed 1 year ago

tiny-pangolin commented 1 year ago

Clear and concise description of the problem

I would like to be a able to run only certian workflows in a deployment without updating code in a repository.

Suggested solution

Add a an option in the yaml file or a UI option that requires each workflow be triggered manually.

Alternative

Additional context

I would like to see manual workflow steps added so I can have a 1 work flow per ansible role I would like to deploy. Then start a build manually to deploy that role whenever without updating git. This would function to manual steps in bitbucket pipelines https://bitbucket.org/blog/pipelines-manual-steps-confidence-deployment-pipeline

Validations

6543 commented 1 year ago

hmm you can already skip by filter out event "manual" for all workflows not intended to run

I don't think we should make a selector for workflows ... if at all, an option to specify the config path (witch would result in same functionality)

6543 commented 1 year ago

-> #1722

anbraten commented 1 year ago

You can pass variables already using the manual workflow. Such a variable could be the ansible role / filter. Or you could pre-define all ansible tasks you want to execute and add when filters like:

when:
  - evaluate: 'MY_ROLE == "openssh"'
tiny-pangolin commented 1 year ago

How would I define MY_ROLE I updated one of my files in the .woodpecker folder and I am getting an error saying

Execution error
unknown name ROLES (1:1) | ROLES contains "kics" | ^

when roles defined as a secret and and as a variable when I run the pipeline manually? I am guess this section of the docs is the right place to look

clone:
  git:
    image: woodpeckerci/plugin-git
    settings:
      skip_verify: true
pipeline:
  KICS Scan:
    image: checkmarx/kics:latest
    commands:
      - kics scan --no-progress -p . --disable-secrets --report-formats json --output-name kics-results
    when:
      - evaluate: 'ROLES contains "kics"'
  Ansible Lint:
    image: docker.io/pipelinecomponents/ansible-lint
    commands:
      - ansible-lint --show-relpath .
    when:
      - evaluate: 'ROLES contains "lint"'
zc-devs commented 1 year ago

You can pass variables already using the manual workflow. Such a variable could be the ansible role / filter. Or you could pre-define all ansible tasks you want to execute and add when filters like:

when:
  - evaluate: 'MY_ROLE == "openssh"'

That doesn't work :(

when:
  event: manual
  evaluate: 'TESTVAR == "testval"'
skip_clone: true
steps:
...

Screenshot 2023-06-10 171903 Screenshot 2023-06-10 171942

Only built-in environment variables work now.

tiny-pangolin commented 1 year ago

After updating the container this worked thanks for all the hard work :)

anbraten commented 1 year ago

seems to be resolved