This repository was archived by the owner on Jun 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Implement a Golang cluster installer job that hides the template #288
Merged
openshift-merge-robot
merged 2 commits into
openshift:master
from
smarterclayton:upgrade_initial
Mar 9, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import ( | |
| "errors" | ||
| "flag" | ||
| "fmt" | ||
| "io" | ||
| "io/ioutil" | ||
| "log" | ||
| "os" | ||
|
|
@@ -182,6 +183,7 @@ type options struct { | |
| verbose bool | ||
| help bool | ||
| dry bool | ||
| print bool | ||
|
|
||
| writeParams string | ||
| artifactDir string | ||
|
|
@@ -219,6 +221,7 @@ func bindOptions(flag *flag.FlagSet) *options { | |
| flag.StringVar(&opt.configSpecPath, "config", "", "The configuration file. If not specified the CONFIG_SPEC environment variable will be used.") | ||
| flag.Var(&opt.targets, "target", "One or more targets in the configuration to build. Only steps that are required for this target will be run.") | ||
| flag.BoolVar(&opt.dry, "dry-run", opt.dry, "Print the steps that would be run and the objects that would be created without executing any steps") | ||
| flag.BoolVar(&opt.print, "print-graph", opt.print, "Print a directed graph of the build steps and exit. Intended for use with the golang digraph utility.") | ||
|
|
||
| // add to the graph of things we run or create | ||
| 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.") | ||
|
|
@@ -399,6 +402,13 @@ func (o *options) Run() error { | |
| return fmt.Errorf("unable to write metadata.json for build: %v", err) | ||
| } | ||
|
|
||
| if o.print { | ||
| if err := printDigraph(os.Stdout, buildSteps); err != nil { | ||
| return fmt.Errorf("could not print graph: %v", err) | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| // convert the full graph into the subset we must run | ||
| nodes, err := api.BuildPartialGraph(buildSteps, o.targets.values) | ||
| if err != nil { | ||
|
|
@@ -665,9 +675,6 @@ func (o *options) initializeNamespace() error { | |
| }) | ||
| } | ||
|
|
||
| if len(o.secrets) > 0 { | ||
| log.Printf("Populating secrets for test") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not actually useful, was just noise. We already print when we populate a secret. |
||
| } | ||
| for _, secret := range o.secrets { | ||
| _, err := client.Secrets(o.namespace).Create(secret) | ||
| if kerrors.IsAlreadyExists(err) { | ||
|
|
@@ -922,6 +929,22 @@ func topologicalSort(nodes []*api.StepNode) ([]*api.StepNode, error) { | |
| return sortedNodes, nil | ||
| } | ||
|
|
||
| func printDigraph(w io.Writer, steps []api.Step) error { | ||
| for _, step := range steps { | ||
| for _, other := range steps { | ||
| if step == other { | ||
| continue | ||
| } | ||
| if api.HasAnyLinks(step.Requires(), other.Creates()) { | ||
| if _, err := fmt.Fprintf(w, "%s %s\n", step.Name(), other.Name()); err != nil { | ||
| return err | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| func printExecutionOrder(nodes []*api.StepNode) error { | ||
| ordered, err := topologicalSort(nodes) | ||
| if err != nil { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We removed this months ago.