mirror of
https://github.com/falcosecurity/falco.git
synced 2025-10-22 12:27:10 +00:00
101 lines
2.2 KiB
Groovy
101 lines
2.2 KiB
Groovy
void setBuildStatus(String context, String message, String state) {
|
|
step([
|
|
$class: "GitHubCommitStatusSetter",
|
|
reposSource: [
|
|
$class: "ManuallyEnteredRepositorySource",
|
|
url: "https://github.com/falcosecurity/falco"
|
|
],
|
|
contextSource: [
|
|
$class: "ManuallyEnteredCommitContextSource",
|
|
context: context
|
|
],
|
|
errorHandlers: [[
|
|
$class: "ChangingBuildStatusErrorHandler",
|
|
result: "UNSTABLE"
|
|
]],
|
|
statusResultSource: [
|
|
$class: "ConditionalStatusResultSource",
|
|
results: [[
|
|
$class: "AnyBuildResult",
|
|
message: message,
|
|
state: state
|
|
]]
|
|
]
|
|
]);
|
|
}
|
|
|
|
def version = 'UNKNOWN'
|
|
|
|
pipeline {
|
|
agent { label "agent-docker-builder" }
|
|
stages {
|
|
stage("Check out dependencies") {
|
|
steps {
|
|
dir("falco") {
|
|
checkout([
|
|
$class: "GitSCM",
|
|
branches: [[name: "refs/heads/"+env.BRANCH_NAME]],
|
|
doGenerateSubmoduleConfigurations: false,
|
|
extensions: [],
|
|
submoduleCfg: [],
|
|
userRemoteConfigs: [[
|
|
credentialsId: "github-jenkins-user-token",
|
|
url: "https://github.com/falcosecurity/falco"
|
|
]]
|
|
])
|
|
}
|
|
dir("sysdig") {
|
|
checkout([
|
|
$class: "GitSCM",
|
|
branches: [[name: "dev"]],
|
|
doGenerateSubmoduleConfigurations: false,
|
|
extensions: [],
|
|
submoduleCfg: [],
|
|
userRemoteConfigs: [[
|
|
credentialsId: "github-jenkins-user-token",
|
|
url: "https://github.com/draios/sysdig"
|
|
]]
|
|
])
|
|
}
|
|
}
|
|
}
|
|
stage("Build") {
|
|
steps {
|
|
script{
|
|
version = sh(returnStdout: true, script: "./falco/scripts/jenkins/build-pipeline/version")
|
|
sh("./falco/scripts/jenkins/build-pipeline/build ${version}")
|
|
}
|
|
}
|
|
post {
|
|
success {
|
|
setBuildStatus("Build", "Build Successful", "SUCCESS")
|
|
}
|
|
failure {
|
|
setBuildStatus("Build", "Build Failed", "FAILURE")
|
|
}
|
|
}
|
|
}
|
|
stage("Run tests") {
|
|
steps {
|
|
script{
|
|
sh("./falco/scripts/jenkins/build-pipeline/run-tests ${version}")
|
|
}
|
|
}
|
|
post {
|
|
success {
|
|
setBuildStatus("Run tests", "All tests passed", "SUCCESS")
|
|
}
|
|
failure {
|
|
setBuildStatus("Run tests", "One or more tests failed", "FAILURE")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
cleanWs()
|
|
}
|
|
}
|
|
}
|
|
|