Closed sockeqwe closed 5 years ago
OutputWriter
or not mostly depends on your needs. Do you want to generate the website only? Just to clarify, Im not talking about generating whole website, but rather just a single site for a single episode (front matter format).
What do you think about the idea of replacing the outputwriter with something more generic like a Deployment. A deployment is basically just a
interface Deployment {
fun deploy( p: Podcast, episodes : List
I will come up with a proposal later this week
@sockeqwe, I saw you’ve started to rewrite everything, so I’ll give a couple of points 😉
From my point of view this tool should not be related to deployments at all. It creates some output from the defined input, that’s it. How and where the result is placed is totally situational and does not make a lot of sense if you think about someone else as a consumer of this thing.
I’m kind of against posting previews to PRs. I know it is kind of dream of yours but I don’t see a lot of benefit in it. I guess mostly because we haven’t defined the process, like, at all. So I’ve defined my own picture.
artem-zinnatullin/TheContext-Podcast
becomes obsolete. It is replaced with TheContext/episodes
.master
. This way we have a preview of what we get on the output and avoid using clunky schemes which might (and will) break eventually.master
. The procedure will publish the GitHub static website and push RSS feed to hosting of choice. Using Travis will allow using secrets properly without hacks.The PR procedure looks this way then.
This way we achieve separation of concerns and simplify the overall process. And far less possible things to break.
Does it make sense? I’m sorry to be a bit late to put this on paper.
@sockeqwe, I saw you’ve started to rewrite everything, so I’ll give a couple of points 😉
Not everything, but yeah, I introduced some major changes.
DeployableArtifact
: It is what you called Output before I guess. At the moment there is basically just data class FolderArtifact(val folder: File) : DeployableArtifact()
. All it says it, whatever is in that folder can be deployed "somewhere".ArtifactGenerator
: As the name suggests, this is basically fun generateArtifact(podcast: Podcast, episodes: List<Episode>): DeployableArtifact
. So at the moment there is FeedAndShowNotesArtifactGenerator
which is what you have written before and generates the shownotes and the rss feed. Additionally I have added WebsiteArtifactGenerator
which generates the Front Matter file for jekyll.DeploymentJob
: It's responsible to deploy a DeployableArtifact
. At the moment there is only a GitDeploymentJob
which uses git to deploy stuff. Concrete example: Show notes and rss feeds are generated and put into a folder /tmp/feed-and-shownotes/
. This is represented by FolderArtifact
pointing to /tmp/feed-and-shownotes/
. Eventually GitDeploymentJob
clones artem-zinnatullin/TheContext-Podcast
and adds, commits and pushes the changes show notes and rss feed. Similar workflow for deploying the website. The generated jekyll stuff is put into /tmp/website/
, a FolderArtifact
pointing to /tmp/website/
is passed to a GitDeploymentJob
which then does the magic to deploy it to TheContext/TheContext.github.io
.Plain Markdown notes become obsolete. The website is used instead. RSS remains the same.
So we still have two artifacts and two deployment targets, right?
This tool is being run as a commit hook. Every change regenerates all the content on the current branch which is getting merged to master. This way we have a preview of what we get on the output and avoid using clunky schemes which might (and will) break eventually.
So you would like to have the following process:
episode99
, adds the .yml files to describe this episode and creates a pull request for it.episode99
?episode99
) which contains .yml files (author Hannes) and generated stuff from commit hook?Did I get this right? I think we discussed something like that at the very beginning to apply something like that to artem-zinnatullin/TheContext-Podcast
but I think there was some reasons why we didn't like it (messes up git history, requires pulling branch and I can remember that @artem-zinnatullin had more a idiologic problem with this (that a CI doesn't do a deployment but rather changes diles directly).
My understanding of the desired process is:
episode99
, adds the .yml files to describe this episode and creates a pull request for it (in TheContext/episodes
repo).podcastci.jar --validation
. So it only validates that the .yml files are correct (but doesn't deploy anything). If the yml files are not correct CI will fail the build and show this status in the pull request.episode99
gets merged to master
.podcastci.jar --deployRss --deployWebsite
to regenerate all the stuff and "deploy" it to artem-zinnatullin/TheContext-Podcast
(rss feed and plain show notes - ok obsolete could be removed) and website to TheContext/TheContext.github.io
.Using Travis will allow using secrets properly without hacks.
In my described process podcastci.jar
runs on travis, so there is no hacking with secrets (unless we have a different understanding of what "hacking with secrets means")
And far less possible things to break.
Can't see a major difference where things would break in my described process comparing to your described process. Overall they seem pretty similar. only the deployment is handled differently.
Does it make sense?
Yes and no. My biggest problem is that basically a review of pull request for episode99
also review generated (and already unit tested) stuff. Also messing up git history is not my biggest problem, but having to git pull
on every pull request request change from a reviewer (because new generated stuff has been added) to my local machine is a bit annoying.
I’m kind of against posting previews to PRs. I know it is kind of dream of yours but I don’t see a lot of benefit in it.
I would argue, that this simplifies Reviewers life quite a bit: If a reviewer sees a (markdown rendered) comment attached to the pull request for episode99
, containing basically the show notes, you as a reviewer can simply focus on reviewing the actual text / content, not on reviewing .yml file's structure and formatting (which is already checked by podcastci.jar
). Additionally, you can click on all links to validate if they open the desired websites which was the number one problem we had in the past imho.
Not everything, but yeah, I introduced some major changes.
Yeah, it kinds of scares me, because you are reworking the whole thing in one change.
Did I get this right?
Seems right.
messes up git history
You do basically the same thing, just in a separate repository. And it does not mess it up, it just changes real files.
requires pulling branch
It doesn’t.
that a CI doesn't do a deployment but rather changes diles directly
That’s exactly what you do right now!
My understanding of the desired process is:
You’ve skipped the preview part. There is no way to check the sanity of RSS and Markdown in this scenario. Unless you introduce some complex tool that will spam PR with previews for each change.
Overall they seem pretty similar. only the deployment is handled differently.
Yep, but your changes paint a different picture 😉 You are incorporating deployments into the tool and I see it as a completely individual task that stands aside.
but having to git pull on every pull request request change from a reviewer
You’ll see generated changes in the PR itself since it will contain them. You do not have to pull them to see the change, that’s the whole point. The PR contains both source YAML and Markdown changes and generated RSS and Markdown for the website.
you as a reviewer can simply focus on reviewing the actual text / content, not on reviewing .yml file's structure and formatting
Yep, and I suggest doing exactly that without posting additional previews since it will be directly in the PR by design.
I think the differences we have grow from the overall picture of how we see this thing going.
From my point of view this tool is not related to CI at all at this point. It is just a helper for a PR author allowing to generate files from centralized format instead of doing it manually (just like you do it right now).
I’ve tried to incorporate it in a potential CI workflow, but I always stumble upon over-automation. Yes, episodes can be in a one repository, the website in another one, it is quite possible to connect them and post previews of the generated stuff to the PR but is just not worth it for me. Launching it locally to generate necessary things and pushing this for a review makes much more sense and it folds nicely into the current workflow we have and doesn’t introduce any magic. The same thing, just more pleasant to use and without a fear of ruining the RSS feed by an accident.
I know you are a smart guy. Thus, I completely trust your expertise. Lets do it the way you proposed. Also I'm not emotional attached to my code changes nor do I think my approach is better, just a different target picture. At the end all I care about is that it's automated somehow and I'm sure you have put a lot of thoughts in your proposed solution.
It's still not clear how website generation plays into the picture you have in mind. Should that be an entirely different project / jar? Do you have 10 minutes somewhen this week to talk about this?
I'm sorry if you feel that I reworked the whole thing and changed all your code. This was not my intention nor did I really do that. All I did regarding existing code is the following: https://github.com/TheContext/podcast-ci/pull/12/files
I changed Runner a bit to include website and the deployment thing. Your code is still to 95% there. I just renamed some classes and / or moved it to another package. I apologise if this caused any confusion or disappointment.
Hopefully the initial goal of producing both website and feed is achieved.
I would like to generate website out of the existing description, shownotes and people files which actually is yet another output (in addition to feed.rss and show notes).
At the moment this is done on
OutputWriter
. I try to understand what the purpose of Outputwriter in general is and what is the best way to add website generation. Should there be a FeedOutputWriter, ShownotesOutputWriter and WebsiteOutputWriter? Or should a single OutputWriter accept a list of "plugins" and then basically just do Single.merge() of all those plugins?