-
Notifications
You must be signed in to change notification settings - Fork 34
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
Automate Config Creation #1026
Comments
@Abby-Wheelis here's the example that I saw (while wearing my JOET hat, incidentally) You can see that it has links at the top to add and update entries. Not sure what happens when the issue is filed - you should be able to look at the commit history and figure out what they do. Maybe it is more manual than I originally thought. |
There is a way to run a workflow when an issue is created |
The form for adding a new entry is an "issue template" which seems to be a beta feature on github, I agree that it would be great if we could do something like that - snooping through their workflow, it looks like the PR is mostly created by automation - there's two commits from an Auto-Updater bot and then a comment from another bot with a deployment preview. Based on this, I think the first flow that I intend to try would be to set up an issue form, have the creation of that issue generate a pull request, and set up a check on the pull request to make sure the config is valid. I believe that would leave our only step as actually merging the pull request, which I'm sure we could automate later as well, it seems the repo you linked already does this. |
I think we want to keep at least one manual approval step to avoid attacks in which bad actors create configs (threat: denial of service through spamming), or worse, edit existing configs to introduce errors (threat: hijacking the server that data goes to, for example). |
I was beginning to get stuck in terms of figuring out how to convert the issue into a file and got a chance to chat with @nataliejschultz today, where she helped me figure out some more steps of the workflow - including going from issue created to creating a PR with something like this: create pull request action. While we were talking, I also managed to find github-issue-to-json-file, a repo that can be used to create a json file from an issue, and proved that we can complete this process. It also uses the issue templates, so I'm encouraged that we're on the right track. I don't see too much activity on that repository, so I'm not sure if we'll want to use it directly but it does serve as a proof of concept - I hadn't really found any cases of issue -> file conversion before I found that repo, but it seemed like it had to be an existing use case somewhere. |
I just tested the workflow from that Repo - and it does work! (Ignore the mismatch, it's because I keep changing things). That workflow automatically creates a file with a randomized name, and I know we'll want our file to have a specific name, I also note that the this creates a "flat" JSON file, and we need ours to have a specific structure, for those reasons, my current workflow idea would consist of a few actions:
This process does hinge on the issue -> json generator that I found. @shankari can you take a look when you get a chance and see how you feel about using it as a dependency? (repo here) |
@Abby-Wheelis given that the generator doesn't do the exact thing that you need, and, as you point out, might not be actively maintained, why don't you write your own GitHub action? You can use https://github.com/zachleat/github-issue-to-json-file as a model. Writing GitHub action is not that different from writing a workflow - I think it uses javascript under the hood. Rest of the workflow seems sound. As a future enhancement, might I suggest:
But that is definitely way more complicated, so we shouldn't hold this up for now |
I had not really parsed how the generator works at first, but going back there were just 3 main files I needed! I now have this up and running, converting an issue to json and saving it to the appropriate folder. My next step is going to be working through the formatting piece, as it stands the json file is still "flat". I think I've included most of the fields in the template now, but may edit as needed to facilitate parsing into the desired format. |
Something @sebastianbarry brought up today which was a great point, is what happens when the config file changes, such as adding a new field or way to customize? This will likely involve updating the issue template, the workflow, and possibly any validation step I set up. With this in mind, I need to be sure that I keep up with documentation for this, something like a "how to update automatic config creation" document might be a good idea. I've been focused on what happens if the deployer needs to update their config (I think updating their existing issue or filing a new one would both do the trick!), but I should keep in mind developer-side updates as well. |
I have added a different dependency to this workflow, one that creates pull requests. Unlike the other outside action I was considering using, this one does exactly what we want it to, is widely used (95k users), and is actively maintained (commits within the last month), and author is active in responding to issues. The documentation is also extensive. See the repo here |
I have left a few fields hard-coded, rather than allowing the person filling out the form to set them:
@shankari in your opinion, any of these I should not hardcode (or others I should)? |
@Abby-Wheelis I think that is fine. The only exception may be the |
I'm a little stumped in a couple of places:
The workflow I have so far seems to be working great for configs that are not "highly custom", and succeeding in eliminating the copy-paste process that we currently need for new configs. The automation means formatting and convention are consistent, but if something slips past the automation I still want to catch it before merging. I'll keep brainstorming and researching... |
@Abby-Wheelis I think that the perfect should not be the enemy of the good. I would suggest finishing up a PR with this flow and with some (clearly documented) manual steps. We should then demo it to the contracting folks and make sure that they are on board, and/or integrate with @nataliejschultz's code. We can then work on the enhancements step by step (I have ideas). Incremental progress with lots of feedback is the best way to approach these customer facing changes. |
I have a PR started here, and iterating on this step first I think the only remaining task is to work on documentation: I've added a note to the existing |
To keep this issue updated, we have implemented the process and are continuing with polishing the process and getting it approved before we start using it. Most recent PR: e-mission/nrel-openpath-deploy-configs#49 |
This process is now in place and has been used a few times! Some partners have been confused by the fact that they need to make an account on GitHub, so we may need to improve communication around how github works (apparently the space themed landing page can seem scammy), but the issue -> PR process seems to work well otherwise. |
As the number of programs using our platform continues to increase, one of the time consuming points in the startup process is the development, verification, and editing of the config files. I plan to add a feature to nrel-openpath-deploy-configs in order to facilitate the creation of these config files. In discussing this idea, @shankari mentioned that we could leverage GitHub pages in order to allow partners to fill in a form, and submit it to create a PR into that repo. With this route there are a few things that I think we should keep in mind:
I also believe that the more user-friendly and well-validated this interface is, the more people will be able to set the configs up themselves, improving efficiency of the startup workflow and saving us time.
The text was updated successfully, but these errors were encountered: