Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions pkg/clusterinit/onboard/prowjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
utilpointer "k8s.io/utils/pointer"
prowapi "sigs.k8s.io/prow/pkg/apis/prowjobs/v1"
prowconfig "sigs.k8s.io/prow/pkg/config"
"sigs.k8s.io/prow/pkg/config/secret"
"sigs.k8s.io/prow/pkg/github"

"github.com/openshift/ci-tools/pkg/api"
"github.com/openshift/ci-tools/pkg/clusterinit/clusterinstall"
Expand All @@ -35,16 +37,24 @@ func (s *prowJobStep) Name() string { return "prow-jobs" }
func (s *prowJobStep) Run(ctx context.Context) error {
s.log = s.log.WithField("step", "jobs")
s.log.Infof("generating: presubmits, postsubmits, and periodics for %s", s.clusterInstall.ClusterName)

gc, _ := github.NewDryRunClient(func() []byte { return []byte("") }, secret.Censor, github.DefaultGraphQLEndpoint, github.DefaultAPIEndpoint)
repo, err := gc.GetRepo("openshift", "release")
if err != nil {
s.log.WithError(err).Fatalf("Error retrieving repository data: %v", err)
}
metadata := RepoMetadata()
metadata.Branch = repo.DefaultBranch

config := prowconfig.JobConfig{
PresubmitsStatic: map[string][]prowconfig.Presubmit{
"openshift/release": {s.generatePresubmit(s.clusterInstall.ClusterName, *s.clusterInstall.Onboard.OSD, *s.clusterInstall.Onboard.Unmanaged)},
"openshift/release": {s.generatePresubmit(metadata, s.clusterInstall.ClusterName, *s.clusterInstall.Onboard.OSD, *s.clusterInstall.Onboard.Unmanaged)},
},
PostsubmitsStatic: map[string][]prowconfig.Postsubmit{
"openshift/release": {s.generatePostsubmit(s.clusterInstall.ClusterName, *s.clusterInstall.Onboard.OSD, *s.clusterInstall.Onboard.Unmanaged)},
"openshift/release": {s.generatePostsubmit(metadata, s.clusterInstall.ClusterName, *s.clusterInstall.Onboard.OSD, *s.clusterInstall.Onboard.Unmanaged)},
},
Periodics: []prowconfig.Periodic{s.generatePeriodic(s.clusterInstall.ClusterName, *s.clusterInstall.Onboard.OSD, *s.clusterInstall.Onboard.Unmanaged)},
Periodics: []prowconfig.Periodic{s.generatePeriodic(metadata, s.clusterInstall.ClusterName, *s.clusterInstall.Onboard.OSD, *s.clusterInstall.Onboard.Unmanaged)},
}
metadata := RepoMetadata()
jobsDir := filepath.Join(s.clusterInstall.Onboard.ReleaseRepo, "ci-operator", "jobs")
return jobconfig.WriteToDir(jobsDir,
metadata.Org,
Expand All @@ -54,10 +64,10 @@ func (s *prowJobStep) Run(ctx context.Context) error {
map[string]string{jobconfig.LabelBuildFarm: s.clusterInstall.ClusterName})
}

func (s *prowJobStep) generatePeriodic(clusterName string, osd bool, unmanaged bool) prowconfig.Periodic {
func (s *prowJobStep) generatePeriodic(metadata *api.Metadata, clusterName string, osd bool, unmanaged bool) prowconfig.Periodic {
return prowconfig.Periodic{
JobBase: prowconfig.JobBase{
Name: RepoMetadata().SimpleJobName(jobconfig.PeriodicPrefix, clusterName+"-apply"),
Name: metadata.SimpleJobName(jobconfig.PeriodicPrefix, clusterName+"-apply"),
Agent: string(prowapi.KubernetesAgent),
Cluster: string(api.ClusterAPPCI),
SourcePath: "",
Expand Down Expand Up @@ -88,10 +98,10 @@ func (s *prowJobStep) generatePeriodic(clusterName string, osd bool, unmanaged b
}
}

func (s *prowJobStep) generatePostsubmit(clusterName string, osd bool, unmanaged bool) prowconfig.Postsubmit {
func (s *prowJobStep) generatePostsubmit(metadata *api.Metadata, clusterName string, osd bool, unmanaged bool) prowconfig.Postsubmit {
return prowconfig.Postsubmit{
JobBase: prowconfig.JobBase{
Name: RepoMetadata().JobName(jobconfig.PostsubmitPrefix, clusterName+"-apply"),
Name: metadata.JobName(jobconfig.PostsubmitPrefix, clusterName+"-apply"),
Agent: string(prowapi.KubernetesAgent),
Cluster: string(api.ClusterAPPCI),
SourcePath: "",
Expand All @@ -116,14 +126,14 @@ func (s *prowJobStep) generatePostsubmit(clusterName string, osd bool, unmanaged
}
}

func (s *prowJobStep) generatePresubmit(clusterName string, osd bool, unmanaged bool) prowconfig.Presubmit {
func (s *prowJobStep) generatePresubmit(metadata *api.Metadata, clusterName string, osd bool, unmanaged bool) prowconfig.Presubmit {
var optional bool
if clusterName == string(api.ClusterVSphere02) {
optional = true
}
return prowconfig.Presubmit{
JobBase: prowconfig.JobBase{
Name: RepoMetadata().JobName(jobconfig.PresubmitPrefix, clusterName+"-dry"),
Name: metadata.JobName(jobconfig.PresubmitPrefix, clusterName+"-dry"),
Agent: string(prowapi.KubernetesAgent),
Cluster: string(api.ClusterAPPCI),
SourcePath: "",
Expand Down
18 changes: 9 additions & 9 deletions pkg/clusterinit/onboard/sanitizeprowjob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ func TestUpdateConfig(t *testing.T) {
Groups: dispatcher.JobGroups{
api.ClusterAPPCI: dispatcher.Group{
Jobs: []string{
"pull-ci-openshift-release-master-build01-dry",
"branch-ci-openshift-release-master-build01-apply",
"periodic-openshift-release-master-build01-apply"}}},
"pull-ci-openshift-release-main-build01-dry",
"branch-ci-openshift-release-main-build01-apply",
"periodic-openshift-release-main-build01-apply"}}},
},
expected: dispatcher.Config{
Groups: dispatcher.JobGroups{
api.ClusterAPPCI: dispatcher.Group{
Jobs: []string{
"branch-ci-openshift-release-master-build01-apply",
"branch-ci-openshift-release-master-newcluster-apply",
"periodic-openshift-release-master-build01-apply",
"periodic-openshift-release-master-newcluster-apply",
"pull-ci-openshift-release-master-build01-dry",
"pull-ci-openshift-release-master-newcluster-dry"}}},
"branch-ci-openshift-release-main-build01-apply",
"branch-ci-openshift-release-main-newcluster-apply",
"periodic-openshift-release-main-build01-apply",
"periodic-openshift-release-main-newcluster-apply",
"pull-ci-openshift-release-main-build01-dry",
"pull-ci-openshift-release-main-newcluster-dry"}}},
},
},
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/clusterinit/onboard/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ const (
ClusterDisplay = "cluster-display"
ConfigUpdater = "config-updater"
GithubLdapUserGroupCreator = "github-ldap-user-group-creator"
Master = "master"
Main = "main"
PodScaler = "pod-scaler"
PromotedImageGovernor = "promoted-image-governor"
dexManifests = "clusters/app.ci/dex/manifests.yaml"
CISchedulingWebhookCommonRelativePath = "../../common_ci_scheduling_webhook"

warningHeader = `# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand All @@ -51,7 +51,7 @@ func RepoMetadata() *api.Metadata {
return &api.Metadata{
Org: "openshift",
Repo: "release",
Branch: "master",
Branch: "main",
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !!! WARNING - DO NOT MODIFY !!!
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/master/cmd/cluster-init
# Generated by cluster-init: https://github.com/openshift/ci-tools/tree/main/cmd/cluster-init
# Modifying this file manually might break some tests in both openshift/ci-tools and openshift/release repositories.
# Please consider, instead, writing a yaml patch in one of the cluster-install.yaml into clusters/_cluster-install/
# or, alternatively, modifying the cluster-init tool itself.
Expand Down
Loading