-
Notifications
You must be signed in to change notification settings - Fork 17
/
Jenkinsfile.majorsilence
60 lines (57 loc) · 2.14 KB
/
Jenkinsfile.majorsilence
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
51
52
53
54
55
56
57
58
59
60
pipeline {
agent none
environment {
DOTNET_CLI_HOME = '/tmp/DOTNET_CLI_HOME'
DEPLOY_TARGET = credentials('majorsilence_media_host') // it will be something like example1.example.local
}
stages {
stage('build and test') {
agent {
docker {
image 'mcr.microsoft.com/dotnet/sdk:8.0'
// args '-u root:sudo'
}
}
steps {
echo 'building'
sh '''
#apt update && apt install -y mplayer mencoder mpv libmpv1
./build.sh
'''
stash includes: 'build/linux-x64/**/*.tar.gz', name: 'linux-x64'
//nunit testResultsPattern: '**/TestResults/*.xml'
//recordCoverage(tools: [[parser: 'COBERTURA', pattern: '**/TestResults/**/*cobertura.xml']])
}
}
// Uncomment to build docker image
//stage('build linux image') {
// agent { label 'linux-x64' }
// steps {
// echo 'building'
// sh '''
// ./build_dockerimage.sh
// '''
// stash includes: "build/docker-images/**/*.tar.gz", name: 'docker-images'
// }
//}
stage('Publish') {
when {
expression { return env.BRANCH_NAME.startsWith('PR-') == false }
}
steps {
timeout(time:180, unit:'MINUTES') {
input message:'Deploy?'
node('linux-x64') {
echo "Deploying linux-x64 media-web and media-worker systemd service ${env.BRANCH_NAME}...."
unstash 'linux-x64'
withCredentials([usernamePassword(credentialsId: 'media-web-ssh', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
sh '''
./deploy.sh remote_systemd_deploy "$USERNAME" "$PASSWORD" "$DEPLOY_TARGET"
'''
}
}
}
}
}
}
}