aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
AgeCommit message (Collapse)Author
2017-11-12main(): Print message to inform users that the server is runningTeddy Wing
2017-11-12main(): Use "127.0.0.1" instead of "localhost"Teddy Wing
Make it clear that we want to run on local localhost (and not "0.0.0.0").
2017-11-12main(): Add loggingTeddy Wing
Initialise a new 'stderrlog' and log all errors to the log.
2017-11-12Update tests for Jenkins mock URLTeddy Wing
Now that the Jenkins API URL is getting passed in via command line and function argument, update the tests to pass it in directly. Remove the test/non-test versions of `jenkins_url` from `find_and_track_build_and_update_status()` because we can pass in the mock URL directly to the `get_jobs()` and `request_job()` functions in tests. Make the `jenkins_url` argument to `find_and_track_build_and_update_status()` not a reference so that we don't have to reset it in the function to a `to_owned()` version.
2017-11-12update_commit_status(): Pass GitHub token from command line argumentTeddy Wing
Take the GitHub API token as a parameter and pass it through from `find_and_track_build_and_update_status()`.
2017-11-12find_and_track_build_and_update_status(): Pass in configurationTeddy Wing
Pass logins & tokens for API communication into this function. Since this is the entry point into everything else, it seemed to make sense to have it be the thing that took the config. Ended up not making a Config struct to be simple. I guess.
2017-11-12main(): Use user-supplied portTeddy Wing
Remove the hard-coded port and use the one passed in via command line option (or the default one).
2017-11-12main(): Add command line optionsTeddy Wing
Add options for: * Jenkins URL * Jenkins username * Jenkins token * GitHub token * Port Add a help option for usage information. All options except "port" are required. Didn't use `reqopt` because that panics when you try to ask for help without the required options. Now, when trying to run without a required option, the usage help is printed. Maybe we should have an error message instead.
2017-11-11main(): Handle errors from `Result`sTeddy Wing
Now that our functions return `Result`s for errors instead of panicking, we need to handle these errors. For now, just respond with a 500. We'll also want to log the errors though.
2017-11-10main(): Make endpoint to handle GitHub webhookTeddy Wing
Convert our dummy test route to a real one that will handle webhooks coming from GitHub. It will parse the POST body data and create a `CommitRef` from it. That `CommitRef` then gets passed to `find_and_track_build_and_update_status()` to update the pull request status based on Jenkins' build results. A 202 response seemed apt here. Quoting https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html: > 10.2.3 202 Accepted > > The request has been accepted for processing, but the processing has > not been completed. The request might or might not eventually be acted > upon, as it might be disallowed when processing actually takes place. > There is no facility for re-sending a status code from an asynchronous > operation such as this.
2017-11-07main.rs: Print message on 404Teddy Wing
Print a simple text message on 404 for human consumption. Makes it more obvious than finding out the response status code in a browser.
2017-11-07main.rs: Add web server and "hello world" routeTeddy Wing
Basic web server and dummy response using 'rouille'.
2017-11-07Initial commit. Cargo init.Teddy Wing
Initialised new project with: $ cargo init --bin kipper Rust 1.16.0. (I know, it's super old, but that's what I have on my machine right now without going out to get the latest version.)