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

fix: update snap packaging #61

Merged
merged 16 commits into from
Feb 17, 2022

Conversation

siggiskulason
Copy link

@siggiskulason siggiskulason commented Feb 10, 2022

  • Add support for defining provision watcher directory
  • Add auto-scan script to snap
  • Add support in auto-configure script/command for providing Consul token
  • Update snap base to core 20
  • Update documentation
  • Update metadata and versioning
  • Add support for "snap set" of device-specific settings
  • Update install hook
  • Update make section in snapcraft.yaml
  • Other minor updates

Fix #55

See also: #52 for further information.

There is an issue with setting the subnet information using "snap set", which is unrelated to this PR - see edgexfoundry/go-mod-bootstrap#314

Signed-off-by: Siggi Skulason siggi.skulason@canonical.com

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/device-rfid-llrp-go/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?) N/A
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?) N/A

Testing Instructions

Install snap and run device discovery with

sudo snap remove edgexfoundry
sudo snap remove edgex-device-rfid-llrp
sudo snap install edgexfoundry --edge

snapcraft try
sudo snap try prime

sudo snap connect edgexfoundry:edgex-secretstore-token edgex-device-rfid-llrp:edgex-secretstore-token
sudo snap start edgex-device-rfid-llrp.device-rfid-llrp 
sudo snap connect edgex-device-rfid-llrp:network-control 
sudo snap connect edgex-device-rfid-llrp:network-observe 

CONSUL_TOKEN=$(sudo cat /var/snap/edgexfoundry/current/secrets/consul-acl-token/bootstrap_token.json | jq ".SecretID" | tr -d '"') 
echo $CONSUL_TOKEN

sudo edgex-device-rfid-llrp.auto-configure $CONSUL_TOKEN

I have verified that this detects my RFID reader.

New Dependency Instructions (If applicable)

@codecov-commenter
Copy link

Codecov Report

Merging #61 (0b05245) into main (fdb8dc9) will increase coverage by 0.02%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      edgexfoundry/device-rfid-llrp-go#61      +/-   ##
==========================================
+ Coverage   41.11%   41.13%   +0.02%     
==========================================
  Files          21       21              
  Lines        9012     9016       +4     
==========================================
+ Hits         3705     3709       +4     
- Misses       4138     4139       +1     
+ Partials     1169     1168       -1     
Impacted Files Coverage Δ
internal/driver/config.go 100.00% <ø> (ø)
internal/driver/driver.go 25.05% <0.00%> (-0.24%) ⬇️
internal/llrp/reader.go 41.24% <0.00%> (+0.44%) ⬆️
internal/retry/retry.go 93.12% <0.00%> (+1.52%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fdb8dc9...0b05245. Read the comment docs.

@siggiskulason siggiskulason changed the title [Draft] fix: updates to enable snap support fix: updates to snap packaging Feb 14, 2022
@siggiskulason siggiskulason changed the title fix: updates to snap packaging fix: update snap packaging Feb 14, 2022
@siggiskulason siggiskulason marked this pull request as ready for review February 14, 2022 22:37
@siggiskulason
Copy link
Author

@lenny-intel - Besides snap-specific changes, I made a couple of changes to driver.go and auto-configure.sh which you might want to review. Thanks.

Copy link
Member

@farshidtz farshidtz left a comment

Choose a reason for hiding this comment

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

Thanks a lot @siggiskulason for the updates. I've added some inline comments. Apart from those, I suggest following updates:

  1. Update github.com/canonical/edgex-snap-hooks/v2 so that it includes bug fixes and better error logging (e.g. when setting wrong config option key).
  2. The snap readme describes installation from 2.0 (Ireland) channel which doesn't exist. Please remove that part until we actually have a v2 channel and tag; see Tagging for v2 #63
  3. Reduce the content of "Using a content interface to set device configuration" section under snap readme to:
The `device-config` content interface allows another snap to seed this snap with configuration directories under `$SNAP_DATA/config/device-rfid-llrp`.

Note that the `device-config` content interface does NOT support seeding of the Secret Store Token because that file is expected at a different path.

Please refer to [edgex-config-provider](https://github.com/canonical/edgex-config-provider), for an example and further instructions.

snap/snapcraft.yaml Outdated Show resolved Hide resolved
snap/local/hooks/cmd/install/install.go Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
snap/snapcraft.yaml Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
internal/driver/driver.go Show resolved Hide resolved
@siggiskulason
Copy link
Author

  • Update github.com/canonical/edgex-snap-hooks/v2 so that it includes bug fixes and better error logging (e.g. when setting wrong config option key).

Updated to

require github.com/canonical/edgex-snap-hooks/v2 v2.1.3

Updated

@siggiskulason
Copy link
Author

@lenny-intel / @farshidtz - Thanks for the review. I have implemented all requested changes. Could you please re-review and approve if there are no other change requests? Thanks!

Siggi Skulason and others added 14 commits February 16, 2022 14:58
- Add support for defining provision watcher directory
- Adding auto-scan script to snap
- Adding support for Consul token to auto-scan script
- Other minor changes

See also: edgexfoundry#52

Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
various updates to snapcraft.yaml

Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Further updates to snapcraft.yaml

Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Further updates

Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Co-authored-by: Farshid Tavakolizadeh <email@farshid.ws>
Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Co-authored-by: Farshid Tavakolizadeh <email@farshid.ws>
Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
@siggiskulason
Copy link
Author

I had to force-push an update - it seems that when I used the Github UI to accept changes suggested, Github created commits that were not signed, so that broke the DCO test.

lenny-goodell
lenny-goodell previously approved these changes Feb 16, 2022
Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM, from my perspective. I'll let the other snap experts approve before merging.

snap/snapcraft.yaml Outdated Show resolved Hide resolved
snap/README.md Outdated Show resolved Hide resolved
snap/README.md Outdated Show resolved Hide resolved
snap/README.md Outdated Show resolved Hide resolved
Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
@siggiskulason
Copy link
Author

@farshidtz - I've pushed a commit with your requested changes. Please re-review.

Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
Copy link
Member

@farshidtz farshidtz left a comment

Choose a reason for hiding this comment

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

Thanks. Looks good now.

I don't have the actual device and reviewed only the packaging and runtime of the snap.

@lenny-goodell lenny-goodell merged commit 4e518ee into edgexfoundry:main Feb 17, 2022
@siggiskulason
Copy link
Author

Thanks @lenny-intel / @farshidtz

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.

[LLRP Device] Update snaps for a Jakarta Release
4 participants