-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUGFIX: Make OCM environment inside of container ephemeral
This fixes a bug in ocm-container where the ocm environment was being read differently by the ocm cli and rosa cli due to the way ocm-container used the OCM_URL environment variable. This PR will now set the environment inside the container to be, in this order: * set by the OCM_CONFIG environment variable (eg: `OCM_CONFIG=~/.config/ocm/ocm.json.stage ocm-container`) * `OCMC_OCM_URL` environment varible * the `--ocm-url` flaga (`ocm-container --ocm-url poduction`) * default: prod Upon running ocm-container, ocm-contianer will determine if the user is logged in, using the external OCM config file provide, and then authenticate if needed. It will then copy the OCM config to a file alongside any existing OCM config in the format `ocm.json.ocm-container.$ocm_env`. This file can be reused with ocm-container as the OCM_CONFIG env (or not), if desired. The contents of the new config file are copied into the contianer before it is launched, ensuring that the container is ephemeral, and no changes outside or inside the container change each other. This setup has been tested to confirm ROSA is using the correct OCM URL. You will need to build and use a new OCM Container image that include the Containerfile changes in this PR in order to test it properly, and when merged, users will need to use the newly built image with the new binary. A new 4.0.1 release should be cut with the contents of this when approved, and version 4.0.0 deleted/removed. Fixes OSD-25064 Signed-off-by: Chris Collins <[email protected]>
- Loading branch information
Showing
6 changed files
with
118 additions
and
48 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# shellcheck shell=bash | ||
export PS1="[\W {\[\033[1;32m\]\${OCM_URL}\[\033[0m\]} \$(kube_ps1)]\$ " | ||
export PS1="[\W {\[\033[1;32m\]\$(ocm config get url)\[\033[0m\]} \$(kube_ps1)]\$ " | ||
export KUBE_PS1_BINARY=oc | ||
export KUBE_PS1_CLUSTER_FUNCTION=cluster_function | ||
export KUBE_PS1_SYMBOL_ENABLE=false | ||
export KUBE_PS1_SYMBOL_ENABLE=false |