Skip to content

Commit

Permalink
Generate authentikos and genjobs image push jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Clarke committed Dec 11, 2019
1 parent b9506f9 commit 841c88d
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 4 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions prow/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"os"
"path"
"strings"
"testing"

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

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

// Presubmits may not use trusted clusters.
for _, pre := range c.AllStaticPresubmits(nil) {
Expand All @@ -348,7 +349,7 @@ func TestTrustedJobs(t *testing.T) {
if post.Cluster != trusted {
continue
}
if post.SourcePath != trustedPath {
if !strings.HasPrefix(post.SourcePath, trustedPath) {
t.Errorf("%s defined in %s may not run in trusted cluster", post.Name, post.SourcePath)
}
}
Expand All @@ -358,7 +359,7 @@ func TestTrustedJobs(t *testing.T) {
if per.Cluster != trusted {
continue
}
if per.SourcePath != trustedPath {
if !strings.HasPrefix(per.SourcePath, trustedPath) {
t.Errorf("%s defined in %s may not run in trusted cluster", per.Name, per.SourcePath)
}
}
Expand Down
8 changes: 7 additions & 1 deletion prow/config/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ type Job struct {
Repos []string `json:"repos,omitempty"`
Image string `json:"image,omitempty"`
Regex string `json:"regex,omitempty"`
Cluster string `json:"cluster,omitempty"`
MaxConcurrency int `json:"max_concurrency,omitempty"`
}

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

func createJobBase(jobConfig JobConfig, job Job, name string, repo string, branch string, resources map[string]v1.ResourceRequirements) config.JobBase {
jb := config.JobBase{
Name: name,
Name: name,
MaxConcurrency: job.MaxConcurrency,
Spec: &v1.PodSpec{
NodeSelector: map[string]string{"testing": "test-pool"},
Containers: createContainer(jobConfig, job, resources),
Expand All @@ -434,6 +437,9 @@ func createJobBase(jobConfig JobConfig, job Job, name string, repo string, branc
Timeout: job.Timeout,
}
}
if job.Cluster != "" && job.Cluster != "default" {
jb.Cluster = job.Cluster
}
return jb
}

Expand Down
28 changes: 28 additions & 0 deletions prow/config/jobs/test-infra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,31 @@ jobs:

- name: gencheck
command: [make, gen-check]

- name: push-authentikos
type: postsubmit
regex: '^authentikos/Makefile$'
cluster: test-infra-trusted
max_concurrency: 1
command:
- entrypoint
- make
- -C
- authentios
- deploy
requirements:
- docker

- name: push-genjobs
type: postsubmit
regex: '^prow/genjobs/Makefile$'
cluster: test-infra-trusted
max_concurrency: 1
command:
- entrypoint
- make
- -C
- prow/genjobs
- deploy
requirements:
- docker

0 comments on commit 841c88d

Please sign in to comment.