Compare commits
12 Commits
b927385d25
...
9e6815aa31
Author | SHA1 | Date | |
---|---|---|---|
9e6815aa31 | |||
47e47236ab | |||
fbeb1b31d9 | |||
84d9b15628 | |||
9b0c592e1d | |||
51267903be | |||
1ef4131953 | |||
27b005b4ea | |||
4ccaf9976a | |||
f2c2d2a18b | |||
3b72d5a4d7 | |||
3c6785df76 |
54
Jenkinsfile
vendored
Normal file
54
Jenkinsfile
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
options {
|
||||||
|
buildDiscarder(logRotator(numToKeepStr: "100"))
|
||||||
|
skipDefaultCheckout(true)
|
||||||
|
}
|
||||||
|
triggers {
|
||||||
|
pollSCM("*/10 * * * *")
|
||||||
|
}
|
||||||
|
environment {
|
||||||
|
SONAR_SCANNER_VERSION="4.7.0.2747"
|
||||||
|
SONAR_SCANNER_HOME="$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux"
|
||||||
|
PATH="$SONAR_SCANNER_HOME/bin:$PATH"
|
||||||
|
SONAR_SCANNER_OPTS="-server"
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps{
|
||||||
|
//cleanWs()
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*stage('Clean') {
|
||||||
|
steps {
|
||||||
|
withEnv(["PATH+RUST=$HOME/.cargo/bin"]) { // Cargo needs to be installed for the jenkins user
|
||||||
|
sh 'cargo clean'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
withSonarQubeEnv(installationName: 'SQ Bib Watcher', envOnly: true) {
|
||||||
|
withEnv(["PATH+RUST=$HOME/.cargo/bin"]) {
|
||||||
|
sh 'cargo build --release'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// For this to work, edit sonar-scanner script to set use_embedded_jre=false
|
||||||
|
stage('SonarQube Analysis') {
|
||||||
|
steps {
|
||||||
|
withSonarQubeEnv(installationName: 'SQ Bib Watcher', envOnly: true) {
|
||||||
|
withEnv(["PATH+RUST=$HOME/.cargo/bin"]) {
|
||||||
|
sh """
|
||||||
|
SONAR_TOKEN="$SONAR_AUTH_TOKEN"
|
||||||
|
cargo clippy --message-format=json &> clippy-output.json
|
||||||
|
sonar-scanner -Dsonar.projectKey=bib-watcher -Dsonar.sources=. -Dsonar.host.url=http://grover.local:9000
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
sonar-project.properties
Normal file
1
sonar-project.properties
Normal file
@ -0,0 +1 @@
|
|||||||
|
community.rust.clippy.reportPaths=clippy-output.json
|
@ -1,6 +1,6 @@
|
|||||||
use config::Config;
|
use config::Config;
|
||||||
use reqwest::header;
|
use reqwest::header;
|
||||||
use rss::{Channel, ChannelBuilder, ItemBuilder};
|
use rss::{Channel, ChannelBuilder, GuidBuilder, ItemBuilder};
|
||||||
use scraper::{Html, Selector};
|
use scraper::{Html, Selector};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::{error::Error, fs::File, io::BufReader};
|
use std::{error::Error, fs::File, io::BufReader};
|
||||||
@ -84,12 +84,17 @@ fn search(url: &str, title: &str) -> Result<(), Box<dyn Error>> {
|
|||||||
.build()),
|
.build()),
|
||||||
}?;
|
}?;
|
||||||
let mut items = channel.clone().into_items();
|
let mut items = channel.clone().into_items();
|
||||||
|
let guid = GuidBuilder::default()
|
||||||
|
.value(title.to_string() + &Utc::now().to_rfc2822())
|
||||||
|
.permalink(false)
|
||||||
|
.build();
|
||||||
items.push(
|
items.push(
|
||||||
ItemBuilder::default()
|
ItemBuilder::default()
|
||||||
.title(Some(title.to_string()))
|
.title(Some(title.to_string()))
|
||||||
.pub_date(Some(Utc::now().to_rfc2822()))
|
.pub_date(Some(Utc::now().to_rfc2822()))
|
||||||
.link(Some(url.to_string()))
|
.link(Some(url.to_string()))
|
||||||
.description(Some(status))
|
.description(Some(status))
|
||||||
|
.guid(Some(guid))
|
||||||
.build(),
|
.build(),
|
||||||
);
|
);
|
||||||
channel.set_items(items);
|
channel.set_items(items);
|
||||||
|
Loading…
Reference in New Issue
Block a user