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

Feature/sc 121837/support local flash without internet access #678

Merged

Conversation

hugomontero
Copy link
Contributor

@hugomontero hugomontero commented Oct 3, 2023

Description

This PR will allow the use of flashing device os offline.
When the user downloads an specific device os version it will be cached in a file, then if the user tries to download it again without internet access, then the cli will looks into the cached file to try to flash the device.

How to Test

  1. Pull down the branch: git pull && git checkout feature/sc-121837/support-local-flash-without-internet-access
  2. Install dependencies: npm i
  3. Run tests: npm test
  4. Attempt to run steps with internet access
  5. Attempt to run steps without internet access
  6. Remove the device-os-version-cached.json from ~/.particle/device-os-flash/binaries
  7. Attempt to run steps without internet access
  8. Re-run step 4
  9. Delete the binaries from ~/.particle/device-os-flash/binaries/${version}/${platform}
  10. Attempt to run steps without internet access

Steps with internet access:

  • Update your device to:
    • latest: npm start -- update
    • specific target: npm start -- update --target 5.0.0

Steps Without internet access

  • Disconnect the client from internet
  • Update your device to:
    • latest: npm start -- update
    • specific target: npm start -- update --target 5.0.0

outcome

  • Tests should pass
  • Steps 4 and 5 should flash the device without issues and should create a new file in ~/.particle/device-os-flash/binaries named device-os-version-cached.json
  • Step 7 and 10 should show a message indicating: Device OS version not found in cache for platform: ${platformId} version: ${version} and there was an internet connection error

Related Issues / Discussions

Story details 👉 https://app.shortcut.com/particle/story/121837/support-local-flash-without-internet-access

Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA
  • Problem and solution clearly stated
  • Tests have been provided
  • Docs have been updated
  • CI is passing

@hugomontero hugomontero force-pushed the feature/sc-121837/support-local-flash-without-internet-access branch from 846d6b3 to ebb7ad3 Compare October 3, 2023 15:54
@hugomontero hugomontero marked this pull request as ready for review October 3, 2023 16:16
src/lib/device-os-version-cache.js Outdated Show resolved Hide resolved
src/lib/device-os-version-cache.js Outdated Show resolved Hide resolved
@hugomontero hugomontero removed the request for review from keeramis October 5, 2023 15:13
@hugomontero hugomontero force-pushed the feature/sc-121837/support-local-flash-without-internet-access branch from 851b69b to a0f63fd Compare October 11, 2023 21:21
@hugomontero hugomontero force-pushed the feature/sc-121837/support-local-flash-without-internet-access branch from a0f63fd to 3318a92 Compare October 11, 2023 21:39
Copy link
Member

@monkbroc monkbroc left a comment

Choose a reason for hiding this comment

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

I tested it. It works great now and we have a repeatable pattern for offline usage of the API!

src/lib/particle-cache.js Outdated Show resolved Hide resolved
@hugomontero hugomontero force-pushed the feature/sc-121837/support-local-flash-without-internet-access branch from 30ad319 to 99f43e0 Compare October 12, 2023 16:43
@hugomontero hugomontero merged commit d59c6c6 into master Oct 12, 2023
6 checks passed
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

2 participants