Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/ofborg
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d582fdda0d99^
Choose a base ref
...
head repository: NixOS/ofborg
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1986c6fba7f7
Choose a head ref
  • 4 commits
  • 5 files changed
  • 1 contributor

Commits on Nov 30, 2018

  1. Checks hacking

    grahamc committed Nov 30, 2018

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    grahamc Graham Christensen
    Copy the full SHA
    d582fdd View commit details
  2. Update hubcaps

    grahamc committed Nov 30, 2018

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    grahamc Graham Christensen
    Copy the full SHA
    882d7d9 View commit details
  3. Correct the checks test

    grahamc committed Nov 30, 2018

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    grahamc Graham Christensen
    Copy the full SHA
    13718d4 View commit details
  4. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    grahamc Graham Christensen
    Copy the full SHA
    1986c6f View commit details
Showing with 611 additions and 14 deletions.
  1. +39 −6 ofborg/Cargo.lock
  2. +4 −3 ofborg/Cargo.toml
  3. +1 −1 ofborg/src/bin/github-comment-poster.rs
  4. +28 −2 ofborg/src/config.rs
  5. +539 −2 ofborg/src/tasks/githubcommentposter.rs
45 changes: 39 additions & 6 deletions ofborg/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions ofborg/Cargo.toml
Original file line number Diff line number Diff line change
@@ -19,13 +19,14 @@ serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
tempfile = "2.2.0"
hubcaps = { git = "https://github.com/grahamc/hubcaps.git" }
# hubcaps = { path = "./hubcaps/" } # for testing patches
hubcaps = { git = "https://github.com/grahamc/hubcaps.git", tag = "0.3.9.3" }
#hubcaps = { path = "../hubcaps/" } # for testing patches
hyper = "0.10.*"
hyper-native-tls = "0.2.4"
lru-cache = "0.1.1"
nom = "4.0.0-beta3"
sys-info = "0.5.6"

#[patch.crates-io]
[patch.crates-io]
hubcaps = { path = "../hubcaps" }
#amq-proto = { path = "rust-amq-proto" }
2 changes: 1 addition & 1 deletion ofborg/src/bin/github-comment-poster.rs
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ fn main() {
channel
.consume(
worker::new(tasks::githubcommentposter::GitHubCommentPoster::new(
cfg.github(),
cfg.github_app(),
)),
easyamqp::ConsumeConfig {
queue: "build-results".to_owned(),
30 changes: 28 additions & 2 deletions ofborg/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use serde_json;
use std::fs::File;
use std::path::Path;
use std::path::{Path, PathBuf};
use std::io::Read;
use hyper::Client;
use hyper::net::HttpsConnector;
use hyper_native_tls::NativeTlsClient;
use hubcaps::{Credentials, Github};
use hubcaps::{Credentials, Github, InstallationTokenGenerator, JWTCredentials};
use nix::Nix;
use std::collections::HashMap;

@@ -20,6 +20,7 @@ pub struct Config {
pub nix: NixConfig,
pub rabbitmq: RabbitMQConfig,
pub github: Option<GithubConfig>,
pub github_app: Option<GithubAppConfig>,
pub log_storage: Option<LogStorage>,
pub tag_paths: Option<HashMap<String, Vec<String>>>,
}
@@ -51,6 +52,13 @@ pub struct GithubConfig {
pub token: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GithubAppConfig {
pub app_id: i32,
pub installation_id: i32,
pub private_key: PathBuf,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct LogStorage {
pub path: String,
@@ -105,6 +113,24 @@ impl Config {
)
}

pub fn github_app(&self) -> Github {
let conf = self.github_app.clone().unwrap();
Github::new(
"github.com/grahamc/ofborg (app)",
// tls configured hyper client
Client::with_connector(HttpsConnector::new(NativeTlsClient::new().unwrap())),
Credentials::InstallationToken(
InstallationTokenGenerator::new(
conf.installation_id,
JWTCredentials::new(
conf.app_id,
conf.private_key
)
)
)
)
}

pub fn nix(&self) -> Nix {
if self.nix.build_timeout_seconds < 1200 {
error!(
Loading