geeksforsocialchange / PlaceCal

Bring your community together
https://placecal.org
GNU Affero General Public License v3.0
17 stars 8 forks source link

Make github release link in admin interface friendlier #2055

Open r-ferrier opened 1 year ago

r-ferrier commented 1 year ago

Description

This is not helpful for most users, remove for everyone except root? (Or maybe just remove for everyone)

Acceptance criteria

plan

I'm going to fully remove this. It takes you to a diff that is only intelligible to developers who will be able to find it on github themselves. It is also not a great diff because it is the merge from main to prod that combines all other PRs and strips the context.

It will still appear in the footer of the public site so is discoverable by people not familiar with the project. Perhaps this should be a link to current release of README though, but a question for another day.

kimadactyl commented 1 year ago

This is really helpful so people can see when the software has been upgraded / deploy has finished. I would prefer to replace this with something over nothing.

ivan-kocienski-gfsc commented 1 year ago

Just writing up a few notes on this.

The GIT_REV thing is confusing as it just links to a github page of the last commit (the one deployed).

It would be nice to have it link to the tag instead but this isn't so easy. Alfie put together some code that will make it link to the last tag in github, but it seems a little too coincidental to me? like- on staging it will always point to the latest tag even though it will be ahead of production?

There is a way to read all the tags from GH API:

https://api.github.com/repos/geeksforsocialchange/PlaceCal/tags

And a revision sha can be resolved by:

https://api.github.com/repos/geeksforsocialchange/PlaceCal/commits/<GIT_REV_HASH>

But the solution will have to figure out if the git rev is a tagged commit or not. If its a tagged commit, link to the tag and if its an untagged commit, just link to the commit.

Then I found that the GIT_REV environment variable this uses is actually a deprecated plugin for dokku last updated in 2018, which isn't great.

Perhaps there is a way to enhance the deploy script to note the tag being deployed in a file in the app image somewhere? like tag_release.txt or the like.

So another solution would be to use the timestamps on the files themselves: as a dokku image is built from scratch when being deployed, the files should have an mtime of when the deploy happened. But maybe git is funky and when it clones a fresh repo the modify-time of the files is the same as when that file was last modified in the repo (because that's how git works). We could try reading the timestamp on /tmp/restart.txt which is a special file (not in the repo) that gets touched when the rails server needs to be restarted, but this time may change if the server restarts placecal any time.