Title
#help
Gal Bachar

Gal Bachar

05/26/2022, 11:50 AM
Hey all, Example taken from: https://docs.lakefs.io/setup/hooks.html How can I address all available branches (instead of just "main")?
name: Good files check
description: set of checks to verify that branch is good
on:
  pre-commit:
  pre-merge:
    branches:
      - main
hooks:
  - id: no_temp
    type: webhook
    description: checking no temporary files found
    properties:
      url: "<https://your.domain.io/webhook?notmp=true?t=1za2PbkZK1bd4prMuTDr6BeEQwWYcX2R>"
  - id: no_freeze
    type: webhook
    description: check production is not in dev freeze
    properties:
      url: "<https://your.domain.io/webhook?nofreeze=true?t=1za2PbkZK1bd4prMuTDr6BeEQwWYcX2R>"
n

Niro

05/26/2022, 11:59 AM
Hi @Gal Bachar, In the example you provided you can see 2 'on' targets:1. pre-commit without any branch - which means it will trigger on all branches 2. pre-merge with branches field = main which will trigger only on branch main
Itai David

Itai David

05/26/2022, 11:59 AM
Hi @Gal Bachar and thank you for this question You can address all branches by leaving the
branches:
entry empty Note that this will not work for
Tag
events
Gal Bachar

Gal Bachar

05/26/2022, 12:00 PM
@Niro @Itai David I believe I've tried the empty "branches:" approach, but let me make another attempt. I'll update here 🙂
n

Niro

05/26/2022, 1:02 PM
@Gal Bachar
// if no branches spec found - all match
	if actionOn == nil || len(actionOn.Branches) == 0 {
		return true, nil
	}
Providing no branch names under 'branches' or not providing 'branches' at all should do the trick . Please note: that this is the case only for lakeFS versions 0.62.0 and above. Let us know if it works out for you
Gal Bachar

Gal Bachar

05/26/2022, 1:34 PM
@Niro empty branches worked, thanks
n

Niro

05/26/2022, 1:59 PM
Great! Thanks for the update