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

Use a version constant instead of parsing gemspec #23

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

DerekStride
Copy link
Contributor

Issue

When deploying an application to a container that doesn't contain git the passage client throws an error when trying to add the version number to the header.

gemspec = File.join(__dir__, "../../passageidentity.gemspec")
spec = Gem::Specification.load(gemspec)
headers = { "Passage-Version" => "passage-ruby #{spec.version}" }

This line calls out to the shell to run the git ls-files command:

`git ls-files -z`.split("\x0").reject do |f|

Error

(ruby) spec = Gem::Specification.load(gemspec)
Invalid gemspec in [/app/vendor/bundle/ruby/3.2.0/gems/passageidentity-0.2.3/lib/passageidentity/../../passageidentity.gemspec]:
No such file or directory - git

Solution

This PR changes this project to use the more standard RubyGems approach to have a VERSION constant defined and loaded in the gemspec. I've tested my fork on my application and it seems to work as expected.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@DerekStride DerekStride force-pushed the main branch 2 times, most recently from 0304fe0 to 331126a Compare November 27, 2023 18:18
@DerekStride
Copy link
Contributor Author

@vanessa-passage Would I be able to get a review on this PR? Without it it's hard to deploy to a containerized environment.

@DerekStride
Copy link
Contributor Author

The test failures seem to be related to my fork not including the expected environment variables:

env:
  API_KEY: 
  APP_ID: 
  PSG_JWT: 
  TEST_USER_ID: 

Copy link
Contributor

@vanessa-passage vanessa-passage left a comment

Choose a reason for hiding this comment

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

@DerekStride looks good!
Tested locally, all tests are passing.

Copy link
Contributor

@vanessa-passage vanessa-passage left a comment

Choose a reason for hiding this comment

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

Sorry for the request after the approval. Can you revert the version bump?

Copy link

sonarqubecloud bot commented Dec 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Contributor Author

@DerekStride DerekStride left a comment

Choose a reason for hiding this comment

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

All good, I've updated the PR, should be good to go. Let me know if there's anything else I can update.

Copy link
Contributor

@vanessa-passage vanessa-passage left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@vanessa-passage vanessa-passage merged commit 612b07e into passageidentity:main Dec 1, 2023
2 of 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.

2 participants