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: Adjust GetFileType() function for new secret URI format #1507

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

ejlee3
Copy link
Contributor

@ejlee3 ejlee3 commented Sep 7, 2023

Closes #1504

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/device-sdk-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?)
  • 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?)

Testing Instructions

  1. Download compose file from edgex-compose
  2. Modify the go.mod for device-virtual to add this replace replace github.com/edgexfoundry/device-sdk-go/v3 => github.com/ejlee3/device-sdk-go/v3 v3.0.0-20230907221428-f6709ffcbf22 to use the new device-sdk.
  3. Build the docker image for device-virtual.
  4. Change the image name for device virtual to docker.io/edgexfoundry/device-virtual:0.0.0-dev and add the following variables to the edgex-compose/docker-compose.yml under device-virtual > environment to make no default profile and device are created
DEVICE_PROFILESDIR: ./res
DEVICE_DEVICESDIR: ./res
  1. Add http server service to the compose file and modify the volume mounts to the local system path. http-server.yml and all test files are attached
    httpd.zip

  2. Deploy EdgeX by above compose file.

  3. Create the following secret to device-virtual

POST https://localhost:8443/device-virtual/api/v3/secret
{
   "apiVersion":"v3",
   "secretName":"httpserver",
   "secretData":[
      {
        "key":"type",
        "value":"httpheader"
      },
      {
        "key":"headername",
        "value":"Authorization"
      },
      {
        "key":"headercontents",
        "value":"Basic ZWRnZXh1c2VyOmVkZ2V4cGFzc3dk"
      }
   ]
}
  1. check in the edgex-ui to ensure that there are no profiles/devices for device-virtual. If there are, delete them in the UI (Be sure to stop device-virtual first).
  2. Update variables Device > ProfilesDir and Device > DevicesDir with secure credentials URI from consul
ProfilesDir: http://httpd-auth:80/test_files/profile.json?edgexSecretName=httpserver
DevicesDir: http://httpd-auth:80/test_files/device.json?edgexSecretName=httpserver
  1. Restart device-virtual
  2. check in the edgex-ui to ensure that the profiles/devices get created

New Dependency Instructions (If applicable)

Closes edgexfoundry#1504

Signed-off-by: Elizabeth J Lee <elizabeth.j.lee@intel.com>
@codecov-commenter
Copy link

Codecov Report

Merging #1507 (f6709ff) into main (44a516e) will increase coverage by 0.03%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main    #1507      +/-   ##
==========================================
+ Coverage   46.56%   46.60%   +0.03%     
==========================================
  Files          30       30              
  Lines        2811     2813       +2     
==========================================
+ Hits         1309     1311       +2     
  Misses       1403     1403              
  Partials       99       99              
Files Changed Coverage Δ
internal/provision/profiles.go 43.00% <ø> (ø)
internal/provision/common.go 73.91% <100.00%> (+2.48%) ⬆️

📢 Have feedback on the report? Share it here.

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

@lenny-goodell lenny-goodell merged commit 88f0350 into edgexfoundry:main Sep 8, 2023
3 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.

Profiles didn't be created when setting URI for files with secure credentials on Device > ProfilesDir
3 participants