Skip to content

Commit 841c88d

Browse files
author
Travis Clarke
committed
Generate authentikos and genjobs image push jobs
1 parent b9506f9 commit 841c88d

File tree

4 files changed

+117
-4
lines changed

4 files changed

+117
-4
lines changed

prow/cluster/jobs/istio/test-infra/istio.test-infra.master.gen.yaml

Lines changed: 78 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

prow/config/config_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"fmt"
2020
"os"
2121
"path"
22+
"strings"
2223
"testing"
2324

2425
"k8s.io/apimachinery/pkg/util/sets"
@@ -334,7 +335,7 @@ func TestConfig(t *testing.T) {
334335

335336
func TestTrustedJobs(t *testing.T) {
336337
const trusted = "test-infra-trusted"
337-
trustedPath := path.Join(*jobConfigPath, "istio", "test-infra", "istio.test-infra.trusted.master.yaml")
338+
trustedPath := path.Join(*jobConfigPath, "istio", "test-infra")
338339

339340
// Presubmits may not use trusted clusters.
340341
for _, pre := range c.AllStaticPresubmits(nil) {
@@ -348,7 +349,7 @@ func TestTrustedJobs(t *testing.T) {
348349
if post.Cluster != trusted {
349350
continue
350351
}
351-
if post.SourcePath != trustedPath {
352+
if !strings.HasPrefix(post.SourcePath, trustedPath) {
352353
t.Errorf("%s defined in %s may not run in trusted cluster", post.Name, post.SourcePath)
353354
}
354355
}
@@ -358,7 +359,7 @@ func TestTrustedJobs(t *testing.T) {
358359
if per.Cluster != trusted {
359360
continue
360361
}
361-
if per.SourcePath != trustedPath {
362+
if !strings.HasPrefix(per.SourcePath, trustedPath) {
362363
t.Errorf("%s defined in %s may not run in trusted cluster", per.Name, per.SourcePath)
363364
}
364365
}

prow/config/generate.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ type Job struct {
9191
Repos []string `json:"repos,omitempty"`
9292
Image string `json:"image,omitempty"`
9393
Regex string `json:"regex,omitempty"`
94+
Cluster string `json:"cluster,omitempty"`
95+
MaxConcurrency int `json:"max_concurrency,omitempty"`
9496
}
9597

9698
// Reads the job yaml
@@ -413,7 +415,8 @@ func createContainer(jobConfig JobConfig, job Job, resources map[string]v1.Resou
413415

414416
func createJobBase(jobConfig JobConfig, job Job, name string, repo string, branch string, resources map[string]v1.ResourceRequirements) config.JobBase {
415417
jb := config.JobBase{
416-
Name: name,
418+
Name: name,
419+
MaxConcurrency: job.MaxConcurrency,
417420
Spec: &v1.PodSpec{
418421
NodeSelector: map[string]string{"testing": "test-pool"},
419422
Containers: createContainer(jobConfig, job, resources),
@@ -434,6 +437,9 @@ func createJobBase(jobConfig JobConfig, job Job, name string, repo string, branc
434437
Timeout: job.Timeout,
435438
}
436439
}
440+
if job.Cluster != "" && job.Cluster != "default" {
441+
jb.Cluster = job.Cluster
442+
}
437443
return jb
438444
}
439445

prow/config/jobs/test-infra.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,31 @@ jobs:
1111

1212
- name: gencheck
1313
command: [make, gen-check]
14+
15+
- name: push-authentikos
16+
type: postsubmit
17+
regex: '^authentikos/Makefile$'
18+
cluster: test-infra-trusted
19+
max_concurrency: 1
20+
command:
21+
- entrypoint
22+
- make
23+
- -C
24+
- authentios
25+
- deploy
26+
requirements:
27+
- docker
28+
29+
- name: push-genjobs
30+
type: postsubmit
31+
regex: '^prow/genjobs/Makefile$'
32+
cluster: test-infra-trusted
33+
max_concurrency: 1
34+
command:
35+
- entrypoint
36+
- make
37+
- -C
38+
- prow/genjobs
39+
- deploy
40+
requirements:
41+
- docker

0 commit comments

Comments
 (0)