forked from EvilBeaver/OneScript.Web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
85 lines (77 loc) · 3.19 KB
/
Jenkinsfile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
pipeline {
agent none
environment {
ReleaseNumber = '0.7.0'
}
stages {
stage('Build everything')
{
options { skipDefaultCheckout() }
agent {
label 'windows'
}
steps {
checkout(
[$class: 'GitSCM', branches: [[name: "${env.BRANCH_NAME}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
submoduleCfg: [],
userRemoteConfigs: [[url: 'https://github.com/EvilBeaver/OneScript.Web.git']]])
/*dir('src/OneScriptWeb.Tests'){
bat '''
@echo off
dotnet restore
dotnet xunit -nunit testresult.xml -configuration Release
'''
nunit testResultsPattern: 'testresult.xml'
}*/
dir('artifact'){
deleteDir()
}
dir('src'){
bat '''
@echo off
dotnet publish OneScript/OneScriptWeb.csproj -c Release -f net461 -o ../artifact/net461/win7-x64 -r win7-x64
dotnet publish OneScript/OneScriptWeb.csproj -c Release -f net461 -o ../artifact/net461/debian-x64 -r debian-x64
dotnet publish OneScript/OneScriptWeb.csproj -c Release -f netcoreapp2.2 -o ../artifact/core22/debian-x64 -r debian-x64
'''
}
// новые версии дженкинса падают, если есть ранее зипованый артефакт
fileOperations([fileDeleteOperation(excludes: '', includes: '*.zip')])
zip archive: true, dir: 'artifact/net461/win7-x64', glob: '', zipFile: 'oscript.web-win7-x64.zip'
zip archive: true, dir: 'artifact/net461/debian-x64', glob: '', zipFile: 'oscript.web-debian-x64.zip'
zip archive: true, dir: 'artifact/core22/debian-x64', glob: '', zipFile: 'oscript.web-debian-x64-core.zip'
}
}
stage('Create docker image'){
options { skipDefaultCheckout() }
agent {
label 'linux'
}
steps {
checkout(
[$class: 'GitSCM', branches: [[name: "${env.BRANCH_NAME}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
submoduleCfg: [],
userRemoteConfigs: [[url: 'https://github.com/EvilBeaver/OneScript.Web.git']]])
withCredentials([usernamePassword(credentialsId: 'docker-hub', passwordVariable: 'dockerpassword', usernameVariable: 'dockeruser')]) {
sh "docker build -t evilbeaver/oscript-web:${ReleaseNumber} --file Dockerfile src"
sh "docker login -p $dockerpassword -u $dockeruser && docker push evilbeaver/oscript-web:${ReleaseNumber}"
}
}
}
}
}