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

Inform user when addon is outdated #21

Merged
merged 7 commits into from
Nov 25, 2024

Conversation

3mkay
Copy link
Contributor

@3mkay 3mkay commented Nov 21, 2024

Adds a post-start script which checks installed version of addon vs github latest and reports back to user.

@3mkay 3mkay linked an issue Nov 21, 2024 that may be closed by this pull request
@3mkay 3mkay self-assigned this Nov 21, 2024
STARS='**********************************'

ADDONVER=$(ddev add-on list --json-output --installed | jq -r '.raw[] | select(.Name=="annertech-ddev") | .Version')
LATESTVER=$(ddev exec curl -sL https://api.github.com/repos/annertech/annertech-ddev/releases/latest | ddev exec jq -r \".tag_name\")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like that!

@bserem
Copy link
Collaborator

bserem commented Nov 21, 2024

I see ddev exec running on exec-host, although it's post-start. I haven't tested this yet, I will and get back to you.
I like the curl trick, a lot. We shouldn't be far away from getting this done.

@3mkay
Copy link
Contributor Author

3mkay commented Nov 21, 2024

I see ddev exec running on exec-host, although it's post-start. I haven't tested this yet, I will and get back to you. I like the curl trick, a lot. We shouldn't be far away from getting this done.

Yeah. I wonder whether it could be turned-around to force it to run on the web container and simplify those commands.
I'm only running on the container because we can't be sure that curl or jq are installed locally.

@3mkay
Copy link
Contributor Author

3mkay commented Nov 21, 2024

I hate escaping quotes!

Spotted that the first jq call is not being made via ddev but it's a nightmare of quotes.
Need to look at it again.

Escaping from reserved character prison!
@3mkay
Copy link
Contributor Author

3mkay commented Nov 21, 2024

I see ddev exec running on exec-host, although it's post-start. I haven't tested this yet, I will and get back to you. I like the curl trick, a lot. We shouldn't be far away from getting this done.

Yeah. I wonder whether it could be turned-around to force it to run on the web container and simplify those commands. I'm only running on the container because we can't be sure that curl or jq are installed locally.

Looks like we need to run this on the host and call ddev exec otherwise we cannot get the version of the installed addon.

@bserem
Copy link
Collaborator

bserem commented Nov 21, 2024

I see ddev exec running on exec-host, although it's post-start. I haven't tested this yet, I will and get back to you. I like the curl trick, a lot. We shouldn't be far away from getting this done.

Yeah. I wonder whether it could be turned-around to force it to run on the web container and simplify those commands. I'm only running on the container because we can't be sure that curl or jq are installed locally.

It's tricky...
Use exec for the web container rather than exec-host which always runs on the host. However, you need ddev which is only available in the host, so this script needs both the host and the web container.
But you can grep the manifest file from inside the web container:

cat .ddev/addon-metadata/annertech-ddev/manifest.yaml | grep -oP '(?<=version: ")[^"]+'
1.14

@bserem
Copy link
Collaborator

bserem commented Nov 21, 2024

image

Pushing some changes to your branch

@bserem
Copy link
Collaborator

bserem commented Nov 21, 2024

cc @vzsigmond

@bserem bserem merged commit 01bcba5 into main Nov 25, 2024
0 of 2 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.

Inform user when addon is outdated
2 participants