openshift / ocm-container

Containerized environment for accessing OpenShift v4 clusters, packing necessary tools/scripts
Apache License 2.0
10 stars 63 forks source link

BUGFIX: Make OCM environment inside of container ephemeral #302

Closed clcollins closed 2 months ago

clcollins commented 2 months ago

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:

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 collins.christopher@gmail.com

samanthajayasinghe commented 2 months ago

/lgtm

openshift-ci[bot] commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clcollins, samanthajayasinghe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/openshift/ocm-container/blob/master/OWNERS)~~ [clcollins] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment