Skip to content

Commit 046a5bf

Browse files
authored
Merge branch 'main' into fix/rocketchat-channel-template
2 parents 3f4530c + cdd134a commit 046a5bf

File tree

16 files changed

+152
-32
lines changed

16 files changed

+152
-32
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
runs-on: ubuntu-latest
2222
strategy:
2323
matrix:
24-
thread: [ 0, 1, 2 ]
24+
thread: [0, 1, 2]
2525
steps:
2626
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
27-
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
27+
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
2828
- uses: ./.github/promci/actions/build
2929
with:
3030
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
@@ -40,7 +40,7 @@ jobs:
4040
image: quay.io/prometheus/golang-builder:1.23-base
4141
steps:
4242
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
43-
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
43+
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
4444
- uses: ./.github/promci/actions/setup_environment
4545
- run: make
4646
- run: git diff --exit-code

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
17+
thread: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
1818
needs: ci
1919
steps:
2020
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
21-
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
21+
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
2222
- uses: ./.github/promci/actions/build
2323
with:
2424
parallelism: 12
@@ -29,7 +29,7 @@ jobs:
2929
needs: build
3030
steps:
3131
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
32-
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
32+
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
3333
- uses: ./.github/promci/actions/publish_main
3434
with:
3535
docker_hub_login: ${{ secrets.docker_hub_login }}

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
17+
thread: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
1818
needs: ci
1919
steps:
2020
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
21-
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
21+
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
2222
- uses: ./.github/promci/actions/build
2323
with:
2424
parallelism: 12
@@ -29,7 +29,7 @@ jobs:
2929
needs: build
3030
steps:
3131
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
32-
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
32+
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
3333
- uses: ./.github/promci/actions/publish_release
3434
with:
3535
docker_hub_login: ${{ secrets.docker_hub_login }}

cli/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func Execute() {
155155
app.Flag("timeout", "Timeout for the executed command").Default("30s").DurationVar(&timeout)
156156
app.Flag("http.config.file", "HTTP client configuration file for amtool to connect to Alertmanager.").PlaceHolder("<filename>").ExistingFileVar(&httpConfigFile)
157157
app.Flag("version-check", "Check alertmanager version. Use --no-version-check to disable.").Default("true").BoolVar(&versionCheck)
158-
app.Flag("enable-feature", fmt.Sprintf("Experimental features to enable. The flag can be repeated to enable multiple features. Valid options: %s", strings.Join(featurecontrol.AllowedFlags, ", "))).Default("").StringVar(&featureFlags)
158+
app.Flag("enable-feature", fmt.Sprintf("Experimental features to enable, comma separated. Valid options: %s", strings.Join(featurecontrol.AllowedFlags, ", "))).Default("").StringVar(&featureFlags)
159159

160160
app.Version(version.Print("amtool"))
161161
app.GetFlag("help").Short('h')

cmd/alertmanager/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func run() int {
176176
tlsConfigFile = kingpin.Flag("cluster.tls-config", "[EXPERIMENTAL] Path to config yaml file that can enable mutual TLS within the gossip protocol.").Default("").String()
177177
allowInsecureAdvertise = kingpin.Flag("cluster.allow-insecure-public-advertise-address-discovery", "[EXPERIMENTAL] Allow alertmanager to discover and listen on a public IP address.").Bool()
178178
label = kingpin.Flag("cluster.label", "The cluster label is an optional string to include on each packet and stream. It uniquely identifies the cluster and prevents cross-communication issues when sending gossip messages.").Default("").String()
179-
featureFlags = kingpin.Flag("enable-feature", fmt.Sprintf("Experimental features to enable. The flag can be repeated to enable multiple features. Valid options: %s", strings.Join(featurecontrol.AllowedFlags, ", "))).Default("").String()
179+
featureFlags = kingpin.Flag("enable-feature", fmt.Sprintf("Comma-separated experimental features to enable. Valid options: %s", strings.Join(featurecontrol.AllowedFlags, ", "))).Default("").String()
180180
)
181181

182182
promslogflag.AddFlags(kingpin.CommandLine, &promslogConfig)

config/config.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -968,11 +968,7 @@ type InhibitRule struct {
968968
TargetMatchers Matchers `yaml:"target_matchers,omitempty" json:"target_matchers,omitempty"`
969969
// A set of labels that must be equal between the source and target alert
970970
// for them to be a match.
971-
Equal model.LabelNames `yaml:"-" json:"-"`
972-
// EqualStr allows us to validate the label depending on whether UTF-8 is
973-
// enabled or disabled. It should be removed when Alertmanager is updated
974-
// to use the validation modes in recent versions of prometheus/common.
975-
EqualStr []string `yaml:"equal,omitempty" json:"equal,omitempty"`
971+
Equal []string `yaml:"equal,omitempty" json:"equal,omitempty"`
976972
}
977973

978974
// UnmarshalYAML implements the yaml.Unmarshaler interface for InhibitRule.
@@ -994,12 +990,11 @@ func (r *InhibitRule) UnmarshalYAML(unmarshal func(interface{}) error) error {
994990
}
995991
}
996992

