... | ... |
@@ -12740,6 +12740,88 @@ _oc_set_build-hook() |
12740 | 12740 |
noun_aliases=() |
12741 | 12741 |
} |
12742 | 12742 |
|
12743 |
+_oc_set_build-secret() |
|
12744 |
+{ |
|
12745 |
+ last_command="oc_set_build-secret" |
|
12746 |
+ commands=() |
|
12747 |
+ |
|
12748 |
+ flags=() |
|
12749 |
+ two_word_flags=() |
|
12750 |
+ local_nonpersistent_flags=() |
|
12751 |
+ flags_with_completion=() |
|
12752 |
+ flags_completion=() |
|
12753 |
+ |
|
12754 |
+ flags+=("--all") |
|
12755 |
+ local_nonpersistent_flags+=("--all") |
|
12756 |
+ flags+=("--filename=") |
|
12757 |
+ flags_with_completion+=("--filename") |
|
12758 |
+ flags_completion+=("__handle_filename_extension_flag yaml|yml|json") |
|
12759 |
+ two_word_flags+=("-f") |
|
12760 |
+ flags_with_completion+=("-f") |
|
12761 |
+ flags_completion+=("__handle_filename_extension_flag yaml|yml|json") |
|
12762 |
+ local_nonpersistent_flags+=("--filename=") |
|
12763 |
+ flags+=("--local") |
|
12764 |
+ local_nonpersistent_flags+=("--local") |
|
12765 |
+ flags+=("--no-headers") |
|
12766 |
+ local_nonpersistent_flags+=("--no-headers") |
|
12767 |
+ flags+=("--output=") |
|
12768 |
+ two_word_flags+=("-o") |
|
12769 |
+ local_nonpersistent_flags+=("--output=") |
|
12770 |
+ flags+=("--output-version=") |
|
12771 |
+ local_nonpersistent_flags+=("--output-version=") |
|
12772 |
+ flags+=("--pull") |
|
12773 |
+ local_nonpersistent_flags+=("--pull") |
|
12774 |
+ flags+=("--push") |
|
12775 |
+ local_nonpersistent_flags+=("--push") |
|
12776 |
+ flags+=("--remove") |
|
12777 |
+ local_nonpersistent_flags+=("--remove") |
|
12778 |
+ flags+=("--selector=") |
|
12779 |
+ two_word_flags+=("-l") |
|
12780 |
+ local_nonpersistent_flags+=("--selector=") |
|
12781 |
+ flags+=("--show-all") |
|
12782 |
+ flags+=("-a") |
|
12783 |
+ local_nonpersistent_flags+=("--show-all") |
|
12784 |
+ flags+=("--show-labels") |
|
12785 |
+ local_nonpersistent_flags+=("--show-labels") |
|
12786 |
+ flags+=("--sort-by=") |
|
12787 |
+ local_nonpersistent_flags+=("--sort-by=") |
|
12788 |
+ flags+=("--source") |
|
12789 |
+ local_nonpersistent_flags+=("--source") |
|
12790 |
+ flags+=("--template=") |
|
12791 |
+ flags_with_completion+=("--template") |
|
12792 |
+ flags_completion+=("_filedir") |
|
12793 |
+ local_nonpersistent_flags+=("--template=") |
|
12794 |
+ flags+=("--as=") |
|
12795 |
+ flags+=("--certificate-authority=") |
|
12796 |
+ flags_with_completion+=("--certificate-authority") |
|
12797 |
+ flags_completion+=("_filedir") |
|
12798 |
+ flags+=("--client-certificate=") |
|
12799 |
+ flags_with_completion+=("--client-certificate") |
|
12800 |
+ flags_completion+=("_filedir") |
|
12801 |
+ flags+=("--client-key=") |
|
12802 |
+ flags_with_completion+=("--client-key") |
|
12803 |
+ flags_completion+=("_filedir") |
|
12804 |
+ flags+=("--cluster=") |
|
12805 |
+ flags+=("--config=") |
|
12806 |
+ flags_with_completion+=("--config") |
|
12807 |
+ flags_completion+=("_filedir") |
|
12808 |
+ flags+=("--context=") |
|
12809 |
+ flags+=("--insecure-skip-tls-verify") |
|
12810 |
+ flags+=("--log-flush-frequency=") |
|
12811 |
+ flags+=("--loglevel=") |
|
12812 |
+ flags+=("--logspec=") |
|
12813 |
+ flags+=("--match-server-version") |
|
12814 |
+ flags+=("--namespace=") |
|
12815 |
+ two_word_flags+=("-n") |
|
12816 |
+ flags+=("--server=") |
|
12817 |
+ flags+=("--token=") |
|
12818 |
+ flags+=("--user=") |
|
12819 |
+ |
|
12820 |
+ must_have_one_flag=() |
|
12821 |
+ must_have_one_noun=() |
|
12822 |
+ noun_aliases=() |
|
12823 |
+} |
|
12824 |
+ |
|
12743 | 12825 |
_oc_set_deployment-hook() |
12744 | 12826 |
{ |
12745 | 12827 |
last_command="oc_set_deployment-hook" |
... | ... |
@@ -13352,6 +13434,7 @@ _oc_set() |
13352 | 13352 |
last_command="oc_set" |
13353 | 13353 |
commands=() |
13354 | 13354 |
commands+=("build-hook") |
13355 |
+ commands+=("build-secret") |
|
13355 | 13356 |
commands+=("deployment-hook") |
13356 | 13357 |
commands+=("env") |
13357 | 13358 |
commands+=("image") |
... | ... |
@@ -17322,6 +17322,89 @@ _openshift_cli_set_build-hook() |
17322 | 17322 |
noun_aliases=() |
17323 | 17323 |
} |
17324 | 17324 |
|
17325 |
+_openshift_cli_set_build-secret() |
|
17326 |
+{ |
|
17327 |
+ last_command="openshift_cli_set_build-secret" |
|
17328 |
+ commands=() |
|
17329 |
+ |
|
17330 |
+ flags=() |
|
17331 |
+ two_word_flags=() |
|
17332 |
+ local_nonpersistent_flags=() |
|
17333 |
+ flags_with_completion=() |
|
17334 |
+ flags_completion=() |
|
17335 |
+ |
|
17336 |
+ flags+=("--all") |
|
17337 |
+ local_nonpersistent_flags+=("--all") |
|
17338 |
+ flags+=("--filename=") |
|
17339 |
+ flags_with_completion+=("--filename") |
|
17340 |
+ flags_completion+=("__handle_filename_extension_flag yaml|yml|json") |
|
17341 |
+ two_word_flags+=("-f") |
|
17342 |
+ flags_with_completion+=("-f") |
|
17343 |
+ flags_completion+=("__handle_filename_extension_flag yaml|yml|json") |
|
17344 |
+ local_nonpersistent_flags+=("--filename=") |
|
17345 |
+ flags+=("--local") |
|
17346 |
+ local_nonpersistent_flags+=("--local") |
|
17347 |
+ flags+=("--no-headers") |
|
17348 |
+ local_nonpersistent_flags+=("--no-headers") |
|
17349 |
+ flags+=("--output=") |
|
17350 |
+ two_word_flags+=("-o") |
|
17351 |
+ local_nonpersistent_flags+=("--output=") |
|
17352 |
+ flags+=("--output-version=") |
|
17353 |
+ local_nonpersistent_flags+=("--output-version=") |
|
17354 |
+ flags+=("--pull") |
|
17355 |
+ local_nonpersistent_flags+=("--pull") |
|
17356 |
+ flags+=("--push") |
|
17357 |
+ local_nonpersistent_flags+=("--push") |
|
17358 |
+ flags+=("--remove") |
|
17359 |
+ local_nonpersistent_flags+=("--remove") |
|
17360 |
+ flags+=("--selector=") |
|
17361 |
+ two_word_flags+=("-l") |
|
17362 |
+ local_nonpersistent_flags+=("--selector=") |
|
17363 |
+ flags+=("--show-all") |
|
17364 |
+ flags+=("-a") |
|
17365 |
+ local_nonpersistent_flags+=("--show-all") |
|
17366 |
+ flags+=("--show-labels") |
|
17367 |
+ local_nonpersistent_flags+=("--show-labels") |
|
17368 |
+ flags+=("--sort-by=") |
|
17369 |
+ local_nonpersistent_flags+=("--sort-by=") |
|
17370 |
+ flags+=("--source") |
|
17371 |
+ local_nonpersistent_flags+=("--source") |
|
17372 |
+ flags+=("--template=") |
|
17373 |
+ flags_with_completion+=("--template") |
|
17374 |
+ flags_completion+=("_filedir") |
|
17375 |
+ local_nonpersistent_flags+=("--template=") |
|
17376 |
+ flags+=("--as=") |
|
17377 |
+ flags+=("--certificate-authority=") |
|
17378 |
+ flags_with_completion+=("--certificate-authority") |
|
17379 |
+ flags_completion+=("_filedir") |
|
17380 |
+ flags+=("--client-certificate=") |
|
17381 |
+ flags_with_completion+=("--client-certificate") |
|
17382 |
+ flags_completion+=("_filedir") |
|
17383 |
+ flags+=("--client-key=") |
|
17384 |
+ flags_with_completion+=("--client-key") |
|
17385 |
+ flags_completion+=("_filedir") |
|
17386 |
+ flags+=("--cluster=") |
|
17387 |
+ flags+=("--config=") |
|
17388 |
+ flags_with_completion+=("--config") |
|
17389 |
+ flags_completion+=("_filedir") |
|
17390 |
+ flags+=("--context=") |
|
17391 |
+ flags+=("--google-json-key=") |
|
17392 |
+ flags+=("--insecure-skip-tls-verify") |
|
17393 |
+ flags+=("--log-flush-frequency=") |
|
17394 |
+ flags+=("--loglevel=") |
|
17395 |
+ flags+=("--logspec=") |
|
17396 |
+ flags+=("--match-server-version") |
|
17397 |
+ flags+=("--namespace=") |
|
17398 |
+ two_word_flags+=("-n") |
|
17399 |
+ flags+=("--server=") |
|
17400 |
+ flags+=("--token=") |
|
17401 |
+ flags+=("--user=") |
|
17402 |
+ |
|
17403 |
+ must_have_one_flag=() |
|
17404 |
+ must_have_one_noun=() |
|
17405 |
+ noun_aliases=() |
|
17406 |
+} |
|
17407 |
+ |
|
17325 | 17408 |
_openshift_cli_set_deployment-hook() |
17326 | 17409 |
{ |
17327 | 17410 |
last_command="openshift_cli_set_deployment-hook" |
... | ... |
@@ -17941,6 +18024,7 @@ _openshift_cli_set() |
17941 | 17941 |
last_command="openshift_cli_set" |
17942 | 17942 |
commands=() |
17943 | 17943 |
commands+=("build-hook") |
17944 |
+ commands+=("build-secret") |
|
17944 | 17945 |
commands+=("deployment-hook") |
17945 | 17946 |
commands+=("env") |
17946 | 17947 |
commands+=("image") |
... | ... |
@@ -12901,6 +12901,88 @@ _oc_set_build-hook() |
12901 | 12901 |
noun_aliases=() |
12902 | 12902 |
} |
12903 | 12903 |
|
12904 |
+_oc_set_build-secret() |
|
12905 |
+{ |
|
12906 |
+ last_command="oc_set_build-secret" |
|
12907 |
+ commands=() |
|
12908 |
+ |
|
12909 |
+ flags=() |
|
12910 |
+ two_word_flags=() |
|
12911 |
+ local_nonpersistent_flags=() |
|
12912 |
+ flags_with_completion=() |
|
12913 |
+ flags_completion=() |
|
12914 |
+ |
|
12915 |
+ flags+=("--all") |
|
12916 |
+ local_nonpersistent_flags+=("--all") |
|
12917 |
+ flags+=("--filename=") |
|
12918 |
+ flags_with_completion+=("--filename") |
|
12919 |
+ flags_completion+=("__handle_filename_extension_flag yaml|yml|json") |
|
12920 |
+ two_word_flags+=("-f") |
|
12921 |
+ flags_with_completion+=("-f") |
|
12922 |
+ flags_completion+=("__handle_filename_extension_flag yaml|yml|json") |
|
12923 |
+ local_nonpersistent_flags+=("--filename=") |
|
12924 |
+ flags+=("--local") |
|
12925 |
+ local_nonpersistent_flags+=("--local") |
|
12926 |
+ flags+=("--no-headers") |
|
12927 |
+ local_nonpersistent_flags+=("--no-headers") |
|
12928 |
+ flags+=("--output=") |
|
12929 |
+ two_word_flags+=("-o") |
|
12930 |
+ local_nonpersistent_flags+=("--output=") |
|
12931 |
+ flags+=("--output-version=") |
|
12932 |
+ local_nonpersistent_flags+=("--output-version=") |
|
12933 |
+ flags+=("--pull") |
|
12934 |
+ local_nonpersistent_flags+=("--pull") |
|
12935 |
+ flags+=("--push") |
|
12936 |
+ local_nonpersistent_flags+=("--push") |
|
12937 |
+ flags+=("--remove") |
|
12938 |
+ local_nonpersistent_flags+=("--remove") |
|
12939 |
+ flags+=("--selector=") |
|
12940 |
+ two_word_flags+=("-l") |
|
12941 |
+ local_nonpersistent_flags+=("--selector=") |
|
12942 |
+ flags+=("--show-all") |
|
12943 |
+ flags+=("-a") |
|
12944 |
+ local_nonpersistent_flags+=("--show-all") |
|
12945 |
+ flags+=("--show-labels") |
|
12946 |
+ local_nonpersistent_flags+=("--show-labels") |
|
12947 |
+ flags+=("--sort-by=") |
|
12948 |
+ local_nonpersistent_flags+=("--sort-by=") |
|
12949 |
+ flags+=("--source") |
|
12950 |
+ local_nonpersistent_flags+=("--source") |
|
12951 |
+ flags+=("--template=") |
|
12952 |
+ flags_with_completion+=("--template") |
|
12953 |
+ flags_completion+=("_filedir") |
|
12954 |
+ local_nonpersistent_flags+=("--template=") |
|
12955 |
+ flags+=("--as=") |
|
12956 |
+ flags+=("--certificate-authority=") |
|
12957 |
+ flags_with_completion+=("--certificate-authority") |
|
12958 |
+ flags_completion+=("_filedir") |
|
12959 |
+ flags+=("--client-certificate=") |
|
12960 |
+ flags_with_completion+=("--client-certificate") |
|
12961 |
+ flags_completion+=("_filedir") |
|
12962 |
+ flags+=("--client-key=") |
|
12963 |
+ flags_with_completion+=("--client-key") |
|
12964 |
+ flags_completion+=("_filedir") |
|
12965 |
+ flags+=("--cluster=") |
|
12966 |
+ flags+=("--config=") |
|
12967 |
+ flags_with_completion+=("--config") |
|
12968 |
+ flags_completion+=("_filedir") |
|
12969 |
+ flags+=("--context=") |
|
12970 |
+ flags+=("--insecure-skip-tls-verify") |
|
12971 |
+ flags+=("--log-flush-frequency=") |
|
12972 |
+ flags+=("--loglevel=") |
|
12973 |
+ flags+=("--logspec=") |
|
12974 |
+ flags+=("--match-server-version") |
|
12975 |
+ flags+=("--namespace=") |
|
12976 |
+ two_word_flags+=("-n") |
|
12977 |
+ flags+=("--server=") |
|
12978 |
+ flags+=("--token=") |
|
12979 |
+ flags+=("--user=") |
|
12980 |
+ |
|
12981 |
+ must_have_one_flag=() |
|
12982 |
+ must_have_one_noun=() |
|
12983 |
+ noun_aliases=() |
|
12984 |
+} |
|
12985 |
+ |
|
12904 | 12986 |
_oc_set_deployment-hook() |
12905 | 12987 |
{ |
12906 | 12988 |
last_command="oc_set_deployment-hook" |
... | ... |
@@ -13513,6 +13595,7 @@ _oc_set() |
13513 | 13513 |
last_command="oc_set" |
13514 | 13514 |
commands=() |
13515 | 13515 |
commands+=("build-hook") |
13516 |
+ commands+=("build-secret") |
|
13516 | 13517 |
commands+=("deployment-hook") |
13517 | 13518 |
commands+=("env") |
13518 | 13519 |
commands+=("image") |
... | ... |
@@ -17483,6 +17483,89 @@ _openshift_cli_set_build-hook() |
17483 | 17483 |
noun_aliases=() |
17484 | 17484 |
} |
17485 | 17485 |
|
17486 |
+_openshift_cli_set_build-secret() |
|
17487 |
+{ |
|
17488 |
+ last_command="openshift_cli_set_build-secret" |
|
17489 |
+ commands=() |
|
17490 |
+ |
|
17491 |
+ flags=() |
|
17492 |
+ two_word_flags=() |
|
17493 |
+ local_nonpersistent_flags=() |
|
17494 |
+ flags_with_completion=() |
|
17495 |
+ flags_completion=() |
|
17496 |
+ |
|
17497 |
+ flags+=("--all") |
|
17498 |
+ local_nonpersistent_flags+=("--all") |
|
17499 |
+ flags+=("--filename=") |
|
17500 |
+ flags_with_completion+=("--filename") |
|
17501 |
+ flags_completion+=("__handle_filename_extension_flag yaml|yml|json") |
|
17502 |
+ two_word_flags+=("-f") |
|
17503 |
+ flags_with_completion+=("-f") |
|
17504 |
+ flags_completion+=("__handle_filename_extension_flag yaml|yml|json") |
|
17505 |
+ local_nonpersistent_flags+=("--filename=") |
|
17506 |
+ flags+=("--local") |
|
17507 |
+ local_nonpersistent_flags+=("--local") |
|
17508 |
+ flags+=("--no-headers") |
|
17509 |
+ local_nonpersistent_flags+=("--no-headers") |
|
17510 |
+ flags+=("--output=") |
|
17511 |
+ two_word_flags+=("-o") |
|
17512 |
+ local_nonpersistent_flags+=("--output=") |
|
17513 |
+ flags+=("--output-version=") |
|
17514 |
+ local_nonpersistent_flags+=("--output-version=") |
|
17515 |
+ flags+=("--pull") |
|
17516 |
+ local_nonpersistent_flags+=("--pull") |
|
17517 |
+ flags+=("--push") |
|
17518 |
+ local_nonpersistent_flags+=("--push") |
|
17519 |
+ flags+=("--remove") |
|
17520 |
+ local_nonpersistent_flags+=("--remove") |
|
17521 |
+ flags+=("--selector=") |
|
17522 |
+ two_word_flags+=("-l") |
|
17523 |
+ local_nonpersistent_flags+=("--selector=") |
|
17524 |
+ flags+=("--show-all") |
|
17525 |
+ flags+=("-a") |
|
17526 |
+ local_nonpersistent_flags+=("--show-all") |
|
17527 |
+ flags+=("--show-labels") |
|
17528 |
+ local_nonpersistent_flags+=("--show-labels") |
|
17529 |
+ flags+=("--sort-by=") |
|
17530 |
+ local_nonpersistent_flags+=("--sort-by=") |
|
17531 |
+ flags+=("--source") |
|
17532 |
+ local_nonpersistent_flags+=("--source") |
|
17533 |
+ flags+=("--template=") |
|
17534 |
+ flags_with_completion+=("--template") |
|
17535 |
+ flags_completion+=("_filedir") |
|
17536 |
+ local_nonpersistent_flags+=("--template=") |
|
17537 |
+ flags+=("--as=") |
|
17538 |
+ flags+=("--certificate-authority=") |
|
17539 |
+ flags_with_completion+=("--certificate-authority") |
|
17540 |
+ flags_completion+=("_filedir") |
|
17541 |
+ flags+=("--client-certificate=") |
|
17542 |
+ flags_with_completion+=("--client-certificate") |
|
17543 |
+ flags_completion+=("_filedir") |
|
17544 |
+ flags+=("--client-key=") |
|
17545 |
+ flags_with_completion+=("--client-key") |
|
17546 |
+ flags_completion+=("_filedir") |
|
17547 |
+ flags+=("--cluster=") |
|
17548 |
+ flags+=("--config=") |
|
17549 |
+ flags_with_completion+=("--config") |
|
17550 |
+ flags_completion+=("_filedir") |
|
17551 |
+ flags+=("--context=") |
|
17552 |
+ flags+=("--google-json-key=") |
|
17553 |
+ flags+=("--insecure-skip-tls-verify") |
|
17554 |
+ flags+=("--log-flush-frequency=") |
|
17555 |
+ flags+=("--loglevel=") |
|
17556 |
+ flags+=("--logspec=") |
|
17557 |
+ flags+=("--match-server-version") |
|
17558 |
+ flags+=("--namespace=") |
|
17559 |
+ two_word_flags+=("-n") |
|
17560 |
+ flags+=("--server=") |
|
17561 |
+ flags+=("--token=") |
|
17562 |
+ flags+=("--user=") |
|
17563 |
+ |
|
17564 |
+ must_have_one_flag=() |
|
17565 |
+ must_have_one_noun=() |
|
17566 |
+ noun_aliases=() |
|
17567 |
+} |
|
17568 |
+ |
|
17486 | 17569 |
_openshift_cli_set_deployment-hook() |
17487 | 17570 |
{ |
17488 | 17571 |
last_command="openshift_cli_set_deployment-hook" |
... | ... |
@@ -18102,6 +18185,7 @@ _openshift_cli_set() |
18102 | 18102 |
last_command="openshift_cli_set" |
18103 | 18103 |
commands=() |
18104 | 18104 |
commands+=("build-hook") |
18105 |
+ commands+=("build-secret") |
|
18105 | 18106 |
commands+=("deployment-hook") |
18106 | 18107 |
commands+=("env") |
18107 | 18108 |
commands+=("image") |
... | ... |
@@ -2544,6 +2544,29 @@ Update a build hook on a build config |
2544 | 2544 |
==== |
2545 | 2545 |
|
2546 | 2546 |
|
2547 |
+== oc set build-secret |
|
2548 |
+Update a build secret on a build config |
|
2549 |
+ |
|
2550 |
+==== |
|
2551 |
+ |
|
2552 |
+[options="nowrap"] |
|
2553 |
+---- |
|
2554 |
+ # Clear push secret on a build config |
|
2555 |
+ oc set build-secret --push --remove bc/mybuild |
|
2556 |
+ |
|
2557 |
+ # Set the pull secret on a build config |
|
2558 |
+ oc set build-secret --pull bc/mybuild mysecret |
|
2559 |
+ |
|
2560 |
+ # Set the push and pull secret on a build config |
|
2561 |
+ oc set build-secret --push --pull bc/mybuild mysecret |
|
2562 |
+ |
|
2563 |
+ # Set the source secret on a set of build configs matching a selector |
|
2564 |
+ oc set build-secret --source -l app=myapp gitsecret |
|
2565 |
+ |
|
2566 |
+---- |
|
2567 |
+==== |
|
2568 |
+ |
|
2569 |
+ |
|
2547 | 2570 |
== oc set deployment-hook |
2548 | 2571 |
Update a deployment hook on a deployment config |
2549 | 2572 |
|
... | ... |
@@ -292,6 +292,7 @@ openshift-cli-serviceaccounts-get-token.1 |
292 | 292 |
openshift-cli-serviceaccounts-new-token.1 |
293 | 293 |
openshift-cli-serviceaccounts.1 |
294 | 294 |
openshift-cli-set-build-hook.1 |
295 |
+openshift-cli-set-build-secret.1 |
|
295 | 296 |
openshift-cli-set-deployment-hook.1 |
296 | 297 |
openshift-cli-set-env.1 |
297 | 298 |
openshift-cli-set-image.1 |
298 | 299 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,193 @@ |
0 |
+.TH "OC SET" "1" " Openshift CLI User Manuals" "Openshift" "June 2016" "" |
|
1 |
+ |
|
2 |
+ |
|
3 |
+.SH NAME |
|
4 |
+.PP |
|
5 |
+oc set build\-secret \- Update a build secret on a build config |
|
6 |
+ |
|
7 |
+ |
|
8 |
+.SH SYNOPSIS |
|
9 |
+.PP |
|
10 |
+\fBoc set build\-secret\fP [OPTIONS] |
|
11 |
+ |
|
12 |
+ |
|
13 |
+.SH DESCRIPTION |
|
14 |
+.PP |
|
15 |
+Set or remove a build secret on a build config |
|
16 |
+ |
|
17 |
+.PP |
|
18 |
+A build config can reference a secret to push or pull images from private registries or |
|
19 |
+to access private source repositories. |
|
20 |
+ |
|
21 |
+.PP |
|
22 |
+Specify the type of secret being set by using the \-\-push, \-\-pull, or \-\-source flags. |
|
23 |
+A secret reference can be removed by using \-\-remove flag. |
|
24 |
+ |
|
25 |
+.PP |
|
26 |
+A label selector may be specified with the \-\-selector flag to select the build configs |
|
27 |
+on which to set or remove secrets. Alternatively, all build configs in the namespace can |
|
28 |
+be selected with the \-\-all flag. |
|
29 |
+ |
|
30 |
+ |
|
31 |
+.SH OPTIONS |
|
32 |
+.PP |
|
33 |
+\fB\-\-all\fP=false |
|
34 |
+ Select all build configs in the namespace |
|
35 |
+ |
|
36 |
+.PP |
|
37 |
+\fB\-f\fP, \fB\-\-filename\fP=[] |
|
38 |
+ Filename, directory, or URL to file to use to edit the resource. |
|
39 |
+ |
|
40 |
+.PP |
|
41 |
+\fB\-\-local\fP=false |
|
42 |
+ If true, set build\-secret will NOT contact api\-server but run locally. |
|
43 |
+ |
|
44 |
+.PP |
|
45 |
+\fB\-\-no\-headers\fP=false |
|
46 |
+ When using the default or custom\-column output format, don't print headers. |
|
47 |
+ |
|
48 |
+.PP |
|
49 |
+\fB\-o\fP, \fB\-\-output\fP="" |
|
50 |
+ Output format. One of: json|yaml|wide|name|custom\-columns=...|custom\-columns\-file=...|go\-template=...|go\-template\-file=...|jsonpath=...|jsonpath\-file=... See custom columns [ |
|
51 |
+\[la]http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns\[ra]], golang template [ |
|
52 |
+\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]] and jsonpath template [ |
|
53 |
+\[la]http://kubernetes.io/docs/user-guide/jsonpath\[ra]]. |
|
54 |
+ |
|
55 |
+.PP |
|
56 |
+\fB\-\-output\-version\fP="" |
|
57 |
+ Output the formatted object with the given group version (for ex: 'extensions/v1beta1'). |
|
58 |
+ |
|
59 |
+.PP |
|
60 |
+\fB\-\-pull\fP=false |
|
61 |
+ If true, set the pull secret on a build config |
|
62 |
+ |
|
63 |
+.PP |
|
64 |
+\fB\-\-push\fP=false |
|
65 |
+ If true, set the push secret on a build config |
|
66 |
+ |
|
67 |
+.PP |
|
68 |
+\fB\-\-remove\fP=false |
|
69 |
+ If true, remove the build secret. |
|
70 |
+ |
|
71 |
+.PP |
|
72 |
+\fB\-l\fP, \fB\-\-selector\fP="" |
|
73 |
+ Selector (label query) to filter build configs |
|
74 |
+ |
|
75 |
+.PP |
|
76 |
+\fB\-a\fP, \fB\-\-show\-all\fP=true |
|
77 |
+ When printing, show all resources (false means hide terminated pods.) |
|
78 |
+ |
|
79 |
+.PP |
|
80 |
+\fB\-\-show\-labels\fP=false |
|
81 |
+ When printing, show all labels as the last column (default hide labels column) |
|
82 |
+ |
|
83 |
+.PP |
|
84 |
+\fB\-\-sort\-by\fP="" |
|
85 |
+ If non\-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string. |
|
86 |
+ |
|
87 |
+.PP |
|
88 |
+\fB\-\-source\fP=false |
|
89 |
+ If true, set the source secret on a build config |
|
90 |
+ |
|
91 |
+.PP |
|
92 |
+\fB\-\-template\fP="" |
|
93 |
+ Template string or path to template file to use when \-o=go\-template, \-o=go\-template\-file. The template format is golang templates [ |
|
94 |
+\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]]. |
|
95 |
+ |
|
96 |
+ |
|
97 |
+.SH OPTIONS INHERITED FROM PARENT COMMANDS |
|
98 |
+.PP |
|
99 |
+\fB\-\-api\-version\fP="" |
|
100 |
+ DEPRECATED: The API version to use when talking to the server |
|
101 |
+ |
|
102 |
+.PP |
|
103 |
+\fB\-\-as\fP="" |
|
104 |
+ Username to impersonate for the operation |
|
105 |
+ |
|
106 |
+.PP |
|
107 |
+\fB\-\-certificate\-authority\fP="" |
|
108 |
+ Path to a cert. file for the certificate authority |
|
109 |
+ |
|
110 |
+.PP |
|
111 |
+\fB\-\-client\-certificate\fP="" |
|
112 |
+ Path to a client certificate file for TLS |
|
113 |
+ |
|
114 |
+.PP |
|
115 |
+\fB\-\-client\-key\fP="" |
|
116 |
+ Path to a client key file for TLS |
|
117 |
+ |
|
118 |
+.PP |
|
119 |
+\fB\-\-cluster\fP="" |
|
120 |
+ The name of the kubeconfig cluster to use |
|
121 |
+ |
|
122 |
+.PP |
|
123 |
+\fB\-\-config\fP="" |
|
124 |
+ Path to the config file to use for CLI requests. |
|
125 |
+ |
|
126 |
+.PP |
|
127 |
+\fB\-\-context\fP="" |
|
128 |
+ The name of the kubeconfig context to use |
|
129 |
+ |
|
130 |
+.PP |
|
131 |
+\fB\-\-google\-json\-key\fP="" |
|
132 |
+ The Google Cloud Platform Service Account JSON Key to use for authentication. |
|
133 |
+ |
|
134 |
+.PP |
|
135 |
+\fB\-\-insecure\-skip\-tls\-verify\fP=false |
|
136 |
+ If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure |
|
137 |
+ |
|
138 |
+.PP |
|
139 |
+\fB\-\-log\-flush\-frequency\fP=0 |
|
140 |
+ Maximum number of seconds between log flushes |
|
141 |
+ |
|
142 |
+.PP |
|
143 |
+\fB\-\-match\-server\-version\fP=false |
|
144 |
+ Require server version to match client version |
|
145 |
+ |
|
146 |
+.PP |
|
147 |
+\fB\-n\fP, \fB\-\-namespace\fP="" |
|
148 |
+ If present, the namespace scope for this CLI request |
|
149 |
+ |
|
150 |
+.PP |
|
151 |
+\fB\-\-server\fP="" |
|
152 |
+ The address and port of the Kubernetes API server |
|
153 |
+ |
|
154 |
+.PP |
|
155 |
+\fB\-\-token\fP="" |
|
156 |
+ Bearer token for authentication to the API server |
|
157 |
+ |
|
158 |
+.PP |
|
159 |
+\fB\-\-user\fP="" |
|
160 |
+ The name of the kubeconfig user to use |
|
161 |
+ |
|
162 |
+ |
|
163 |
+.SH EXAMPLE |
|
164 |
+.PP |
|
165 |
+.RS |
|
166 |
+ |
|
167 |
+.nf |
|
168 |
+ # Clear push secret on a build config |
|
169 |
+ oc set build\-secret \-\-push \-\-remove bc/mybuild |
|
170 |
+ |
|
171 |
+ # Set the pull secret on a build config |
|
172 |
+ oc set build\-secret \-\-pull bc/mybuild mysecret |
|
173 |
+ |
|
174 |
+ # Set the push and pull secret on a build config |
|
175 |
+ oc set build\-secret \-\-push \-\-pull bc/mybuild mysecret |
|
176 |
+ |
|
177 |
+ # Set the source secret on a set of build configs matching a selector |
|
178 |
+ oc set build\-secret \-\-source \-l app=myapp gitsecret |
|
179 |
+ |
|
180 |
+ |
|
181 |
+.fi |
|
182 |
+.RE |
|
183 |
+ |
|
184 |
+ |
|
185 |
+.SH SEE ALSO |
|
186 |
+.PP |
|
187 |
+\fBoc\-set(1)\fP, |
|
188 |
+ |
|
189 |
+ |
|
190 |
+.SH HISTORY |
|
191 |
+.PP |
|
192 |
+June 2016, Ported from the Kubernetes man\-doc generator |
... | ... |
@@ -87,7 +87,7 @@ These commands help you make changes to existing application resources. |
87 | 87 |
|
88 | 88 |
.SH SEE ALSO |
89 | 89 |
.PP |
90 |
-\fBoc(1)\fP, \fBoc\-set\-build\-hook(1)\fP, \fBoc\-set\-deployment\-hook(1)\fP, \fBoc\-set\-env(1)\fP, \fBoc\-set\-image(1)\fP, \fBoc\-set\-probe(1)\fP, \fBoc\-set\-route\-backends(1)\fP, \fBoc\-set\-triggers(1)\fP, \fBoc\-set\-volumes(1)\fP, |
|
90 |
+\fBoc(1)\fP, \fBoc\-set\-build\-hook(1)\fP, \fBoc\-set\-build\-secret(1)\fP, \fBoc\-set\-deployment\-hook(1)\fP, \fBoc\-set\-env(1)\fP, \fBoc\-set\-image(1)\fP, \fBoc\-set\-probe(1)\fP, \fBoc\-set\-route\-backends(1)\fP, \fBoc\-set\-triggers(1)\fP, \fBoc\-set\-volumes(1)\fP, |
|
91 | 91 |
|
92 | 92 |
|
93 | 93 |
.SH HISTORY |
94 | 94 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,193 @@ |
0 |
+.TH "OPENSHIFT CLI SET" "1" " Openshift CLI User Manuals" "Openshift" "June 2016" "" |
|
1 |
+ |
|
2 |
+ |
|
3 |
+.SH NAME |
|
4 |
+.PP |
|
5 |
+openshift cli set build\-secret \- Update a build secret on a build config |
|
6 |
+ |
|
7 |
+ |
|
8 |
+.SH SYNOPSIS |
|
9 |
+.PP |
|
10 |
+\fBopenshift cli set build\-secret\fP [OPTIONS] |
|
11 |
+ |
|
12 |
+ |
|
13 |
+.SH DESCRIPTION |
|
14 |
+.PP |
|
15 |
+Set or remove a build secret on a build config |
|
16 |
+ |
|
17 |
+.PP |
|
18 |
+A build config can reference a secret to push or pull images from private registries or |
|
19 |
+to access private source repositories. |
|
20 |
+ |
|
21 |
+.PP |
|
22 |
+Specify the type of secret being set by using the \-\-push, \-\-pull, or \-\-source flags. |
|
23 |
+A secret reference can be removed by using \-\-remove flag. |
|
24 |
+ |
|
25 |
+.PP |
|
26 |
+A label selector may be specified with the \-\-selector flag to select the build configs |
|
27 |
+on which to set or remove secrets. Alternatively, all build configs in the namespace can |
|
28 |
+be selected with the \-\-all flag. |
|
29 |
+ |
|
30 |
+ |
|
31 |
+.SH OPTIONS |
|
32 |
+.PP |
|
33 |
+\fB\-\-all\fP=false |
|
34 |
+ Select all build configs in the namespace |
|
35 |
+ |
|
36 |
+.PP |
|
37 |
+\fB\-f\fP, \fB\-\-filename\fP=[] |
|
38 |
+ Filename, directory, or URL to file to use to edit the resource. |
|
39 |
+ |
|
40 |
+.PP |
|
41 |
+\fB\-\-local\fP=false |
|
42 |
+ If true, set build\-secret will NOT contact api\-server but run locally. |
|
43 |
+ |
|
44 |
+.PP |
|
45 |
+\fB\-\-no\-headers\fP=false |
|
46 |
+ When using the default or custom\-column output format, don't print headers. |
|
47 |
+ |
|
48 |
+.PP |
|
49 |
+\fB\-o\fP, \fB\-\-output\fP="" |
|
50 |
+ Output format. One of: json|yaml|wide|name|custom\-columns=...|custom\-columns\-file=...|go\-template=...|go\-template\-file=...|jsonpath=...|jsonpath\-file=... See custom columns [ |
|
51 |
+\[la]http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns\[ra]], golang template [ |
|
52 |
+\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]] and jsonpath template [ |
|
53 |
+\[la]http://kubernetes.io/docs/user-guide/jsonpath\[ra]]. |
|
54 |
+ |
|
55 |
+.PP |
|
56 |
+\fB\-\-output\-version\fP="" |
|
57 |
+ Output the formatted object with the given group version (for ex: 'extensions/v1beta1'). |
|
58 |
+ |
|
59 |
+.PP |
|
60 |
+\fB\-\-pull\fP=false |
|
61 |
+ If true, set the pull secret on a build config |
|
62 |
+ |
|
63 |
+.PP |
|
64 |
+\fB\-\-push\fP=false |
|
65 |
+ If true, set the push secret on a build config |
|
66 |
+ |
|
67 |
+.PP |
|
68 |
+\fB\-\-remove\fP=false |
|
69 |
+ If true, remove the build secret. |
|
70 |
+ |
|
71 |
+.PP |
|
72 |
+\fB\-l\fP, \fB\-\-selector\fP="" |
|
73 |
+ Selector (label query) to filter build configs |
|
74 |
+ |
|
75 |
+.PP |
|
76 |
+\fB\-a\fP, \fB\-\-show\-all\fP=true |
|
77 |
+ When printing, show all resources (false means hide terminated pods.) |
|
78 |
+ |
|
79 |
+.PP |
|
80 |
+\fB\-\-show\-labels\fP=false |
|
81 |
+ When printing, show all labels as the last column (default hide labels column) |
|
82 |
+ |
|
83 |
+.PP |
|
84 |
+\fB\-\-sort\-by\fP="" |
|
85 |
+ If non\-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string. |
|
86 |
+ |
|
87 |
+.PP |
|
88 |
+\fB\-\-source\fP=false |
|
89 |
+ If true, set the source secret on a build config |
|
90 |
+ |
|
91 |
+.PP |
|
92 |
+\fB\-\-template\fP="" |
|
93 |
+ Template string or path to template file to use when \-o=go\-template, \-o=go\-template\-file. The template format is golang templates [ |
|
94 |
+\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]]. |
|
95 |
+ |
|
96 |
+ |
|
97 |
+.SH OPTIONS INHERITED FROM PARENT COMMANDS |
|
98 |
+.PP |
|
99 |
+\fB\-\-api\-version\fP="" |
|
100 |
+ DEPRECATED: The API version to use when talking to the server |
|
101 |
+ |
|
102 |
+.PP |
|
103 |
+\fB\-\-as\fP="" |
|
104 |
+ Username to impersonate for the operation |
|
105 |
+ |
|
106 |
+.PP |
|
107 |
+\fB\-\-certificate\-authority\fP="" |
|
108 |
+ Path to a cert. file for the certificate authority |
|
109 |
+ |
|
110 |
+.PP |
|
111 |
+\fB\-\-client\-certificate\fP="" |
|
112 |
+ Path to a client certificate file for TLS |
|
113 |
+ |
|
114 |
+.PP |
|
115 |
+\fB\-\-client\-key\fP="" |
|
116 |
+ Path to a client key file for TLS |
|
117 |
+ |
|
118 |
+.PP |
|
119 |
+\fB\-\-cluster\fP="" |
|
120 |
+ The name of the kubeconfig cluster to use |
|
121 |
+ |
|
122 |
+.PP |
|
123 |
+\fB\-\-config\fP="" |
|
124 |
+ Path to the config file to use for CLI requests. |
|
125 |
+ |
|
126 |
+.PP |
|
127 |
+\fB\-\-context\fP="" |
|
128 |
+ The name of the kubeconfig context to use |
|
129 |
+ |
|
130 |
+.PP |
|
131 |
+\fB\-\-google\-json\-key\fP="" |
|
132 |
+ The Google Cloud Platform Service Account JSON Key to use for authentication. |
|
133 |
+ |
|
134 |
+.PP |
|
135 |
+\fB\-\-insecure\-skip\-tls\-verify\fP=false |
|
136 |
+ If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure |
|
137 |
+ |
|
138 |
+.PP |
|
139 |
+\fB\-\-log\-flush\-frequency\fP=0 |
|
140 |
+ Maximum number of seconds between log flushes |
|
141 |
+ |
|
142 |
+.PP |
|
143 |
+\fB\-\-match\-server\-version\fP=false |
|
144 |
+ Require server version to match client version |
|
145 |
+ |
|
146 |
+.PP |
|
147 |
+\fB\-n\fP, \fB\-\-namespace\fP="" |
|
148 |
+ If present, the namespace scope for this CLI request |
|
149 |
+ |
|
150 |
+.PP |
|
151 |
+\fB\-\-server\fP="" |
|
152 |
+ The address and port of the Kubernetes API server |
|
153 |
+ |
|
154 |
+.PP |
|
155 |
+\fB\-\-token\fP="" |
|
156 |
+ Bearer token for authentication to the API server |
|
157 |
+ |
|
158 |
+.PP |
|
159 |
+\fB\-\-user\fP="" |
|
160 |
+ The name of the kubeconfig user to use |
|
161 |
+ |
|
162 |
+ |
|
163 |
+.SH EXAMPLE |
|
164 |
+.PP |
|
165 |
+.RS |
|
166 |
+ |
|
167 |
+.nf |
|
168 |
+ # Clear push secret on a build config |
|
169 |
+ openshift cli set build\-secret \-\-push \-\-remove bc/mybuild |
|
170 |
+ |
|
171 |
+ # Set the pull secret on a build config |
|
172 |
+ openshift cli set build\-secret \-\-pull bc/mybuild mysecret |
|
173 |
+ |
|
174 |
+ # Set the push and pull secret on a build config |
|
175 |
+ openshift cli set build\-secret \-\-push \-\-pull bc/mybuild mysecret |
|
176 |
+ |
|
177 |
+ # Set the source secret on a set of build configs matching a selector |
|
178 |
+ openshift cli set build\-secret \-\-source \-l app=myapp gitsecret |
|
179 |
+ |
|
180 |
+ |
|
181 |
+.fi |
|
182 |
+.RE |
|
183 |
+ |
|
184 |
+ |
|
185 |
+.SH SEE ALSO |
|
186 |
+.PP |
|
187 |
+\fBopenshift\-cli\-set(1)\fP, |
|
188 |
+ |
|
189 |
+ |
|
190 |
+.SH HISTORY |
|
191 |
+.PP |
|
192 |
+June 2016, Ported from the Kubernetes man\-doc generator |
... | ... |
@@ -87,7 +87,7 @@ These commands help you make changes to existing application resources. |
87 | 87 |
|
88 | 88 |
.SH SEE ALSO |
89 | 89 |
.PP |
90 |
-\fBopenshift\-cli(1)\fP, \fBopenshift\-cli\-set\-build\-hook(1)\fP, \fBopenshift\-cli\-set\-deployment\-hook(1)\fP, \fBopenshift\-cli\-set\-env(1)\fP, \fBopenshift\-cli\-set\-image(1)\fP, \fBopenshift\-cli\-set\-probe(1)\fP, \fBopenshift\-cli\-set\-route\-backends(1)\fP, \fBopenshift\-cli\-set\-triggers(1)\fP, \fBopenshift\-cli\-set\-volumes(1)\fP, |
|
90 |
+\fBopenshift\-cli(1)\fP, \fBopenshift\-cli\-set\-build\-hook(1)\fP, \fBopenshift\-cli\-set\-build\-secret(1)\fP, \fBopenshift\-cli\-set\-deployment\-hook(1)\fP, \fBopenshift\-cli\-set\-env(1)\fP, \fBopenshift\-cli\-set\-image(1)\fP, \fBopenshift\-cli\-set\-probe(1)\fP, \fBopenshift\-cli\-set\-route\-backends(1)\fP, \fBopenshift\-cli\-set\-triggers(1)\fP, \fBopenshift\-cli\-set\-volumes(1)\fP, |
|
91 | 91 |
|
92 | 92 |
|
93 | 93 |
.SH HISTORY |
94 | 94 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,338 @@ |
0 |
+package set |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "fmt" |
|
4 |
+ "io" |
|
5 |
+ "os" |
|
6 |
+ |
|
7 |
+ "github.com/spf13/cobra" |
|
8 |
+ kapi "k8s.io/kubernetes/pkg/api" |
|
9 |
+ "k8s.io/kubernetes/pkg/api/meta" |
|
10 |
+ "k8s.io/kubernetes/pkg/api/unversioned" |
|
11 |
+ kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
|
12 |
+ "k8s.io/kubernetes/pkg/kubectl/resource" |
|
13 |
+ "k8s.io/kubernetes/pkg/runtime" |
|
14 |
+ "k8s.io/kubernetes/pkg/util/errors" |
|
15 |
+ |
|
16 |
+ buildapi "github.com/openshift/origin/pkg/build/api" |
|
17 |
+ cmdutil "github.com/openshift/origin/pkg/cmd/util" |
|
18 |
+ "github.com/openshift/origin/pkg/cmd/util/clientcmd" |
|
19 |
+) |
|
20 |
+ |
|
21 |
+const ( |
|
22 |
+ buildSecretLong = ` |
|
23 |
+Set or remove a build secret on a build config |
|
24 |
+ |
|
25 |
+A build config can reference a secret to push or pull images from private registries or |
|
26 |
+to access private source repositories. |
|
27 |
+ |
|
28 |
+Specify the type of secret being set by using the --push, --pull, or --source flags. |
|
29 |
+A secret reference can be removed by using --remove flag. |
|
30 |
+ |
|
31 |
+A label selector may be specified with the --selector flag to select the build configs |
|
32 |
+on which to set or remove secrets. Alternatively, all build configs in the namespace can |
|
33 |
+be selected with the --all flag. |
|
34 |
+` |
|
35 |
+ |
|
36 |
+ buildSecretExample = ` # Clear push secret on a build config |
|
37 |
+ %[1]s build-secret --push --remove bc/mybuild |
|
38 |
+ |
|
39 |
+ # Set the pull secret on a build config |
|
40 |
+ %[1]s build-secret --pull bc/mybuild mysecret |
|
41 |
+ |
|
42 |
+ # Set the push and pull secret on a build config |
|
43 |
+ %[1]s build-secret --push --pull bc/mybuild mysecret |
|
44 |
+ |
|
45 |
+ # Set the source secret on a set of build configs matching a selector |
|
46 |
+ %[1]s build-secret --source -l app=myapp gitsecret |
|
47 |
+` |
|
48 |
+) |
|
49 |
+ |
|
50 |
+type BuildSecretOptions struct { |
|
51 |
+ Out io.Writer |
|
52 |
+ Err io.Writer |
|
53 |
+ |
|
54 |
+ Builder *resource.Builder |
|
55 |
+ Infos []*resource.Info |
|
56 |
+ |
|
57 |
+ Encoder runtime.Encoder |
|
58 |
+ OutputVersion unversioned.GroupVersion |
|
59 |
+ |
|
60 |
+ Filenames []string |
|
61 |
+ Selector string |
|
62 |
+ All bool |
|
63 |
+ |
|
64 |
+ ShortOutput bool |
|
65 |
+ Local bool |
|
66 |
+ Mapper meta.RESTMapper |
|
67 |
+ |
|
68 |
+ PrintObject func(runtime.Object) error |
|
69 |
+ |
|
70 |
+ Secret string |
|
71 |
+ Push bool |
|
72 |
+ Pull bool |
|
73 |
+ Source bool |
|
74 |
+ Remove bool |
|
75 |
+} |
|
76 |
+ |
|
77 |
+// NewCmdBuildSecret implements the set build-secret command |
|
78 |
+func NewCmdBuildSecret(fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command { |
|
79 |
+ options := &BuildSecretOptions{ |
|
80 |
+ Out: out, |
|
81 |
+ Err: errOut, |
|
82 |
+ } |
|
83 |
+ cmd := &cobra.Command{ |
|
84 |
+ Use: "build-secret BUILDCONFIG SECRETNAME", |
|
85 |
+ Short: "Update a build secret on a build config", |
|
86 |
+ Long: buildSecretLong, |
|
87 |
+ Example: fmt.Sprintf(buildSecretExample, fullName), |
|
88 |
+ Run: func(cmd *cobra.Command, args []string) { |
|
89 |
+ kcmdutil.CheckErr(options.Complete(f, cmd, args)) |
|
90 |
+ kcmdutil.CheckErr(options.Validate()) |
|
91 |
+ if err := options.Run(); err != nil { |
|
92 |
+ // TODO: move me to kcmdutil |
|
93 |
+ if err == cmdutil.ErrExit { |
|
94 |
+ os.Exit(1) |
|
95 |
+ } |
|
96 |
+ kcmdutil.CheckErr(err) |
|
97 |
+ } |
|
98 |
+ }, |
|
99 |
+ } |
|
100 |
+ |
|
101 |
+ kcmdutil.AddPrinterFlags(cmd) |
|
102 |
+ cmd.Flags().StringVarP(&options.Selector, "selector", "l", options.Selector, "Selector (label query) to filter build configs") |
|
103 |
+ cmd.Flags().BoolVar(&options.All, "all", options.All, "Select all build configs in the namespace") |
|
104 |
+ cmd.Flags().StringSliceVarP(&options.Filenames, "filename", "f", options.Filenames, "Filename, directory, or URL to file to use to edit the resource.") |
|
105 |
+ |
|
106 |
+ cmd.Flags().BoolVar(&options.Push, "push", options.Push, "If true, set the push secret on a build config") |
|
107 |
+ cmd.Flags().BoolVar(&options.Pull, "pull", options.Pull, "If true, set the pull secret on a build config") |
|
108 |
+ cmd.Flags().BoolVar(&options.Source, "source", options.Source, "If true, set the source secret on a build config") |
|
109 |
+ cmd.Flags().BoolVar(&options.Remove, "remove", options.Remove, "If true, remove the build secret.") |
|
110 |
+ |
|
111 |
+ cmd.Flags().BoolVar(&options.Local, "local", false, "If true, set build-secret will NOT contact api-server but run locally.") |
|
112 |
+ |
|
113 |
+ cmd.MarkFlagFilename("filename", "yaml", "yml", "json") |
|
114 |
+ |
|
115 |
+ return cmd |
|
116 |
+} |
|
117 |
+ |
|
118 |
+var supportedBuildTypes = []string{"buildconfigs"} |
|
119 |
+ |
|
120 |
+func (o *BuildSecretOptions) secretFromArg(f *clientcmd.Factory, mapper meta.RESTMapper, typer runtime.ObjectTyper, namespace, arg string) (string, error) { |
|
121 |
+ builder := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), kapi.Codecs.UniversalDecoder()). |
|
122 |
+ NamespaceParam(namespace).DefaultNamespace(). |
|
123 |
+ RequireObject(false). |
|
124 |
+ ContinueOnError(). |
|
125 |
+ ResourceNames("secrets", arg). |
|
126 |
+ Flatten() |
|
127 |
+ |
|
128 |
+ var secretName string |
|
129 |
+ err := builder.Do().Visit(func(info *resource.Info, err error) error { |
|
130 |
+ if err != nil { |
|
131 |
+ return err |
|
132 |
+ } |
|
133 |
+ if info.Mapping.Resource != "secrets" { |
|
134 |
+ return fmt.Errorf("please specify a secret") |
|
135 |
+ } |
|
136 |
+ secretName = info.Name |
|
137 |
+ return nil |
|
138 |
+ }) |
|
139 |
+ if err != nil { |
|
140 |
+ return "", err |
|
141 |
+ } |
|
142 |
+ return secretName, nil |
|
143 |
+} |
|
144 |
+ |
|
145 |
+func (o *BuildSecretOptions) Complete(f *clientcmd.Factory, cmd *cobra.Command, args []string) error { |
|
146 |
+ var secretArg string |
|
147 |
+ if !o.Remove { |
|
148 |
+ if len(args) < 1 { |
|
149 |
+ return kcmdutil.UsageError(cmd, "a secret name must be specified") |
|
150 |
+ } |
|
151 |
+ secretArg = args[len(args)-1] |
|
152 |
+ args = args[:len(args)-1] |
|
153 |
+ } |
|
154 |
+ resources := args |
|
155 |
+ if len(resources) == 0 && len(o.Selector) == 0 && len(o.Filenames) == 0 && !o.All { |
|
156 |
+ return kcmdutil.UsageError(cmd, "one or more build configs must be specified as <name> or <resource>/<name>") |
|
157 |
+ } |
|
158 |
+ |
|
159 |
+ cmdNamespace, explicit, err := f.DefaultNamespace() |
|
160 |
+ if err != nil { |
|
161 |
+ return err |
|
162 |
+ } |
|
163 |
+ clientConfig, err := f.ClientConfig() |
|
164 |
+ if err != nil { |
|
165 |
+ return err |
|
166 |
+ } |
|
167 |
+ o.OutputVersion, err = kcmdutil.OutputVersion(cmd, clientConfig.GroupVersion) |
|
168 |
+ if err != nil { |
|
169 |
+ return err |
|
170 |
+ } |
|
171 |
+ |
|
172 |
+ mapper, typer := f.Object(false) |
|
173 |
+ if len(secretArg) > 0 { |
|
174 |
+ o.Secret, err = o.secretFromArg(f, mapper, typer, cmdNamespace, secretArg) |
|
175 |
+ if err != nil { |
|
176 |
+ return err |
|
177 |
+ } |
|
178 |
+ } |
|
179 |
+ o.Builder = resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), kapi.Codecs.UniversalDecoder()). |
|
180 |
+ ContinueOnError(). |
|
181 |
+ NamespaceParam(cmdNamespace).DefaultNamespace(). |
|
182 |
+ FilenameParam(explicit, false, o.Filenames...). |
|
183 |
+ Flatten() |
|
184 |
+ |
|
185 |
+ if !o.Local { |
|
186 |
+ o.Builder = o.Builder. |
|
187 |
+ ResourceNames("buildconfigs", resources...). |
|
188 |
+ SelectorParam(o.Selector). |
|
189 |
+ Latest() |
|
190 |
+ |
|
191 |
+ if o.All { |
|
192 |
+ o.Builder.ResourceTypes(supportedBuildTypes...).SelectAllParam(o.All) |
|
193 |
+ } |
|
194 |
+ } |
|
195 |
+ |
|
196 |
+ output := kcmdutil.GetFlagString(cmd, "output") |
|
197 |
+ if len(output) != 0 || o.Local { |
|
198 |
+ o.PrintObject = func(obj runtime.Object) error { return f.PrintObject(cmd, mapper, obj, o.Out) } |
|
199 |
+ } |
|
200 |
+ |
|
201 |
+ o.Encoder = f.JSONEncoder() |
|
202 |
+ o.ShortOutput = kcmdutil.GetFlagString(cmd, "output") == "name" |
|
203 |
+ o.Mapper = mapper |
|
204 |
+ |
|
205 |
+ return nil |
|
206 |
+} |
|
207 |
+ |
|
208 |
+func (o *BuildSecretOptions) Validate() error { |
|
209 |
+ if !o.Pull && !o.Push && !o.Source { |
|
210 |
+ return fmt.Errorf("specify the type of secret to set (--push, --pull, or --source)") |
|
211 |
+ } |
|
212 |
+ if !o.Remove && len(o.Secret) == 0 { |
|
213 |
+ return fmt.Errorf("specify a secret to set") |
|
214 |
+ } |
|
215 |
+ if o.Remove && len(o.Secret) > 0 { |
|
216 |
+ return fmt.Errorf("a secret cannot be specified when using the --remove flag") |
|
217 |
+ } |
|
218 |
+ return nil |
|
219 |
+} |
|
220 |
+ |
|
221 |
+func (o *BuildSecretOptions) Run() error { |
|
222 |
+ infos := o.Infos |
|
223 |
+ singular := len(o.Infos) <= 1 |
|
224 |
+ if o.Builder != nil { |
|
225 |
+ loaded, err := o.Builder.Do().IntoSingular(&singular).Infos() |
|
226 |
+ if err != nil { |
|
227 |
+ return err |
|
228 |
+ } |
|
229 |
+ infos = loaded |
|
230 |
+ } |
|
231 |
+ |
|
232 |
+ patches := CalculatePatches(infos, o.Encoder, func(info *resource.Info) (bool, error) { |
|
233 |
+ return o.setBuildSecret(info.Object) |
|
234 |
+ }) |
|
235 |
+ |
|
236 |
+ if singular && len(patches) == 0 { |
|
237 |
+ return fmt.Errorf("cannot set a build secret on %s/%s", infos[0].Mapping.Resource, infos[0].Name) |
|
238 |
+ } |
|
239 |
+ |
|
240 |
+ if o.PrintObject != nil { |
|
241 |
+ object, err := resource.AsVersionedObject(infos, !singular, o.OutputVersion, kapi.Codecs.LegacyCodec(o.OutputVersion)) |
|
242 |
+ if err != nil { |
|
243 |
+ return err |
|
244 |
+ } |
|
245 |
+ return o.PrintObject(object) |
|
246 |
+ } |
|
247 |
+ |
|
248 |
+ errs := []error{} |
|
249 |
+ for _, patch := range patches { |
|
250 |
+ info := patch.Info |
|
251 |
+ if patch.Err != nil { |
|
252 |
+ errs = append(errs, fmt.Errorf("%s/%s %v", info.Mapping.Resource, info.Name, patch.Err)) |
|
253 |
+ continue |
|
254 |
+ } |
|
255 |
+ |
|
256 |
+ if string(patch.Patch) == "{}" || len(patch.Patch) == 0 { |
|
257 |
+ fmt.Fprintf(o.Err, "info: %s %q was not changed\n", info.Mapping.Resource, info.Name) |
|
258 |
+ continue |
|
259 |
+ } |
|
260 |
+ |
|
261 |
+ obj, err := resource.NewHelper(info.Client, info.Mapping).Patch(info.Namespace, info.Name, kapi.StrategicMergePatchType, patch.Patch) |
|
262 |
+ if err != nil { |
|
263 |
+ errs = append(errs, fmt.Errorf("%s/%s %v", info.Mapping.Resource, info.Name, err)) |
|
264 |
+ continue |
|
265 |
+ } |
|
266 |
+ |
|
267 |
+ info.Refresh(obj, true) |
|
268 |
+ kcmdutil.PrintSuccess(o.Mapper, o.ShortOutput, o.Out, info.Mapping.Resource, info.Name, "updated") |
|
269 |
+ } |
|
270 |
+ if len(errs) > 0 { |
|
271 |
+ return errors.NewAggregate(errs) |
|
272 |
+ } |
|
273 |
+ return nil |
|
274 |
+} |
|
275 |
+ |
|
276 |
+// setBuildSecret will set a secret on an object. For now the only supported |
|
277 |
+// object type is BuildConfig. |
|
278 |
+func (o *BuildSecretOptions) setBuildSecret(obj runtime.Object) (bool, error) { |
|
279 |
+ switch buildObj := obj.(type) { |
|
280 |
+ case *buildapi.BuildConfig: |
|
281 |
+ o.updateBuildConfig(buildObj) |
|
282 |
+ return true, nil |
|
283 |
+ default: |
|
284 |
+ return false, nil |
|
285 |
+ } |
|
286 |
+} |
|
287 |
+ |
|
288 |
+func (o *BuildSecretOptions) updateBuildConfig(bc *buildapi.BuildConfig) { |
|
289 |
+ if o.Push { |
|
290 |
+ if o.Remove { |
|
291 |
+ bc.Spec.Output.PushSecret = nil |
|
292 |
+ } else { |
|
293 |
+ bc.Spec.Output.PushSecret = &kapi.LocalObjectReference{ |
|
294 |
+ Name: o.Secret, |
|
295 |
+ } |
|
296 |
+ } |
|
297 |
+ } |
|
298 |
+ |
|
299 |
+ if o.Pull { |
|
300 |
+ switch { |
|
301 |
+ case bc.Spec.Strategy.DockerStrategy != nil: |
|
302 |
+ if o.Remove { |
|
303 |
+ bc.Spec.Strategy.DockerStrategy.PullSecret = nil |
|
304 |
+ } else { |
|
305 |
+ bc.Spec.Strategy.DockerStrategy.PullSecret = &kapi.LocalObjectReference{ |
|
306 |
+ Name: o.Secret, |
|
307 |
+ } |
|
308 |
+ } |
|
309 |
+ case bc.Spec.Strategy.SourceStrategy != nil: |
|
310 |
+ if o.Remove { |
|
311 |
+ bc.Spec.Strategy.SourceStrategy.PullSecret = nil |
|
312 |
+ } else { |
|
313 |
+ bc.Spec.Strategy.SourceStrategy.PullSecret = &kapi.LocalObjectReference{ |
|
314 |
+ Name: o.Secret, |
|
315 |
+ } |
|
316 |
+ } |
|
317 |
+ case bc.Spec.Strategy.CustomStrategy != nil: |
|
318 |
+ if o.Remove { |
|
319 |
+ bc.Spec.Strategy.CustomStrategy.PullSecret = nil |
|
320 |
+ } else { |
|
321 |
+ bc.Spec.Strategy.CustomStrategy.PullSecret = &kapi.LocalObjectReference{ |
|
322 |
+ Name: o.Secret, |
|
323 |
+ } |
|
324 |
+ } |
|
325 |
+ } |
|
326 |
+ } |
|
327 |
+ |
|
328 |
+ if o.Source { |
|
329 |
+ if o.Remove { |
|
330 |
+ bc.Spec.Source.SourceSecret = nil |
|
331 |
+ } else { |
|
332 |
+ bc.Spec.Source.SourceSecret = &kapi.LocalObjectReference{ |
|
333 |
+ Name: o.Secret, |
|
334 |
+ } |
|
335 |
+ } |
|
336 |
+ } |
|
337 |
+} |
... | ... |
@@ -42,6 +42,12 @@ func NewCmdSet(fullName string, f *clientcmd.Factory, in io.Reader, out, errout |
42 | 42 |
}, |
43 | 43 |
}, |
44 | 44 |
{ |
45 |
+ Message: "Manage secrets:", |
|
46 |
+ Commands: []*cobra.Command{ |
|
47 |
+ NewCmdBuildSecret(name, f, out, errout), |
|
48 |
+ }, |
|
49 |
+ }, |
|
50 |
+ { |
|
45 | 51 |
Message: "Manage application flows:", |
46 | 52 |
Commands: []*cobra.Command{ |
47 | 53 |
NewCmdTriggers(name, f, out, errout), |
48 | 54 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,46 @@ |
0 |
+package set |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "bytes" |
|
4 |
+ "testing" |
|
5 |
+ |
|
6 |
+ "github.com/spf13/cobra" |
|
7 |
+ "k8s.io/kubernetes/pkg/util/sets" |
|
8 |
+ |
|
9 |
+ "github.com/openshift/origin/pkg/cmd/util/clientcmd" |
|
10 |
+) |
|
11 |
+ |
|
12 |
+// localFlagExceptions is the list of commands (children of set) that do not |
|
13 |
+// yet implement the --local flag. |
|
14 |
+// FIXME: Remove commands from this list as the --local flag is implemented |
|
15 |
+var localFlagExceptions = sets.NewString( |
|
16 |
+ "build-hook", |
|
17 |
+ "deployment-hook", |
|
18 |
+ "env", |
|
19 |
+ "probe", |
|
20 |
+ "route-backends", |
|
21 |
+ "triggers", |
|
22 |
+ "volumes", |
|
23 |
+) |
|
24 |
+ |
|
25 |
+func TestLocalFlag(t *testing.T) { |
|
26 |
+ in := &bytes.Buffer{} |
|
27 |
+ out := &bytes.Buffer{} |
|
28 |
+ errout := &bytes.Buffer{} |
|
29 |
+ f := clientcmd.NewFactory(nil) |
|
30 |
+ setCmd := NewCmdSet("", f, in, out, errout) |
|
31 |
+ ensureLocalFlagOnChildren(t, setCmd, "") |
|
32 |
+} |
|
33 |
+ |
|
34 |
+func ensureLocalFlagOnChildren(t *testing.T, c *cobra.Command, prefix string) { |
|
35 |
+ for _, cmd := range c.Commands() { |
|
36 |
+ name := prefix + cmd.Name() |
|
37 |
+ if localFlagExceptions.Has(name) { |
|
38 |
+ continue |
|
39 |
+ } |
|
40 |
+ if localFlag := cmd.Flag("local"); localFlag == nil { |
|
41 |
+ t.Errorf("Command %s does not implement the --local flag", name) |
|
42 |
+ } |
|
43 |
+ ensureLocalFlagOnChildren(t, cmd, name+".") |
|
44 |
+ } |
|
45 |
+} |
... | ... |
@@ -119,34 +119,6 @@ os::cmd::expect_success 'oc delete all -l build=docker' |
119 | 119 |
echo "buildConfig: ok" |
120 | 120 |
os::test::junit::declare_suite_end |
121 | 121 |
|
122 |
-os::test::junit::declare_suite_start "cmd/builds/setbuildhook" |
|
123 |
-# Validate the set build-hook command |
|
124 |
-arg="-f test/testdata/test-bc.yaml" |
|
125 |
-os::cmd::expect_failure_and_text "oc set build-hook" "error: one or more build configs" |
|
126 |
-os::cmd::expect_failure_and_text "oc set build-hook ${arg}" "error: you must specify a type of hook" |
|
127 |
-os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit -o yaml -- echo 'hello world'" 'postCommit:' |
|
128 |
-os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit -o yaml -- echo 'hello world'" 'args:' |
|
129 |
-os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit -o yaml -- echo 'hello world'" '\- echo' |
|
130 |
-os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit -o yaml -- echo 'hello world'" '\- hello world' |
|
131 |
-os::cmd::expect_success_and_not_text "oc set build-hook ${arg} --post-commit -o yaml -- echo 'hello world'" 'command:' |
|
132 |
-os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit --command -o yaml -- echo 'hello world'" 'command:' |
|
133 |
-os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit -o yaml --script='echo \"hello world\"'" 'script: echo \"hello world\"' |
|
134 |
-# Server object tests |
|
135 |
-os::cmd::expect_success "oc create -f test/testdata/test-bc.yaml" |
|
136 |
-os::cmd::expect_failure_and_text "oc set build-hook bc/test-buildconfig --post-commit" "you must specify either a script or command" |
|
137 |
-os::cmd::expect_success_and_text "oc set build-hook test-buildconfig --post-commit -- echo 'hello world'" "updated" |
|
138 |
-os::cmd::expect_success_and_text "oc set build-hook bc/test-buildconfig --post-commit -- echo 'hello world'" "was not changed" |
|
139 |
-os::cmd::expect_success_and_text "oc get bc/test-buildconfig -o yaml" "args:" |
|
140 |
-os::cmd::expect_success_and_text "oc set build-hook bc/test-buildconfig --post-commit --command -- /bin/bash -c \"echo 'test'\"" "updated" |
|
141 |
-os::cmd::expect_success_and_text "oc get bc/test-buildconfig -o yaml" "command:" |
|
142 |
-os::cmd::expect_success_and_text "oc set build-hook --all --post-commit -- echo 'all bc'" "updated" |
|
143 |
-os::cmd::expect_success_and_text "oc get bc -o yaml" "all bc" |
|
144 |
-os::cmd::expect_success_and_text "oc set build-hook bc/test-buildconfig --post-commit --remove" "updated" |
|
145 |
-os::cmd::expect_success_and_not_text "oc get bc/test-buildconfig -o yaml" "args:" |
|
146 |
-os::cmd::expect_success "oc delete bc/test-buildconfig" |
|
147 |
-echo "set build-hook: ok" |
|
148 |
-os::test::junit::declare_suite_end |
|
149 |
- |
|
150 | 122 |
os::test::junit::declare_suite_start "cmd/builds/start-build" |
151 | 123 |
os::cmd::expect_success 'oc create -f test/integration/testdata/test-buildcli.json' |
152 | 124 |
# a build for which there is not an upstream tag in the corresponding imagerepo, so |
153 | 125 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,39 @@ |
0 |
+#!/bin/bash |
|
1 |
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh" |
|
2 |
+trap os::test::junit::reconcile_output EXIT |
|
3 |
+ |
|
4 |
+# Cleanup cluster resources created by this test |
|
5 |
+( |
|
6 |
+ set +e |
|
7 |
+ oc delete all,templates --all |
|
8 |
+ exit 0 |
|
9 |
+) &>/dev/null |
|
10 |
+ |
|
11 |
+ |
|
12 |
+os::test::junit::declare_suite_start "cmd/builds/setbuildhook" |
|
13 |
+# Validate the set build-hook command |
|
14 |
+arg="-f test/testdata/test-bc.yaml" |
|
15 |
+os::cmd::expect_failure_and_text "oc set build-hook" "error: one or more build configs" |
|
16 |
+os::cmd::expect_failure_and_text "oc set build-hook ${arg}" "error: you must specify a type of hook" |
|
17 |
+os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit -o yaml -- echo 'hello world'" 'postCommit:' |
|
18 |
+os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit -o yaml -- echo 'hello world'" 'args:' |
|
19 |
+os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit -o yaml -- echo 'hello world'" '\- echo' |
|
20 |
+os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit -o yaml -- echo 'hello world'" '\- hello world' |
|
21 |
+os::cmd::expect_success_and_not_text "oc set build-hook ${arg} --post-commit -o yaml -- echo 'hello world'" 'command:' |
|
22 |
+os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit --command -o yaml -- echo 'hello world'" 'command:' |
|
23 |
+os::cmd::expect_success_and_text "oc set build-hook ${arg} --post-commit -o yaml --script='echo \"hello world\"'" 'script: echo \"hello world\"' |
|
24 |
+# Server object tests |
|
25 |
+os::cmd::expect_success "oc create -f test/testdata/test-bc.yaml" |
|
26 |
+os::cmd::expect_failure_and_text "oc set build-hook bc/test-buildconfig --post-commit" "you must specify either a script or command" |
|
27 |
+os::cmd::expect_success_and_text "oc set build-hook test-buildconfig --post-commit -- echo 'hello world'" "updated" |
|
28 |
+os::cmd::expect_success_and_text "oc set build-hook bc/test-buildconfig --post-commit -- echo 'hello world'" "was not changed" |
|
29 |
+os::cmd::expect_success_and_text "oc get bc/test-buildconfig -o yaml" "args:" |
|
30 |
+os::cmd::expect_success_and_text "oc set build-hook bc/test-buildconfig --post-commit --command -- /bin/bash -c \"echo 'test'\"" "updated" |
|
31 |
+os::cmd::expect_success_and_text "oc get bc/test-buildconfig -o yaml" "command:" |
|
32 |
+os::cmd::expect_success_and_text "oc set build-hook --all --post-commit -- echo 'all bc'" "updated" |
|
33 |
+os::cmd::expect_success_and_text "oc get bc -o yaml" "all bc" |
|
34 |
+os::cmd::expect_success_and_text "oc set build-hook bc/test-buildconfig --post-commit --remove" "updated" |
|
35 |
+os::cmd::expect_success_and_not_text "oc get bc/test-buildconfig -o yaml" "args:" |
|
36 |
+os::cmd::expect_success "oc delete bc/test-buildconfig" |
|
37 |
+echo "set build-hook: ok" |
|
38 |
+os::test::junit::declare_suite_end |
0 | 39 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,36 @@ |
0 |
+#!/bin/bash |
|
1 |
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh" |
|
2 |
+trap os::test::junit::reconcile_output EXIT |
|
3 |
+ |
|
4 |
+# Cleanup cluster resources created by this test |
|
5 |
+( |
|
6 |
+ set +e |
|
7 |
+ oc delete all,templates --all |
|
8 |
+ exit 0 |
|
9 |
+) &>/dev/null |
|
10 |
+ |
|
11 |
+os::test::junit::declare_suite_start "cmd/builds/setbuildsecret" |
|
12 |
+# Validate the set build-secret command |
|
13 |
+arg="-f test/testdata/test-bc.yaml" |
|
14 |
+os::cmd::expect_failure_and_text "oc set build-secret" "error: a secret name must be specified" |
|
15 |
+os::cmd::expect_failure_and_text "oc set build-secret ${arg}" "error: a secret name must be specified" |
|
16 |
+os::cmd::expect_failure_and_text "oc set build-secret ${arg} mysecret" "error: specify the type of secret" |
|
17 |
+os::cmd::expect_success_and_text "oc set build-secret ${arg} mysecret --push --local -o yaml" 'pushSecret:' |
|
18 |
+os::cmd::expect_success_and_text "oc set build-secret ${arg} mysecret --push --local -o yaml" 'name: mysecret' |
|
19 |
+os::cmd::expect_success_and_text "oc set build-secret ${arg} mysecret --pull --local -o yaml" 'pullSecret:' |
|
20 |
+os::cmd::expect_success_and_text "oc set build-secret ${arg} mysecret --pull --local -o yaml" 'name: mysecret' |
|
21 |
+os::cmd::expect_success_and_text "oc set build-secret ${arg} mysecret --source --local -o yaml" 'sourceSecret:' |
|
22 |
+os::cmd::expect_success_and_text "oc set build-secret ${arg} mysecret --source --local -o yaml" 'name: mysecret' |
|
23 |
+os::cmd::expect_success_and_not_text "oc set build-secret ${arg} mysecret --push --local -o yaml | oc set build-secret --local -f - --remove --push -o yaml" 'pushSecret:' |
|
24 |
+os::cmd::expect_success_and_not_text "oc set build-secret ${arg} mysecret --pull --local -o yaml | oc set build-secret --local -f - --remove --pull -o yaml" 'pullSecret:' |
|
25 |
+os::cmd::expect_success_and_not_text "oc set build-secret ${arg} mysecret --push --local -o yaml | oc set build-secret --local -f - --remove --source -o yaml" 'sourceSecret:' |
|
26 |
+# Server object tests |
|
27 |
+os::cmd::expect_success "oc create -f test/testdata/test-bc.yaml" |
|
28 |
+os::cmd::expect_success_and_text "oc set build-secret test-buildconfig mysecret --push" "updated" |
|
29 |
+os::cmd::expect_success_and_text "oc set build-secret bc/test-buildconfig mysecret --push" "was not changed" |
|
30 |
+os::cmd::expect_success_and_text "oc get bc/test-buildconfig -o yaml" "pushSecret:" |
|
31 |
+os::cmd::expect_success_and_text "oc set build-secret bc/test-buildconfig --push --remove" "updated" |
|
32 |
+os::cmd::expect_success_and_not_text "oc get bc/test-buildconfig -o yaml" "pushSecret:" |
|
33 |
+os::cmd::expect_success "oc delete bc/test-buildconfig" |
|
34 |
+echo "set build-secret: ok" |
|
35 |
+os::test::junit::declare_suite_end |