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

feat(dojoup): remove jq dependency #847

Merged
merged 2 commits into from
Aug 29, 2023
Merged

Conversation

lambda-0x
Copy link
Contributor

Fix: #839

@tarrencev
Copy link
Contributor

Will this update avoid installing rereleases by default?

@lambda-0x
Copy link
Contributor Author

lambda-0x commented Aug 29, 2023

@tarrencev this update shouldn't change the behavior at all, it just uses grep to extract github tag instead of using jq

only new assumption made here is that we won't make prerelease release with format vX.X.X (currently we publish Nightly releases as prerelease)

@tarrencev
Copy link
Contributor

@tarrencev this update shouldn't change the behavior at all, it just uses grep to extract github tag instead of using jq

only new assumption made here is that we won't make prerelease release with format vX.X.X (currently we publish Nightly releases as prerelease)

Hm I think that assumption will break. We can avoid it with:

cat releases.json | grep -Eo '"tag_name": "[^"]*"|"prerelease": (true|false)' | grep -A1 '"tag_name":' | grep -B1 '"prerelease": false' | grep '"tag_name":' | cut -d':' -f2 | tr -d '"'

You can verify with the releases here: https://api.github.com/repos/dojoengine/dojo/releases

@ptisserand
Copy link
Contributor

only new assumption made here is that we won't make prerelease release with format vX.X.X (currently we publish Nightly releases as prerelease)

That's why I suggested to use releases/latest :

View the latest published full release for the repository.

The latest release is the most recent non-prerelease, non-draft release, sorted by the created_at attribute. The created_at attribute is the date of the commit used for the release, and not the date when the release was drafted or published.

The potential issue I think about is dojoup will install the latest release even if it's a maintenance release:

  • v2.0.1 is available
  • v1.2.3 is released for maintenance purpose
    => v1.2.3 will be installed by script if commit is more recent than v2.0.1

@tarrencev
Copy link
Contributor

only new assumption made here is that we won't make prerelease release with format vX.X.X (currently we publish Nightly releases as prerelease)

That's why I suggested to use releases/latest :

View the latest published full release for the repository.

The latest release is the most recent non-prerelease, non-draft release, sorted by the created_at attribute. The created_at attribute is the date of the commit used for the release, and not the date when the release was drafted or published.

The potential issue I think about is dojoup will install the latest release even if it's a maintenance release:

  • v2.0.1 is available
  • v1.2.3 is released for maintenance purpose
    => v1.2.3 will be installed by script if commit is more recent than v2.0.1

Ah sorry I missed your feedback. That seems like the most robust approach

@lambda-0x
Copy link
Contributor Author

lambda-0x commented Aug 29, 2023

@ptisserand we cannot use /releases/latest because it only returns the latest release which can be a vX.X.X-alpha.x release which we don't want in stable version.

And we want the latest non-prerelease, non-alpha release. Is there any way to just get latest release which has tag_name in format vX.X.X?

@lambda-0x
Copy link
Contributor Author

lambda-0x commented Aug 29, 2023

@tarrencev this update shouldn't change the behavior at all, it just uses grep to extract github tag instead of using jq
only new assumption made here is that we won't make prerelease release with format vX.X.X (currently we publish Nightly releases as prerelease)

Hm I think that assumption will break. We can avoid it with:

cat releases.json | grep -Eo '"tag_name": "[^"]*"|"prerelease": (true|false)' | grep -A1 '"tag_name":' | grep -B1 '"prerelease": false' | grep '"tag_name":' | cut -d':' -f2 | tr -d '"'

You can verify with the releases here: https://api.github.com/repos/dojoengine/dojo/releases

looks like we have a regex wizard here, smart use of -A1 -B1 feature!

@lambda-0x
Copy link
Contributor Author

cat release.json | grep -oE '"tag_name": "[^"]*"|"prerelease": (true|false)' | grep -B1 '"prerelease": false' | grep '"tag_name":' | grep -oP '"v[0-9]*\.[0-9]*\.[0-9]*"' | tr -d '"' | head -n 1

@tarrencev cleaned it up a bit and fixed it to not include vX.X.X-alpha.x releases in there (which is the current behavior). How does this look?

NOTE: Just released there isn't a way to install -alpha.x releases without specifying the full version, which seems okay because alpha releases are only supposed to be used if you are sure you want them.

@ptisserand
Copy link
Contributor

@ptisserand we cannot use /releases/latest because it only returns the latest release which can be a vX.X.X-alpha.x release which we don't want in stable version.

@lambda-0x Sorry for my mistake: I didn't get the point that the behavior of dojoup need to be modified with jq removing.

I suggest to update this comment:

# Fetch the list of releases from the GitHub API and get the first non-prerelease

@lambda-0x
Copy link
Contributor Author

good point, updated the comment.

@tarrencev tarrencev merged commit 857cbc3 into dojoengine:main Aug 29, 2023
@lambda-0x lambda-0x deleted the fix-839 branch August 29, 2023 18:53
matzayonc pushed a commit to visoftsolutions/dojo that referenced this pull request Sep 6, 2023
* feat(dojoup): remove jq dependency

* make it more robust
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.

[dojoup] Remove jq dependency from dojoup install
3 participants