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

[feat] Skip stages when the commit is not important (Analysis,WaitApproval,Wait,ScriptRun) #4899

Open
t-kikuc opened this issue Apr 25, 2024 · 6 comments · May be fixed by #4922
Open

[feat] Skip stages when the commit is not important (Analysis,WaitApproval,Wait,ScriptRun) #4899

t-kikuc opened this issue Apr 25, 2024 · 6 comments · May be fixed by #4922
Assignees
Labels
kind/enhancement New feature or request

Comments

@t-kikuc
Copy link
Member

t-kikuc commented Apr 25, 2024

What would you like to be added

  • A new feature of skipping the ANALYSIS or WAIT_APPROVAL stages when the commit diff is not important.

  • The configurable conditions of skipping the stage:

Why is it needed

  • Some users would like to skip the ANALYSIS or WAIT_APPROVAL stages for faster and automatic deployment when the commit diff does not deserve analysis or approval.

  • use cases:
    (a) When you modify only the HorizontalPodAutoscaler of K8s resources in your config repo, skip the WAIT_APPROVAL stage.
    (b) When you modify only go.mod dependencies in your source repo(not pipecd's config repo), skip the ANALYSIS stage.
    (c) Skip the WAIT_APPROVAL stage when the change in your source repo is small, but skip both the WAIT_APPROVAL and ANALYSIS stages when the change is tiny.

How to realize it

  • Add the skip configuration to app.pipecd.yaml.
spec:
  pipeline:
    stages:
      # When changes are only `autoscaler.yaml` in any directory, skip this WAIT_APPROVAL.
      - name: WAIT_APPROVAL
        skip:
           paths:
              - "**/autoscaler.yaml"
      # When the commit message starts with "[skip analysis]", skip this ANALYSIS.
      - name: ANALYSIS
        skip:
            commitMessagePrefixes:
             - "[skip analysis]"

Example1. How to realize the use case (b)

  1. Configure eventWatcher and pipeline in your app.pipecd.yaml.
spec:
  eventWatcher:
    - matcher:
        name: skip-analysis
      handler:
        type: GIT_UPDATE
        config:
          commitMessage: "[skip analysis] update xxx"
  pipeline:
      stages:
      - name: ANALYSIS
        skip:
            commitMessagePrefixes:
             - "[skip analysis]"
  1. Let your CI publish an event named skip-analysis if only go.mod is changed.

Example2. How to realize the use case (c)

  1. Configure eventWatcher and pipeline in your app.pipecd.yaml.
spec:
  eventWatcher:
    - matcher:
        name: small-change
      handler:
        type: GIT_UPDATE
        config:
          commitMessage: "[small change] update xxx"
    - matcher:
        name: tiny-change
      handler:
        type: GIT_UPDATE
        config:
          commitMessage: "[tiny change] update yyy"
  pipeline:
      stages:
      - name: WAIT_APPROVAL
        skip:
           commitMessagePrefixes:
              - "[small change]"
              - "[tiny change]"
      - name: ANALYSIS
        skip:
            commitMessagePrefixes:
             - "[tiny change]"
  1. Let your CI publish an event named small-change to skip only WAIT_APPROVAL, and tiny-change to skip both WAIT_APPROVAL and ANALYSIS.

Possible Extensions

  • In addition to commitMessagePrefixes, it would be better to have other options like:
    • skip.commitMessageOrBodyContains: []string
      • It skips the stage when the title or body of the commit contains words you specify.
    • skip.commitMessageOrBodyContainsCommand: bool
@t-kikuc t-kikuc added the kind/enhancement New feature or request label Apr 25, 2024
@t-kikuc
Copy link
Member Author

t-kikuc commented Apr 25, 2024

[Acknowledgment]
I made this feature idea with @peaceiris, thanks!

@khanhtc1202
Copy link
Member

I would like to add WAIT stage to the supported list, since it similar with the above 2 stages.

@t-kikuc
Copy link
Member Author

t-kikuc commented Apr 26, 2024

I would like to add WAIT stage to the supported list, since it similar with the above 2 stages.

thanks, I agree with you and it's easily possible.

@t-kikuc t-kikuc changed the title [feat] Skip Analysis/WaitApproval stages when the commit is not important [feat] Skip Analysis/WaitApproval/Wait stages when the commit is not important Apr 26, 2024
@t-kikuc
Copy link
Member Author

t-kikuc commented Apr 26, 2024

cf. Skipping the ANALYSIS stage manually on the console is already available by:

@peaceiris
Copy link
Contributor

peaceiris commented May 14, 2024

The SCRIPT_RUN stage is also useful if supported.

In our case, we plan to trigger an e2e testing by a script run stage. The stage should be skipped for quick rollback.

@khanhtc1202 khanhtc1202 self-assigned this May 17, 2024
@t-kikuc t-kikuc changed the title [feat] Skip Analysis/WaitApproval/Wait stages when the commit is not important [feat] Skip stages when the commit is not important (Analysis,WaitApproval,Wait,ScriptRun) May 19, 2024
@t-kikuc t-kikuc assigned t-kikuc and unassigned khanhtc1202 May 20, 2024
@t-kikuc
Copy link
Member Author

t-kikuc commented May 20, 2024

I'll take this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants