MM-32148 - Generate version metadata from tags#433
Conversation
|
Doing some experimentation with e2e tests, will request reviews when that's all over with |
22e5420 to
8118ebd
Compare
lieut-data
left a comment
There was a problem hiding this comment.
Nice! A few comments below.
plugin.json
Outdated
| "release_notes_url": "https://github.com/mattermost/mattermost-plugin-incident-management/releases/tag/v1.2.0", | ||
| "icon_path": "assets/incident_plugin_icon.svg", | ||
| "version": "1.2.0", | ||
| "version": "1.2.0+9fcd0b92", |
There was a problem hiding this comment.
Propose we remove the version attribute from the checked-in file otherwise we'll always have a permanently old version checked in.
There was a problem hiding this comment.
I tried to do that, but couldn't think of a way to do it--bin/manifest will output the whole plugin.json, including the version field
There was a problem hiding this comment.
Can we just manually edit the file in this PR to remove the version attribute? I guess then the manifest will always leave a modified plugin.json in the repo... which would be annoying. Can we write the output to a temporary plugin.json (i.e. the one that's being put into the bundle path)?
There was a problem hiding this comment.
Yep, we can write the plugin.json anywhere, and change the bundle instructions. Will do that.
There was a problem hiding this comment.
There, the plugin.json is back in the root, but without the version field. The version field is generated and put into the build directory, and the make bundle copies that generated one to the dist folder. Looks good now, thanks!
server/manifest.go
Outdated
| "release_notes_url": "https://github.com/mattermost/mattermost-plugin-incident-management/releases/tag/v1.2.0", | ||
| "icon_path": "assets/incident_plugin_icon.svg", | ||
| "version": "1.2.0", | ||
| "version": "1.2.0+9fcd0b92", |
There was a problem hiding this comment.
Should we remove these files from the repo, and let them get generated only at build time? (Do we also .gitignore them?)
There was a problem hiding this comment.
I was thinking of that, but then we would have to have the "base" plugin.json somewhere, so that we can read it in. I was thinking of putting it in the build directory. What do you think?
There was a problem hiding this comment.
I made that change so we can see what it looks like. It's not perfect though, because we still update the manifest files with the version info, and I can't think of a way to not have to check that in. Maybe ignore the manifest files as well since they're generated? Hmm, let's see if that will work.
There was a problem hiding this comment.
There, I think that works. Now the three generated files are not checked in. Only thing that feels a little "wrong" is putting the base plugin.json file in the build directory. Open to alternatives there. But if we keep it in the root directory it will be updated and we will start to check in old version numbers.
There was a problem hiding this comment.
Oops, commented above before I read this thread. Yeah, wondering if we can keep the root one the base one, and change manifest to write to the temporary one in the bundle directory at build time?
There was a problem hiding this comment.
As a compromise we're writing into the build directory, because we rm the dist directory before copying the manifest, and I don't want to mess around with that. :)
|
@lieut-data @crspeller ready for re-review, then we can start testing the cloud build process. :) |
lieut-data
left a comment
There was a problem hiding this comment.
Thanks, @cpoile! One comment below about build/plugin.json.
Makefile
Outdated
| CURL ?= $(shell command -v curl 2> /dev/null) | ||
| MM_DEBUG ?= | ||
| MANIFEST_FILE ?= plugin.json | ||
| MANIFEST_FILE ?= build/plugin.json |
There was a problem hiding this comment.
Hmm, this doesn't "smell right" to me -- at least from the context of reading the Makefile, MANIFEST_FILE is about defining the source of truth. This file doesn't exist yet: I'd love to see whatever temporary path we use be an implementation detail vs. something that's configured like this.
Maybe we just make pass the desired output path to bin/manifest and invoke it manually within the bundle target? Or, actually, "applying" plugin.json only needs to happen within the bundle target, so maybe it's just a different bin/manifest apply_version command or some such.
There was a problem hiding this comment.
Yep, that does work better, nice idea. I added a manifest dist command to write the plugin.json to the dist directory. Thanks!
| "windows-amd64": "server/dist/plugin-windows-amd64.exe" | ||
| } | ||
| }, | ||
| "executable": "" |
There was a problem hiding this comment.
Looks like it was generated by marshalling the manifest struct. I can not check it in if it's causing confusion?
Summary
release_notes_urlinplugin.json?Ticket Link