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(jsonschema): corrects the regex for device volume paths #268

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

pallabpain
Copy link
Member

@pallabpain pallabpain commented Feb 4, 2024

Description

The regex for device volume mount and subpath does not account for files and only accepts directories. However, this is not the expectation as we can mount either files or directories. This commit corrects the regex.

Referring a regex found here: https://regex101.com/r/wal8VG/33

Wrike Ticket: https://www.wrike.com/open.htm?id=1295041413

Testing

Manifest

apiVersion: apiextensions.rapyuta.io/v1
kind: Deployment
metadata:
  name: gateway
  depends:
    kind: package
    nameOrGUID: gateway
    version: "1.0.0"
spec:
  runtime: device
  device:
    depends:
      kind: device
      nameOrGUID: "{{ device.edge.name }}"
  volumes:
    - execName: "gateway"
      mountPath: "/etc/caddy/config.json"
      subPath: "/opt/rapyuta/configs/gateway/config.json"
    - execName: "gateway"
      mountPath: "/etc/caddy/Caddyfile"
      subPath: "/opt/rapyuta/configs/gateway/preseed.yaml"
  features:
    params:
      enabled: true
      trees:
        - gateway

Error

→ rio apply templates/server/gateway.yaml -v values.sample.yaml --dryrun
----- Files Processed ----
/home/pallab/workspace/go/src/github.com/rapyuta-robotics/rr_oks_deploy/templates/server/gateway.yaml
                       Resource Context
--------------------  ------------------
Expected Time (mins)         4.13
Files                         1
Resources                     2
                                                                                                                                                                                                             
Resource            Action     Expected Time (mins)
------------------  --------  ----------------------
package:gateway     CREATE             0.05
device:edge01       UPDATE             0.08
deployment:gateway  CREATE              4
                                                                                                                                                                                                             
>> ⏳ Create package:gateway                                                                                                                                                [2024-02-04T12:33:06.055096]
[Err] Object "deployment:gateway" apply failed. Apply will not progress further.
❌ Apply failed. Error: {'runtime': 'device', 'device': {'depends': {'kind': 'device', 'nameOrGUID': 'edge01', 'guid': '6fad178d-fbe8-4cde-add5-64ef63dbe8d1'}}, 'volumes': [{'execName': 'gateway', 'mountPath': '/etc/caddy/config.json', 'subPath': '/opt/rapyuta/configs/gateway/config.json'}, {'execName': 'gateway', 'mountPath': '/etc/caddy/Caddyfile', 'subPath': '/opt/rapyuta/configs/gateway/preseed.yaml'}], 'features': {'params': {'enabled': True, 'trees': ['gateway']}}} is not valid under any of the given schemas

Fix

→ pipenv run python -m riocli apply ~/workspace/go/src/github.com/rapyuta-robotics/rr_oks_deploy/templates/server/gateway.yaml -v ~/workspace/go/src/github.com/rapyuta-robotics/rr_oks_deploy/values.sample.yaml --dryrun
----- Files Processed ----
/home/pallab/workspace/go/src/github.com/rapyuta-robotics/rr_oks_deploy/templates/server/gateway.yaml
                       Resource Context
--------------------  ------------------
Expected Time (mins)         4.13
Files                         1
Resources                     2
                                                                                                                                                                                                                                                      
Resource            Action     Expected Time (mins)
------------------  --------  ----------------------
package:gateway     CREATE             0.05
device:edge01       UPDATE             0.08
deployment:gateway  CREATE              4
                                                                                                                                                                                                                                                      
>> ⏳ Create package:gateway                                                                                                                                                                                         [2024-02-04T12:33:44.907066]
>> ⏳ Create deployment:gateway                                                                                                                                                                                      [2024-02-04T12:33:45.538051]
✅ Apply successful. (0:00:01.59)

@pallabpain pallabpain requested review from a team as code owners February 4, 2024 07:00
@pallabpain pallabpain self-assigned this Feb 4, 2024
@pallabpain pallabpain added the 🐛 bug Something isn't working label Feb 4, 2024
Copy link

github-actions bot commented Feb 4, 2024

🤖 Pull Request Artifacts (#7772349555) 🎉

The regex for device volume mount and subpath does not account for files
and only accepts directories. However, this is not the expectation as we
can mount either files or directories. This commit corrects the regex.

Wrike Ticket: https://www.wrike.com/open.htm?id=1295041413
Copy link

github-actions bot commented Feb 4, 2024

🤖 Pull Request Artifacts (#7772444742) 🎉

@pallabpain pallabpain merged commit fd2a881 into devel Feb 5, 2024
6 checks passed
rr-github-ci-user pushed a commit that referenced this pull request Feb 6, 2024
## [7.0.3](v7.0.2...v7.0.3) (2024-02-06)

### Bug Fixes

* **jsonschema:** corrects the regex for device volume paths ([#268](#268)) ([fd2a881](fd2a881))
@rr-github-ci-user
Copy link
Collaborator

🎉 This PR is included in version 7.0.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

RomilShah pushed a commit that referenced this pull request Apr 23, 2024
The regex for device volume mount and subpath does not account for files
and only accepts directories. However, this is not the expectation as we
can mount either files or directories. This commit corrects the regex.

Wrike Ticket: https://www.wrike.com/open.htm?id=1295041413
RomilShah pushed a commit that referenced this pull request Apr 23, 2024
## [7.0.3](v7.0.2...v7.0.3) (2024-02-06)

### Bug Fixes

* **jsonschema:** corrects the regex for device volume paths ([#268](#268)) ([fd2a881](fd2a881))
@ankitrgadiya ankitrgadiya deleted the fix/device-vol-path branch May 28, 2024 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants