-
Notifications
You must be signed in to change notification settings - Fork 0
/
_jenkinsfile.groovy
111 lines (106 loc) · 3.08 KB
/
_jenkinsfile.groovy
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
@Library( "X13JenkinsLib" )_
pipeline
{
agent
{
label "master"
}
environment
{
DOTNET_CLI_TELEMETRY_OPTOUT = 'true'
DOTNET_NOLOGO = 'true'
}
options
{
skipDefaultCheckout( true );
}
stages
{
stage( 'clean' )
{
steps
{
cleanWs();
}
}
stage( 'checkout' )
{
steps
{
checkout scm;
}
}
stage( 'In Docker' )
{
agent
{
docker
{
image 'mcr.microsoft.com/dotnet/sdk:3.1'
args "-e HOME='${env.WORKSPACE}'"
reuseNode true
}
}
stages
{
stage( 'prepare' )
{
steps
{
sh 'dotnet tool update Cake.Tool --version 2.3.0 --tool-path ./Cake'
sh './Cake/dotnet-cake ./checkout/build.cake --showdescription'
}
}
stage( 'build' )
{
steps
{
sh './Cake/dotnet-cake ./checkout/build.cake --target=build_pretzel'
sh './Cake/dotnet-cake ./checkout/build.cake --target=generate_rss_feeds'
sh './Cake/dotnet-cake ./checkout/build.cake --target=generate'
}
}
}
}
stage( 'deploy' )
{
steps
{
withCredentials(
[sshUserPrivateKey(
credentialsId: "shendrick.net",
usernameVariable: "SSHUSER",
keyFileVariable: "WEBSITE_KEY" // <- Note: WEBSITE_KEY must be in all quotes below, or rsync won't work if the path has whitespace.
)]
)
{
script
{
String verbose = "-v"; // Make "-v" for verbose mode.
String sshOptions = "-o BatchMode=yes -o StrictHostKeyChecking=accept-new -i \\\"${WEBSITE_KEY}\\\"";
sh "cd ./checkout && rsync --rsh=\"ssh ${verbose} ${sshOptions}\" -az --delete --exclude \".well-known\" ./_site ${SSHUSER}@sites.meditationenthusiasts.org:sites_upload";
}
}
}
}
}
post
{
fixed
{
X13SendToTelegramWithCredentials(
message: "${BUILD_TAG} has been fixed! See: ${BUILD_URL}",
botCredsId: "telegram_bot",
chatCredsId: "telegram_chat_id"
);
}
failure
{
X13SendToTelegramWithCredentials(
message: "${BUILD_TAG} has failed. See: ${BUILD_URL}",
botCredsId: "telegram_bot",
chatCredsId: "telegram_chat_id"
);
}
}
}