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

Plugins: Keep working when there is no internet access #77978

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

leventebalogh
Copy link
Contributor

@leventebalogh leventebalogh commented Nov 10, 2023

Related issues: #77905, https://github.com/grafana/support-escalations/issues/8305

What is the problem?

The "Add new connection" and "Plugins catalog" pages are not loading in case there is no internet access.

Why?

Although releasing #75272 made it possible to load these pages seamlessly in case the connection to GCOM times out, it didn't cater for any other network errors properly when fetching GCOM.

Solution

This PR is fixing the issue by not blocking the main UI flow in case the remote plugins are not available.

Testing

Tested the following flows manually:

  • The "Plugins Catalog" and the "Add new connection" pages are still working if there is no internet
  • The "Plugins Catalog" and the "Add new connection" pages do not hang if the GCOM connection is slow or times out. In case the connection is slow, then the remotely available plugins will load later.
  • The "Plugins Catalog" and the "Add new connection" operate correctly when there is internet connection

@mgyongyosi
Copy link
Contributor

@leventebalogh Can we move this feature behind a config option to disable the outgoing requests? (To prevent any failed requests if the customer knows that Grafana is running without internet access and/or in a restricted environment)

@leventebalogh
Copy link
Contributor Author

@mgyongyosi That might be a good idea for the future, however probably something that we should bring up in the plugins-platform team first to discuss it.

Copy link
Contributor

@mckn mckn left a comment

Choose a reason for hiding this comment

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

LGTM!

@leventebalogh leventebalogh force-pushed the leventebalogh/fix-catalog-when-no-internet branch from aebac4d to b0512cd Compare November 14, 2023 07:36
@leventebalogh leventebalogh modified the milestones: 10.3.x, 10.2.x Nov 14, 2023
@leventebalogh leventebalogh enabled auto-merge (squash) November 14, 2023 07:45
@leventebalogh leventebalogh modified the milestones: 10.2.x, 10.3.x Nov 14, 2023
@leventebalogh leventebalogh merged commit ea12eec into main Nov 14, 2023
15 checks passed
@leventebalogh leventebalogh deleted the leventebalogh/fix-catalog-when-no-internet branch November 14, 2023 07:49
Copy link
Contributor

The backport to v10.2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-77978-to-v10.2.x origin/v10.2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x ea12eecac593548b3c024b096cd6e4f329a6e532

When the conflicts are resolved, stage and commit the changes:

git add . && git cherry-pick --continue

If you have the GitHub CLI installed:

# Push the branch to GitHub:
git push --set-upstream origin backport-77978-to-v10.2.x
# Create the PR body template
PR_BODY=$(gh pr view 77978 --json body --template 'Backport ea12eecac593548b3c024b096cd6e4f329a6e532 from #77978{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title "[v10.2.x] Plugins: Keep working when there is no internet access" --body-file - --label "type/bug" --label "area/plugins" --label "area/frontend" --label "add to changelog" --label "area/plugins-catalog" --label "backport" --base v10.2.x --milestone 10.2.x --web

Or, if you don't have the GitHub CLI installed (we recommend you install it!):

# Push the branch to GitHub:
git push --set-upstream origin backport-77978-to-v10.2.x

# Create a pull request where the `base` branch is `v10.2.x` and the `compare`/`head` branch is `backport-77978-to-v10.2.x`.

# Remove the local backport branch
git switch main
git branch -D backport-77978-to-v10.2.x

@grafana-delivery-bot grafana-delivery-bot bot added the backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. label Nov 14, 2023
leventebalogh added a commit that referenced this pull request Nov 14, 2023
* fix: make connections and plugins-catalog work when GCOM is not available

* fix: remove unused import

(cherry picked from commit ea12eec)
leventebalogh added a commit that referenced this pull request Nov 14, 2023
)

Plugins: Keep working when there is no internet access (#77978)

* fix: make connections and plugins-catalog work when GCOM is not available

* fix: remove unused import

(cherry picked from commit ea12eec)
@aangelisc aangelisc modified the milestones: 10.3.x, 10.2.3 Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/frontend area/plugins area/plugins-catalog backport v10.2.x backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. type/bug
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants