Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSD-19729: Enables ocm backplane login to provide default namespace as an argument #374

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

amej
Copy link
Contributor

@amej amej commented Mar 21, 2024

What type of PR is this?

  • feature
  • documentation
  • unit-test

What this PR does / Why we need it?

As a SRE, I want backplane login to prompt for a default namespace for me to run commands like oc debug node/xxx.

Which Jira/Github issue(s) does this PR fix?

Resolves #OSD-19729

Special notes for your reviewer

Once merged, ./ocm-backplane login --help will display

Running login command will send a request to backplane api
...
Usage:
  ocm-backplane login <CLUSTERID|EXTERNAL_ID|CLUSTER_NAME|CLUSTER_NAME_SEARCH> [flags]
...
Flags:
     -n,  --namespace string   Sets a default namespace for SRE to run commands like oc debug node/xxx
...  
Example: 
Considering cluster name as asathe-19729     

- Without options

./ocm-backplane login asathe-19729
oc project

Output will be

> _Using project "default" on server "https://api.stage.backplane.openshift.com/backplane/cluster/2afh53rispkj3vbsp6asa4f7hlpb78uv/"._

- By passing a valid kubernetes namespace to the option ' **_namespace_** '

./ocm-backplane login --namespace openshift-sre-pruning 28lje9u3jd59j3dmf36sojgpa32qrag3
oc project

Output will be
`_Using project "openshift-backplane-srep" on server "https://api.stage.backplane.openshift.com/backplane/cluster/2afh53rispkj3vbsp6asa4f7hlpb78uv/"._`

- By passing an **invalid  namespace** to the option ' **_namespace_** '

./ocm-backplane login --namespace "" asathe-19729


Following error  displayed.
_ERRO[0016]  is not a valid namespace_

./ocm-backplane login --namespace 'kube_system' asathe-19729

Following error  displayed.                                                                                                                                
ERRO[0012] kube_system is not a valid namespace

Hence, the command "oc status" will display the following error
error: Missing or incomplete configuration info. Please point to an existing, complete config file:

Please do refer to the prior discussion in the #315 .

Pre-checks (if applicable)

  • Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 21, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 21, 2024

@amej: This pull request references OSD-19729 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

What type of PR is this?

  • feature
  • documentation
  • unit-test

What this PR does / Why we need it?

As a SRE, I want backplane login to prompt for a default namespace for me to run commands like oc debug node/xxx.

Which Jira/Github issue(s) does this PR fix?

Resolves #OSD-19729

Special notes for your reviewer

Pre-checks (if applicable)

  • Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 21, 2024
Copy link
Contributor

openshift-ci bot commented Mar 21, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 22, 2024

@amej: This pull request references OSD-19729 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

What type of PR is this?

  • feature
  • documentation
  • unit-test

What this PR does / Why we need it?

As a SRE, I want backplane login to prompt for a default namespace for me to run commands like oc debug node/xxx.

Which Jira/Github issue(s) does this PR fix?

Resolves #OSD-19729

Special notes for your reviewer

Once merged, ./ocm-backplane login --help will display

Running login command will send a request to backplane api
...
Usage:
 ocm-backplane login <CLUSTERID|EXTERNAL_ID|CLUSTER_NAME|CLUSTER_NAME_SEARCH> [flags]
...
Flags:
    -n,  --namespace string   Sets a default namespace for SRE to run commands like oc debug node/xxx
...  
Global Flags:
...

Example:
Considering cluster ID is 28lje9u3jd59j3dmf36sojgpa32qrag3 .

  • Without options
./ocm-backplane login   28lje9u3jd59j3dmf36sojgpa32qrag3
oc project

Output will be

No project has been set. Pass a project name to make that the default.

  • With option ' namespace '
./ocm-backplane login --namespace openshift-sre-pruning   28lje9u3jd59j3dmf36sojgpa32qrag3
oc project

Output will be
_Using project "openshift-sre-pruning" on server "https://api.stage.backplane.openshift.com/backplane/cluster/28lje9u3jd59j3dmf36sojgpa32qrag3/"._

Please do refer to the prior discussion in the #315 .

Pre-checks (if applicable)

  • Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@amej amej marked this pull request as ready for review March 22, 2024 09:09
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 22, 2024
@openshift-ci openshift-ci bot requested review from bmeng and typeid March 22, 2024 09:09
@codecov-commenter
Copy link

