-
Notifications
You must be signed in to change notification settings - Fork 5
/
pipeline
50 lines (42 loc) · 1.63 KB
/
pipeline
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
def artifact_path
def artifact_name
pipeline {
agent any
tools {
git "git"
go 'go 1.18'
}
environment {
CREDENTIAL_ID = 'GIT_ACCOUNT'
Repository_Generator = 'https://github.com/Samsung/slsa-jenkins-generator'
}
stages {
stage('build target ') {
steps {
script {
branch = "${env.payload_ref}"
branch = "${branch}".split("refs/heads/")[1]
git branch: "${branch}", credentialsId: "$CREDENTIAL_ID", url: "$env.payload_repository_clone_url"
//TODO: replace with real build command
sh 'echo "hello world" > output.txt'
artifact_path = sh(script: 'pwd', returnStdout: true).trim()
artifact_name = "output.txt"
}
}
}
stage('generate provenance') {
steps {
dir("../workspace") {
sh 'rm -rf slsa-jenkins-generator && mkdir slsa-jenkins-generator'
dir("slsa-jenkins-generator") {
git branch: "main", credentialsId: "$CREDENTIAL_ID", url: "$Repository_Generator"
// 'run generator via docker'
echo 'run generator via docker'
sh "docker build . -t scia:slsa-generator"
sh "printenv > ./envlist && docker run --env-file ./envlist -v \"${artifact_path}\":\"/artifacts\" scia:slsa-generator -a artifacts/${artifact_name} -o artifacts"
}
}
}
}
}
}