Skip to content

feat: added support to install manually install plugins#810

Closed
philprime wants to merge 2 commits into
pulumi:masterfrom
kula-app:pr-manual-plugins-install
Closed

feat: added support to install manually install plugins#810
philprime wants to merge 2 commits into
pulumi:masterfrom
kula-app:pr-manual-plugins-install

Conversation

@philprime

@philprime philprime commented Dec 23, 2022

Copy link
Copy Markdown

This adds the option to manually install Pulumi plugins.

We are currently using this Sentry plugin and repeatedly noticed the following issue:

Logging into the Pulumi Service backend.
pulumi preview on shared
  Error: code: -2
   stdout: 
   stderr: Command failed with exit code 255: pulumi preview --parallel 2147483647 --exec-agent pulumi/actions@v3 --color auto --exec-kind auto.local --event-log /tmp/automation-logs-preview-7OA2LT/eventlog.txt --stack shared --non-interactive
  error: could not load plugin for sentry provider 'urn:pulumi:shared::***-cloud::pulumi:providers:sentry::default_0_0_8_github_/api.github.com/pulumiverse': Could not automatically download and install resource plugin 'pulumi-resource-sentry' at version v0.0.8, install the plugin using `pulumi plugin install resource sentry v0.0.8`.
  Underlying error: error downloading plugin sentry to file: failed to download plugin: sentry-0.0.8: 403 HTTP error fetching plugin from https://get.pulumi.com/releases/plugins/pulumi-resource-sentry-v0.0.8-linux-amd64.tar.gz
  Previewing update (shared)
  
  View Live: https://app.pulumi.com/***/***-cloud/shared/previews/1e8ae06b-b2c3-49f0-b91f-db8ab01[35](https://github.com/kula-app/kula-mono-repo/actions/runs/3764563516/jobs/6399153978#step:11:36)54b

  @ Previewing update..........

As the log also states, as automatically installing the plugin failed, we are changing our workflow to manually install this specific plugin. Due to action re-installing the pulumi CLI in our Docker-based GitHub Actions, we want to install the plugins right before running other commands. EDIT: after looking further into the code, I realized only ~/.pulumi/bin is deleted by this step, and not the full pulumi installation folder

Therefore this adds the option to declare a list of plugins to manually install.
As nested array objects are not supported by GitHub Actions, we decided to use a YAML-string and parse it at runtime instead.

@philprime philprime force-pushed the pr-manual-plugins-install branch from 31af32b to 95d2149 Compare December 23, 2022 10:51
@philprime philprime changed the title feat: added support to install manually install plugins WIP: feat: added support to install manually install plugins Dec 23, 2022
@philprime

Copy link
Copy Markdown
Author

Changing this to WIP as we have noticed issues with installing the plugins

@philprime philprime changed the title WIP: feat: added support to install manually install plugins feat: added support to install manually install plugins Dec 23, 2022
@philprime

philprime commented Dec 23, 2022

Copy link
Copy Markdown
Author

After tinkering with the issue more, I realized that the main issue wasn't the installation from other sources, but the rate-limit of GitHub.
Therefore we fixed the issue on our end, by installing the plugin in another GitHub Action step:

- run: |
    pulumi plugin rm resource sentry --yes
    wget https://github.com/pulumiverse/pulumi-sentry/releases/download/v0.0.8/pulumi-resource-sentry-v0.0.8-linux-amd64.tar.gz
    pulumi plugin install resource \
      sentry v0.0.8 \
      --file pulumi-resource-sentry-v0.0.8-linux-amd64.tar.gz

Still if you want to add the option to install plugins from this step, I am happy to contribute

@simenandre simenandre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for this contribution! 🙏

I have left some notes that I would love for you to look at. I think this change really make sense 👍

Comment thread action.yml
description: 'Colorize output. Choices are: always, never, raw, auto'
required: false
default: 'auto'
manual-plugins:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we should name this config key plugins?

I'm not sure we can call them manual plugins. AFAIK, They are plugins that don't have an install script, we need to manually install them.

Comment thread package.json
"dedent": "^0.7.0",
"envalid": "^7.3.1",
"got": "^11.8.6",
"js-yaml": "^4.1.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We already have yaml installed; would it make sense to use yaml?

If you feel js-yaml is an improvement, feel free to open a separate PR on that 👍

Comment thread src/main.ts
core.debug('Configuration is loaded');

await pulumiCli.downloadCli(config.options.pulumiVersion);
await pulumiCli.installManualPlugins(config.manualPlugins);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
await pulumiCli.installManualPlugins(config.manualPlugins);
if (config.manualPlugins) {
await pulumiCli.installManualPlugins(config.manualPlugins);
}

@Moon1706

Copy link
Copy Markdown
Contributor

Hello folks!
I think we can use the build-in functionality of @pulumi/pulumi/automation. This option allows us to make code clearer.

My suggestion.

@philprime

Copy link
Copy Markdown
Author

The build-in functionality seems cleaner to me too.

@philprime

Copy link
Copy Markdown
Author

We are not using this functionality internally anymore, therefore I will close this PR now.
If you still want this implemented, let me know and I will apply the requested changes.

@philprime philprime closed this May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants