Skip to content

Commit fb8181c

Browse files
committed
deprecate all Openshift templates related code
Signed-off-by: Nikolaos Moraitis <nmoraiti@redhat.com>
1 parent dc5d63f commit fb8181c

64 files changed

Lines changed: 38 additions & 6841 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/ci-operator/main.go

Lines changed: 6 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,8 @@ import (
6969
imageapi "github.com/openshift/api/image/v1"
7070
projectapi "github.com/openshift/api/project/v1"
7171
routev1 "github.com/openshift/api/route/v1"
72-
templateapi "github.com/openshift/api/template/v1"
7372
buildclientset "github.com/openshift/client-go/build/clientset/versioned/typed/build/v1"
7473
projectclientset "github.com/openshift/client-go/project/clientset/versioned"
75-
templatescheme "github.com/openshift/client-go/template/clientset/versioned/scheme"
76-
templateclientset "github.com/openshift/client-go/template/clientset/versioned/typed/template/v1"
7774
hivev1 "github.com/openshift/hive/apis/hive/v1"
7875

7976
"github.com/openshift/ci-tools/pkg/api"
@@ -119,56 +116,12 @@ a consistent name for the target namespace that will change if any of the inputs
119116
This allows multiple test jobs to share common artifacts and still perform retries.
120117
121118
The standard build steps are designed for simple command-line actions (like invoking
122-
"make test") but can be extended by passing one or more templates via the --template flag.
123-
The name of the template defines the stage and the template must contain at least one
124-
pod. The parameters passed to the template are the current process environment and a set
125-
of dynamic parameters that are inferred from previous steps. These parameters are:
119+
"make test").
126120
127-
NAMESPACE
128-
The namespace generated by the operator for the given inputs or the value of
129-
--namespace.
130-
131-
IMAGE_FORMAT
132-
A string that points to the public image repository URL of the image stream(s)
133-
created by the tag step. Example:
134-
135-
registry.svc.ci.openshift.org/ci-op-9o8bacu/stable:${component}
136-
137-
Will cause the template to depend on all image builds.
138-
139-
IMAGE_<component>
140-
The public image repository URL for an output image. If specified the template
141-
will depend on the image being built.
142-
143-
LOCAL_IMAGE_<component>
144-
The public image repository URL for an image that was built during this run but
145-
was not part of the output (such as pipeline cache images). If specified the
146-
template will depend on the image being built.
147-
148-
JOB_NAME
149-
The job name from the JOB_SPEC
150-
151-
JOB_NAME_SAFE
152-
The job name in a form safe for use as a Kubernetes resource name.
153-
154-
JOB_NAME_HASH
155-
A short hash of the job name for making tasks unique. This will not account for the target-additional-suffix.
156-
157-
UNIQUE_HASH
158-
A hash for making tasks unique, even when the job name may be the same due to using the target-additional-suffix.
159-
160-
RPM_REPO_<org>_<repo>
161-
If the job creates RPMs this will be the public URL that can be used as the
162-
baseurl= value of an RPM repository. The value of org and repo are uppercased
163-
and dashes are replaced with underscores.
164-
165-
Dynamic environment variables are overridden by process environment variables.
166-
167-
Both test and template jobs can gather artifacts created by pods. Set
168-
--artifact-dir to define the top level artifact directory, and any test task
169-
that defines artifact_dir or template that has an "artifacts" volume mounted
170-
into a container will have artifacts extracted after the container has completed.
171-
Errors in artifact extraction will not cause build failures.
121+
Artifacts can be gathered from test pods. Set --artifact-dir to define the top level
122+
artifact directory, and any test task that defines artifact_dir will have artifacts
123+
extracted after the container has completed. Errors in artifact extraction will not
124+
cause build failures.
172125
173126
In CI environments the inputs to a job may be different than what a normal
174127
development workflow would use. The --override file will override fields
@@ -366,7 +319,6 @@ func (s *stringSlice) Set(value string) error {
366319
type options struct {
367320
configSpecPath string
368321
unresolvedConfigPath string
369-
templatePaths stringSlice
370322
secretDirectories stringSlice
371323
sshKeyPath string
372324
oauthTokenPath string
@@ -392,7 +344,6 @@ type options struct {
392344

393345
inputHash string
394346
secrets []*coreapi.Secret
395-
templates []*templateapi.Template
396347
graphConfig api.GraphConfiguration
397348
configSpec *api.ReleaseBuildConfiguration
398349
jobSpec *api.JobSpec
@@ -480,7 +431,6 @@ func bindOptions(flag *flag.FlagSet) *options {
480431
flag.BoolVar(&opt.printGraph, "print-graph", opt.printGraph, "Print a directed graph of the build steps and exit. Intended for use with the golang digraph utility.")
481432

482433
// add to the graph of things we run or create
483-
flag.Var(&opt.templatePaths, "template", "A set of paths to optional templates to add as stages to this job. Each template is expected to contain at least one restart=Never pod. Parameters are filled from environment or from the automatic parameters generated by the operator.")
484434
flag.Var(&opt.secretDirectories, "secret-dir", "One or more directories that should converted into secrets in the test namespace. If the directory contains a single file with name .dockercfg or config.json it becomes a pull secret.")
485435
flag.StringVar(&opt.sshKeyPath, "ssh-key-path", "", "A path of the private ssh key that is going to be used to clone a private repository.")
486436
flag.StringVar(&opt.oauthTokenPath, "oauth-token-path", "", "A path of the OAuth token that is going to be used to clone a private repository.")
@@ -683,26 +633,6 @@ func (o *options) Complete() error {
683633

684634
o.getClusterProfileNamesFromTargets()
685635

686-
for _, path := range o.templatePaths.values {
687-
contents, err := os.ReadFile(path)
688-
if err != nil {
689-
return fmt.Errorf("could not read dir %s for template: %w", path, err)
690-
}
691-
obj, gvk, err := templatescheme.Codecs.UniversalDeserializer().Decode(contents, nil, nil)
692-
if err != nil {
693-
return fmt.Errorf("unable to parse template %s: %w", path, err)
694-
}
695-
template, ok := obj.(*templateapi.Template)
696-
if !ok {
697-
return fmt.Errorf("%s is not a template: %v", path, gvk)
698-
}
699-
if len(template.Name) == 0 {
700-
template.Name = filepath.Base(path)
701-
template.Name = strings.TrimSuffix(template.Name, filepath.Ext(template.Name))
702-
}
703-
o.templates = append(o.templates, template)
704-
}
705-
706636
clusterConfig, err := util.LoadClusterConfig()
707637
if err != nil {
708638
return fmt.Errorf("failed to load cluster config: %w", err)
@@ -761,7 +691,6 @@ func (o *options) ToGraphConfig() *defaults.Config {
761691
CIConfig: o.configSpec,
762692
GraphConf: &o.graphConfig,
763693
JobSpec: o.jobSpec,
764-
Templates: o.templates,
765694
ParamFile: o.writeParams,
766695
Promote: o.promote,
767696
ClusterConfig: o.clusterConfig,
@@ -1997,13 +1926,6 @@ func (o *options) saveNamespaceArtifacts() {
19971926
_ = api.SaveArtifact(o.censor, path, data)
19981927
}
19991928

2000-
if templateClient, err := templateclientset.NewForConfig(o.clusterConfig); err == nil {
2001-
templateInstances, _ := templateClient.TemplateInstances(o.namespace).List(context.TODO(), metav1.ListOptions{})
2002-
data, _ := json.MarshalIndent(templateInstances, "", " ")
2003-
path := filepath.Join(namespaceDir, "templateinstances.json")
2004-
_ = api.SaveArtifact(o.censor, path, data)
2005-
}
2006-
20071929
o.metricsAgent.Record(metrics.NewInsightsEvent(metrics.InsightNamespaceArtifacts, metrics.Context{"namespace": o.namespace}))
20081930
}
20091931

@@ -2240,7 +2162,7 @@ func eventRecorder(kubeClient *coreclientset.CoreV1Client, authClient *authclien
22402162
eventBroadcaster.StartRecordingToSink(&coreclientset.EventSinkImpl{
22412163
Interface: coreclientset.New(kubeClient.RESTClient()).Events("")})
22422164
return eventBroadcaster.NewRecorder(
2243-
templatescheme.Scheme, coreapi.EventSource{Component: namespace}), nil
2165+
scheme.Scheme, coreapi.EventSource{Component: namespace}), nil
22442166
}
22452167

22462168
func getCloneSecretFromPath(cloneAuthType steps.CloneAuthType, secretPath string) (*coreapi.Secret, error) {
@@ -2538,9 +2460,6 @@ func addSchemes() error {
25382460
if err := buildv1.AddToScheme(scheme.Scheme); err != nil {
25392461
return fmt.Errorf("failed to add buildv1 to scheme: %w", err)
25402462
}
2541-
if err := templateapi.AddToScheme(scheme.Scheme); err != nil {
2542-
return fmt.Errorf("failed to add templatev1 to scheme: %w", err)
2543-
}
25442463
if err := hivev1.AddToScheme(scheme.Scheme); err != nil {
25452464
return fmt.Errorf("failed to add hivev1 to scheme: %w", err)
25462465
}

cmd/ci-operator/main_test.go

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -623,42 +623,6 @@ tests:
623623
verify -k
624624
container:
625625
from: bin
626-
- as: e2e-aws
627-
commands: TEST_SUITE=openshift/conformance/parallel run-tests
628-
openshift_installer:
629-
cluster_profile: aws
630-
- as: e2e-aws-all
631-
commands: TEST_SUITE=openshift/conformance run-tests
632-
openshift_installer:
633-
cluster_profile: aws
634-
- as: e2e-aws-builds
635-
commands: TEST_SUITE=openshift/build run-tests
636-
openshift_installer:
637-
cluster_profile: aws
638-
- as: e2e-aws-image-ecosystem
639-
commands: TEST_SUITE=openshift/image-ecosystem run-tests
640-
openshift_installer:
641-
cluster_profile: aws
642-
- as: e2e-aws-image-registry
643-
commands: TEST_SUITE=openshift/image-registry run-tests
644-
openshift_installer:
645-
cluster_profile: aws
646-
- as: e2e-aws-serial
647-
commands: TEST_SUITE=openshift/conformance/serial run-tests
648-
openshift_installer:
649-
cluster_profile: aws
650-
- as: launch-aws
651-
commands: sleep 7200 & wait
652-
openshift_installer:
653-
cluster_profile: aws
654-
- as: e2e-upi-aws
655-
commands: TEST_SUITE=openshift/conformance/serial run-tests
656-
openshift_installer_upi:
657-
cluster_profile: aws
658-
- as: e2e-upi-src-vsphere
659-
commands: make tests
660-
openshift_installer_upi_src:
661-
cluster_profile: vsphere-2
662626
`
663627

664628
var parsedConfig = &api.ReleaseBuildConfiguration{
@@ -848,60 +812,6 @@ var parsedConfig = &api.ReleaseBuildConfiguration{
848812
ContainerTestConfiguration: &api.ContainerTestConfiguration{
849813
From: "bin",
850814
},
851-
}, {
852-
As: "e2e-aws",
853-
Commands: `TEST_SUITE=openshift/conformance/parallel run-tests`,
854-
OpenshiftInstallerClusterTestConfiguration: &api.OpenshiftInstallerClusterTestConfiguration{
855-
ClusterTestConfiguration: api.ClusterTestConfiguration{ClusterProfile: "aws"},
856-
},
857-
}, {
858-
As: "e2e-aws-all",
859-
Commands: `TEST_SUITE=openshift/conformance run-tests`,
860-
OpenshiftInstallerClusterTestConfiguration: &api.OpenshiftInstallerClusterTestConfiguration{
861-
ClusterTestConfiguration: api.ClusterTestConfiguration{ClusterProfile: "aws"},
862-
},
863-
}, {
864-
As: "e2e-aws-builds",
865-
Commands: `TEST_SUITE=openshift/build run-tests`,
866-
OpenshiftInstallerClusterTestConfiguration: &api.OpenshiftInstallerClusterTestConfiguration{
867-
ClusterTestConfiguration: api.ClusterTestConfiguration{ClusterProfile: "aws"},
868-
},
869-
}, {
870-
As: "e2e-aws-image-ecosystem",
871-
Commands: `TEST_SUITE=openshift/image-ecosystem run-tests`,
872-
OpenshiftInstallerClusterTestConfiguration: &api.OpenshiftInstallerClusterTestConfiguration{
873-
ClusterTestConfiguration: api.ClusterTestConfiguration{ClusterProfile: "aws"},
874-
},
875-
}, {
876-
As: "e2e-aws-image-registry",
877-
Commands: `TEST_SUITE=openshift/image-registry run-tests`,
878-
OpenshiftInstallerClusterTestConfiguration: &api.OpenshiftInstallerClusterTestConfiguration{
879-
ClusterTestConfiguration: api.ClusterTestConfiguration{ClusterProfile: "aws"},
880-
},
881-
}, {
882-
As: "e2e-aws-serial",
883-
Commands: `TEST_SUITE=openshift/conformance/serial run-tests`,
884-
OpenshiftInstallerClusterTestConfiguration: &api.OpenshiftInstallerClusterTestConfiguration{
885-
ClusterTestConfiguration: api.ClusterTestConfiguration{ClusterProfile: "aws"},
886-
},
887-
}, {
888-
As: "launch-aws",
889-
Commands: `sleep 7200 & wait`,
890-
OpenshiftInstallerClusterTestConfiguration: &api.OpenshiftInstallerClusterTestConfiguration{
891-
ClusterTestConfiguration: api.ClusterTestConfiguration{ClusterProfile: "aws"},
892-
},
893-
}, {
894-
As: "e2e-upi-aws",
895-
Commands: `TEST_SUITE=openshift/conformance/serial run-tests`,
896-
OpenshiftInstallerUPIClusterTestConfiguration: &api.OpenshiftInstallerUPIClusterTestConfiguration{
897-
ClusterTestConfiguration: api.ClusterTestConfiguration{ClusterProfile: "aws"},
898-
},
899-
}, {
900-
As: "e2e-upi-src-vsphere",
901-
Commands: `make tests`,
902-
OpenshiftInstallerUPISrcClusterTestConfiguration: &api.OpenshiftInstallerUPISrcClusterTestConfiguration{
903-
ClusterTestConfiguration: api.ClusterTestConfiguration{ClusterProfile: "vsphere-2"},
904-
},
905815
}},
906816
}
907817

0 commit comments

Comments
 (0)