997-
for _, l := range r.EqualStr {
993+
for _, l := range r.Equal {
998994
labelName := model.LabelName(l)
999995
if !compat.IsValidLabelName(labelName) {
1000996
return fmt.Errorf("invalid label name %q in equal list", l)
1001997
}
1002-
r.Equal = append(r.Equal, labelName)
1003998
}
1004999

10051000
return nil

config/config_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ func TestInhibitRuleEqual(t *testing.T) {
14611461
// The inhibition rule should have the expected equal labels.
14621462
require.Len(t, c.InhibitRules, 1)
14631463
r := c.InhibitRules[0]
1464-
require.Equal(t, model.LabelNames{"qux", "corge"}, r.Equal)
1464+
require.Equal(t, []string{"qux", "corge"}, r.Equal)
14651465

14661466
// Should not be able to load configuration with UTF-8 in equals list.
14671467
_, err = LoadFile("testdata/conf.inhibit-equal-utf8.yml")
@@ -1484,7 +1484,7 @@ func TestInhibitRuleEqual(t *testing.T) {
14841484
// The inhibition rule should have the expected equal labels.
14851485
require.Len(t, c.InhibitRules, 1)
14861486
r = c.InhibitRules[0]
1487-
require.Equal(t, model.LabelNames{"qux", "corge"}, r.Equal)
1487+
require.Equal(t, []string{"qux", "corge"}, r.Equal)
14881488

14891489
// Should also be able to load configuration with UTF-8 in equals list.
14901490
c, err = LoadFile("testdata/conf.inhibit-equal-utf8.yml")
@@ -1493,5 +1493,5 @@ func TestInhibitRuleEqual(t *testing.T) {
14931493
// The inhibition rule should have the expected equal labels.
14941494
require.Len(t, c.InhibitRules, 1)
14951495
r = c.InhibitRules[0]
1496-
require.Equal(t, model.LabelNames{"qux🙂", "corge"}, r.Equal)
1496+
require.Equal(t, []string{"qux🙂", "corge"}, r.Equal)
14971497
}

docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ The fields are documented in the [Rocketchat API api models](https://github.com/
13611361
[ msg: <tmpl_string> ]
13621362
```
13631363

1364-
### `<slack_config>`
1364+
#### `<slack_config>`
13651365

13661366
Slack notifications can be sent via [Incoming webhooks](https://api.slack.com/messaging/webhooks) or [Bot tokens](https://api.slack.com/authentication/token-types).
13671367

inhibit/inhibit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func NewInhibitRule(cr config.InhibitRule) *InhibitRule {
214214

215215
equal := map[model.LabelName]struct{}{}
216216
for _, ln := range cr.Equal {
217-
equal[ln] = struct{}{}
217+
equal[model.LabelName(ln)] = struct{}{}
218218
}
219219

220220
return &InhibitRule{

inhibit/inhibit_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ func TestInhibitRuleMatches(t *testing.T) {
144144
rule1 := config.InhibitRule{
145145
SourceMatch: map[string]string{"s1": "1"},
146146
TargetMatch: map[string]string{"t1": "1"},
147-
Equal: model.LabelNames{"e"},
147+
Equal: []string{"e"},
148148
}
149149
rule2 := config.InhibitRule{
150150
SourceMatch: map[string]string{"s2": "1"},
151151
TargetMatch: map[string]string{"t2": "1"},
152-
Equal: model.LabelNames{"e"},
152+
Equal: []string{"e"},
153153
}
154154

155155
m := types.NewMarker(prometheus.NewRegistry())
@@ -240,12 +240,12 @@ func TestInhibitRuleMatchers(t *testing.T) {
240240
rule1 := config.InhibitRule{
241241
SourceMatchers: config.Matchers{&labels.Matcher{Type: labels.MatchEqual, Name: "s1", Value: "1"}},
242242
TargetMatchers: config.Matchers{&labels.Matcher{Type: labels.MatchNotEqual, Name: "t1", Value: "1"}},
243-
Equal: model.LabelNames{"e"},
243+
Equal: []string{"e"},
244244
}
245245
rule2 := config.InhibitRule{
246246
SourceMatchers: config.Matchers{&labels.Matcher{Type: labels.MatchEqual, Name: "s2", Value: "1"}},
247247
TargetMatchers: config.Matchers{&labels.Matcher{Type: labels.MatchEqual, Name: "t2", Value: "1"}},
248-
Equal: model.LabelNames{"e"},
248+
Equal: []string{"e"},
249249
}
250250

251251
m := types.NewMarker(prometheus.NewRegistry())
@@ -374,7 +374,7 @@ func TestInhibit(t *testing.T) {
374374
return config.InhibitRule{
375375
SourceMatch: map[string]string{"s": "1"},
376376
TargetMatch: map[string]string{"t": "1"},
377-
Equal: model.LabelNames{"e"},
377+
Equal: []string{"e"},
378378
}
379379
}
380380
// alertOne is muted by alertTwo when it is active.

0 commit comments

Comments
 (0)