codecov-commenter commented Mar 28, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 44.61%. Comparing base (6be5130) to head (62dc18b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #374      +/-   ##
==========================================
+ Coverage   44.50%   44.61%   +0.11%     
==========================================
  Files          62       62              
  Lines        5159     5173      +14     
==========================================
+ Hits         2296     2308      +12     
- Misses       2547     2548       +1     
- Partials      316      317       +1     
Files Coverage Δ
cmd/ocm-backplane/login/login.go 74.55% <86.66%> (+0.58%) ⬆️

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 29, 2024

@amej: This pull request references OSD-19729 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

What type of PR is this?

  • feature
  • documentation
  • unit-test

What this PR does / Why we need it?

As a SRE, I want backplane login to prompt for a default namespace for me to run commands like oc debug node/xxx.

Which Jira/Github issue(s) does this PR fix?

Resolves #OSD-19729

Special notes for your reviewer

Once merged, ./ocm-backplane login --help will display

Running login command will send a request to backplane api
...
Usage:
 ocm-backplane login <CLUSTERID|EXTERNAL_ID|CLUSTER_NAME|CLUSTER_NAME_SEARCH> [flags]
...
Flags:
    -n,  --namespace string   Sets a default namespace for SRE to run commands like oc debug node/xxx
...  
Global Flags:
...

Example:
Considering cluster ID is 28lje9u3jd59j3dmf36sojgpa32qrag3 .

  • Without options
./ocm-backplane login   28lje9u3jd59j3dmf36sojgpa32qrag3
oc project

Output will be

Using project "openshift-sre-pruning" on server "https://api.stage.backplane.openshift.com/backplane/cluster/28lje9u3jd59j3dmf36sojgpa32qrag3/".

  • With option ' namespace '
./ocm-backplane login --namespace openshift-sre-pruning   28lje9u3jd59j3dmf36sojgpa32qrag3
oc project

Output will be
_Using project "openshift-sre-pruning" on server "https://api.stage.backplane.openshift.com/backplane/cluster/28lje9u3jd59j3dmf36sojgpa32qrag3/"._

Please do refer to the prior discussion in the #315 .

Pre-checks (if applicable)

  • Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 29, 2024

@amej: This pull request references OSD-19729 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

What type of PR is this?

  • feature
  • documentation
  • unit-test

What this PR does / Why we need it?

As a SRE, I want backplane login to prompt for a default namespace for me to run commands like oc debug node/xxx.

Which Jira/Github issue(s) does this PR fix?

Resolves #OSD-19729

Special notes for your reviewer

Once merged, ./ocm-backplane login --help will display

Running login command will send a request to backplane api
...
Usage:
 ocm-backplane login <CLUSTERID|EXTERNAL_ID|CLUSTER_NAME|CLUSTER_NAME_SEARCH> [flags]
...
Flags:
    -n,  --namespace string   Sets a default namespace for SRE to run commands like oc debug node/xxx
...  
Global Flags:
...

Example:
Considering cluster ID is 28lje9u3jd59j3dmf36sojgpa32qrag3 .

  • Without options
./ocm-backplane login   28lje9u3jd59j3dmf36sojgpa32qrag3
oc project

Output will be

Using project "default" on server "https://api.stage.backplane.openshift.com/backplane/cluster/28lje9u3jd59j3dmf36sojgpa32qrag3/".

  • With option ' namespace '
./ocm-backplane login --namespace openshift-sre-pruning   28lje9u3jd59j3dmf36sojgpa32qrag3
oc project

Output will be
_Using project "openshift-sre-pruning" on server "https://api.stage.backplane.openshift.com/backplane/cluster/28lje9u3jd59j3dmf36sojgpa32qrag3/"._

Please do refer to the prior discussion in the #315 .

Pre-checks (if applicable)

  • Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@amej
Copy link
Contributor Author

amej commented Apr 1, 2024

@Tafhim , @supreeth7 and @devppratik : Please can you review ?

@samanthajayasinghe
Copy link
Contributor

@amej Can you pls squash the commits ?

@devppratik
Copy link
Contributor

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Apr 5, 2024
@amej
Copy link
Contributor Author

amej commented Apr 5, 2024

/label tide/merge-method-squash

@devppratik : Does this label free me up from the work of squashing commits locally on my laptop & force pushing them to the fork's feature branch?

@openshift-ci-robot
Copy link

openshift-ci-robot commented Apr 6, 2024

@amej: This pull request references OSD-19729 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

What type of PR is this?

  • feature
  • documentation
  • unit-test

What this PR does / Why we need it?

As a SRE, I want backplane login to prompt for a default namespace for me to run commands like oc debug node/xxx.

Which Jira/Github issue(s) does this PR fix?

Resolves #OSD-19729

Special notes for your reviewer

Once merged, ./ocm-backplane login --help will display

Running login command will send a request to backplane api
...
Usage:
 ocm-backplane login <CLUSTERID|EXTERNAL_ID|CLUSTER_NAME|CLUSTER_NAME_SEARCH> [flags]
...
Flags:
    -n,  --namespace string   Sets a default namespace for SRE to run commands like oc debug node/xxx
...  
Example: 
Considering cluster name as asathe-19729     

- Without options

./ocm-backplane login asathe-19729
oc project

Output will be

> _Using project "default" on server "https://api.stage.backplane.openshift.com/backplane/cluster/2afh53rispkj3vbsp6asa4f7hlpb78uv/"._

- By passing a valid kubernetes namespace to the option ' **_namespace_** '

./ocm-backplane login --namespace openshift-sre-pruning 28lje9u3jd59j3dmf36sojgpa32qrag3
oc project

Output will be
`_Using project "openshift-backplane-srep" on server "https://api.stage.backplane.openshift.com/backplane/cluster/2afh53rispkj3vbsp6asa4f7hlpb78uv/"._`

- By passing an invalid  namespace to the option ' **_namespace_** '

./ocm-backplane login --namespace "" asathe-19729
ERRO[0016] is not a valid namespace

./ocm-backplane login --namespace 'kube_system' asathe-19729
ERRO[0012] kube_system is not a valid namespace

Please do refer to  the prior discussion in the https://github.com/openshift/backplane-cli/pull/315  .

### Pre-checks (if applicable)

- [x] Ran unit tests locally
- [x] Validated the changes in a cluster
- [x] Included documentation changes with PR

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Apr 6, 2024

@amej: This pull request references OSD-19729 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

What type of PR is this?

  • feature
  • documentation
  • unit-test

What this PR does / Why we need it?

As a SRE, I want backplane login to prompt for a default namespace for me to run commands like oc debug node/xxx.

Which Jira/Github issue(s) does this PR fix?

Resolves #OSD-19729

Special notes for your reviewer

Once merged, ./ocm-backplane login --help will display

Running login command will send a request to backplane api
...
Usage:
 ocm-backplane login <CLUSTERID|EXTERNAL_ID|CLUSTER_NAME|CLUSTER_NAME_SEARCH> [flags]
...
Flags:
    -n,  --namespace string   Sets a default namespace for SRE to run commands like oc debug node/xxx
...  
Example: 
Considering cluster name as asathe-19729     

- Without options

./ocm-backplane login asathe-19729
oc project

Output will be

> _Using project "default" on server "https://api.stage.backplane.openshift.com/backplane/cluster/2afh53rispkj3vbsp6asa4f7hlpb78uv/"._

- By passing a valid kubernetes namespace to the option ' **_namespace_** '

./ocm-backplane login --namespace openshift-sre-pruning 28lje9u3jd59j3dmf36sojgpa32qrag3
oc project

Output will be
`_Using project "openshift-backplane-srep" on server "https://api.stage.backplane.openshift.com/backplane/cluster/2afh53rispkj3vbsp6asa4f7hlpb78uv/"._`

- By passing an **invalid  namespace** to the option ' **_namespace_** '

./ocm-backplane login --namespace "" asathe-19729


Following error  displayed.
_ERRO[0016]  is not a valid namespace_

./ocm-backplane login --namespace 'kube_system' asathe-19729

Following error  displayed.                                                                                                                                
ERRO[0012] kube_system is not a valid namespace

Hence, the command "oc status" will display the following error
error: Missing or incomplete configuration info. Please point to an existing, complete config file:

Please do refer to the prior discussion in the #315 .

Pre-checks (if applicable)

  • Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor Author

@amej amej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed the comments. 0560e97 contains the recommendations.

@samanthajayasinghe
Copy link
Contributor

@amej let me know if you need any help to squash the commit manually

cmd/ocm-backplane/login/login.go Outdated Show resolved Hide resolved
cmd/ocm-backplane/login/login.go Outdated Show resolved Hide resolved
cmd/ocm-backplane/login/login.go Outdated Show resolved Hide resolved
@amej amej requested a review from supreeth7 April 11, 2024 07:17
@amej
Copy link
Contributor Author

amej commented Apr 11, 2024

squash

@supreeth7 :
As my PR was showing 34 commits, on my current branch OSD-19729; I performed ' git rebase HEAD~34.
It showed me 54 items. I 'pick' first row & rest was 'squash' . I had to fix multiple merge commits during the rebase.
After rebasing my local branch OSD-19729 on top of the github based OSD-19729, I could push the changes.
Here is the current status with 35 commits : https://github.com/openshift/backplane-cli/pull/374/commits .

Copy link
Contributor Author

@amej amej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@supreeth7 : Changes reviewed and action taken including squashing commits locally & pushing them.

@supreeth7
Copy link
Contributor

@amej thanks for addressing the review comments.

The commit number is too wide for it to be merged, even with the tide plugin squashing it, can you try squashing your commits without any trailing commit history?

…f login

Signed-off-by: Ameya Sathe <asathe@redhat.com>
@amej
Copy link
Contributor Author

amej commented Apr 12, 2024

@amej Can you pls squash the commits ?

@supreeth7 : Please find a single commit now. I force pushed the changes to the OSD-19729 branch.

@amej
Copy link
Contributor Author

amej commented Apr 12, 2024

@amej thanks for addressing the review comments.

The commit number is too wide for it to be merged, even with the tide plugin squashing it, can you try squashing your commits without any trailing commit history?

@devppratik guided me to opt for the easy solution .
I opted to force push my changes to the OSD-19729 branch.
Now you will find a single commit .
Thank you for your patience.

Copy link
Contributor

openshift-ci bot commented Apr 12, 2024

@amej: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

@supreeth7 supreeth7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 12, 2024
Copy link
Contributor

openshift-ci bot commented Apr 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amej, supreeth7

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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 12, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 2154c96 into openshift:main Apr 12, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants