forked from tektoncd/catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Fixes tektoncd#481) prevent e2e-test script from overriding task sid…
…ecar The end to end test attaches a sidecar with a image registry for tasks to push into to. This task is optional and is encouraged to be used for testing. However, the function add_sidecar_registry sets the sidecar registry instead of appending it. Allowing the sidecar-registry to run alongside with other tasks will fix this bug. tektoncd#481
- Loading branch information
Showing
3 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import sys | ||
import yaml | ||
|
||
def add_sidecar_to_yaml_file(): | ||
with sys.stdin as file: | ||
# Load yaml file passed by stdin | ||
data = yaml.load(file, Loader=yaml.FullLoader) | ||
# If sidecars doesnt have any entries create an array for data manipulation | ||
if 'sidecars' not in data['spec']: | ||
data['spec']['sidecars'] = [] | ||
# Append the local image registry to the yaml file | ||
data['spec']['sidecars'].append({"image": "registry", "name": "registry"}) | ||
# Dump the changes to the stdout | ||
print(yaml.dump(data, default_flow_style=False)) | ||
|
||
if __name__ == '__main__': | ||
globals()[sys.argv[1]]() |