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

Feat: add no-interactive flag for upgrade.php #14578

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

Q4kK
Copy link
Contributor

@Q4kK Q4kK commented Apr 9, 2024

Having a no-interactive flag is useful because attempting to automate snipe-it upgrades is currently very janky. You have to either:
a) read the prompts and pass in the input (the "correct" way)
a) pipe in input, e.g. yes and hope no new prompts are added.

With a no-interactive flag, this can be fixed by both allowing new prompts to be added without conflict
to user prompts, but also allowing automated upgrades (you could choose to crash, or assign defaults).

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context, providing screenshots where practical. List any dependencies that are required for this change.

Feature addition to upgrade.php, no issue found that could be relevant in fixing.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Run upgrade.php and upgrade.php --no-interactive on any SnipeIT supported php version. --no-interactive runs the upgrade without needing the confirmation prompt.

Test Configuration:

  • PHP version: 8.1
  • MySQL version: 15.1
  • Webserver version: 6.3.4
  • OS version: Debian 11

Checklist:

@Q4kK Q4kK requested a review from snipe as a code owner April 9, 2024 19:21
Copy link

welcome bot commented Apr 9, 2024

💖 Thanks for this pull request! 💖

We use semantic commit messages to streamline the release process and easily generate changelogs between versions. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix if it doesn't have one already.

Examples of commit messages with semantic prefixes:

  • Fixed #<issue number>: don't overwrite prevent_default if default wasn't prevented
  • Added #<issue number>: add checkout functionality to assets
  • Improved Asset Checkout: use new notification method for checkout

Things that will help get your PR across the finish line:

  • Document any user-facing changes you've made.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

Copy link

what-the-diff bot commented Apr 9, 2024

PR Summary

  • Introduction of a New Variable $no_interactive
    A new variable $no_interactive has been included in the codebase. This variable enables or disables the interactive prompts based on its state.

  • Conditional Logic for Interactive Prompts
    The code now contains a condition that checks the status of the $no_interactive variable. Should this variable hold a true value, the software will bypass interactive user prompts, aiding in smoother, uninterrupted workflows.

@snipe
Copy link
Owner

snipe commented Apr 16, 2024

Hey there - can you retarget this to develop, per our developer documentation?

@Q4kK Q4kK changed the base branch from master to develop April 16, 2024 16:53
Having a no-interactive flag is useful because attempting
to automate snipe-it upgrades is currently extremely janky.
You have to either:
  a) read the prompts and pass in the input (the "correct" way)
  b) pipe in input, e.g. `yes` and hope no new prompts
  are added.

With the `no-interactive` flag, this can be fixed by both
allowing new prompts to be added without conflict
to user prompts, but also allowing automated upgrades (you could
choose to crash, or assign defaults).
@Q4kK Q4kK force-pushed the features/add_no_interactive branch from 65c0d2c to 20920c2 Compare April 16, 2024 16:56
@Q4kK
Copy link
Contributor Author

Q4kK commented Apr 16, 2024

Apologies, should be on develop now.

@snipe snipe merged commit f080c0c into snipe:develop Apr 18, 2024
2 checks passed
Copy link

welcome bot commented Apr 18, 2024

Congrats on merging your first pull request! 🎉🎉🎉

@kurthuber-dev
Copy link

@Q4kK

Hello, I would like to use this feature to automate my SnipeIT updates, but unfortunately the argument does not work properly for me
I get the following message

Am I doing something wrong?
image

@snipe
Copy link
Owner

snipe commented May 13, 2024

@kurthuber-dev did you try doing a git pull first? It's possible the version of Snipe-IT you have doesn't yet support this, so you might need to pull the latest and then retry the --no-interactive flag.

@kurthuber-dev
Copy link

@kurthuber-dev did you try doing a git pull first? It's possible the version of Snipe-IT you have doesn't yet support this, so you might need to pull the latest and then retry the --no-interactive flag.

now it works, thanks a lot

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.

None yet

3 participants