Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Add docs notification if GitHub oAuth is not setup #969

Merged
merged 4 commits into from
Feb 3, 2021
Merged

Conversation

vinokurig
Copy link
Contributor

@vinokurig vinokurig commented Jan 22, 2021

What does this PR do?

  • If GitHub oauth is not set-up, show a notification with a link to a guide how to set-up GitHub identity provider in keycloak in Che docs page.
  • Fix authentication mechanism (if Che user token is expired, retrieve it again), little refactoring.

Screenshot/screencast of this PR

What issues does this PR fix or reference?

fixes eclipse-che/che#18237

How to test this PR?

  1. Run Che with quay.io/eclipse/che-server:nightly image. It contains the authentication fix
  2. Create and open a workspace from dev-file:
apiVersion: 1.0.0
metadata:
  name: testnjz3q
components:
  - type: cheEditor
    reference: 'https://raw.githubusercontent.com/chepullreq4/pr-check-files/master/che-theia/pr-969/che_theia_meta.yaml'
  - id: github/vscode-pull-request-github/latest
    type: chePlugin
projects:
  - name: environment-variable
    source:
      location: 'https://github.com/vinokurig/environment-variable.git'
      type: git
  1. Try to login the GitHub PR plugin:
    screenshot-serverkcgc53mh-che-dev-server-3010 192 168 99 254 nip io-2021 01 22-13_21_04
  2. See the notification:
    screenshot-serverkcgc53mh-che-dev-server-3010 192 168 99 254 nip io-2021 01 22-13_23_02

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

Happy Path Channel

HAPPY_PATH_CHANNEL=stable

@che-bot
Copy link
Contributor

che-bot commented Jan 22, 2021

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:969
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:969

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

@sunix
Copy link
Contributor

sunix commented Jan 22, 2021

I suggest something like that:

Could not start the Github Pull Request plugin. The setup for Github OAuth provider is not complete.

And only single button: Open the setup instructions page

@vinokurig
Copy link
Contributor Author

@sunix

I suggest something like that:

Could not start the Github Pull Request plugin. The setup for Github OAuth provider is not complete.

It is not specific to the Github Pull Requests plugin so I would keep only: The setup for Github OAuth provider is not complete.

And only single button: Open the setup instructions page

Notification buttons are not very flexible in theia, so it will look like:
screenshot-che-eclipse-che 192 168 99 254 nip io-2021 01 26-15_42_00

@vinokurig
Copy link
Contributor Author

@benoitf @l0rd Could you please take a look?

if (this.machineToken && this.machineToken.length > 0) {
const timer = setTimeout(() => {
this.messageService.warn(
'Authentication is taking too long, the oauth pop-up may be blocked by your browser, ' +
Copy link
Member

Choose a reason for hiding this comment

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

oauth -> OAuth

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

const timer = setTimeout(() => {
this.messageService.warn(
'Authentication is taking too long, the oauth pop-up may be blocked by your browser, ' +
'if so, allow popup windows for the current url and restart the workspace'
Copy link
Member

Choose a reason for hiding this comment

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

popup -> pop-up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

) {
theia.commands.executeCommand(
'theia.open',
'https://www.eclipse.org/che/docs/che-7/administration-guide/configuring-authorization/#configuring-github-oauth_che'
Copy link
Member

Choose a reason for hiding this comment

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

Is it the correct link for the downstream as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the eclipse docs page is relevant for downstream as well.

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

hm.. for some reasons, I see a bit different PULL REQUEST view
image

@vinokurig
Copy link
Contributor Author

@azatsarynnyy Looks like there is no git project in your workspace. It's my mistake, I haven't included it to the example devfile, now it is updated :).

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

The flow works as described. Thanks!

@che-bot
Copy link
Contributor

che-bot commented Jan 27, 2021

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:969
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:969

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

@che-bot
Copy link
Contributor

che-bot commented Jan 28, 2021

❌ E2E Happy path tests failed ❗

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:969
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:969

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

@vinokurig
Copy link
Contributor Author

[crw-ci-test]

@azatsarynnyy
Copy link
Member

fyi: HappyPath running depends on the fix eclipse-che/che#18918

@dmytro-ndp
Copy link
Contributor

[crw-ci-test]

@che-bot
Copy link
Contributor

che-bot commented Jan 29, 2021

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:969
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:969

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

@sunix
Copy link
Contributor

sunix commented Jan 29, 2021

@sunix

I suggest something like that:
Could not start the Github Pull Request plugin. The setup for Github OAuth provider is not complete.

It is not specific to the Github Pull Requests plugin so I would keep only: The setup for Github OAuth provider is not complete.

And only single button: Open the setup instructions page

Notification buttons are not very flexible in theia, so it will look like:
screenshot-che-eclipse-che 192 168 99 254 nip io-2021 01 26-15_42_00

@vinokurig
in the message you have to tell

  1. the problem (it could not go through the auth with github)
  2. the cause (in our case the setup is not complete)
  3. the solution (in our case the button to open the setup instruction)

OK so something like

Che could not authenticate to your Github account. The setup for Github OAuth provider is not complete.

For the button, avoid ...
So this should be enough: Setup instructions

@vinokurig
Copy link
Contributor Author

@sunix
I like your message, applied it, thanks

@che-bot
Copy link
Contributor

che-bot commented Jan 29, 2021

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:969
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:969

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

@che-bot
Copy link
Contributor

che-bot commented Jan 29, 2021

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:969
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:969

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

@vinokurig vinokurig merged commit 194c05c into master Feb 3, 2021
@vinokurig vinokurig deleted the che-18237 branch February 3, 2021 11:59
@che-bot che-bot added this to the 7.26 milestone Feb 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check if the GitHub oAuth is available when asking to sign in the Pull Requests plugin
5 participants