43 lines
1.2 KiB
Groovy
43 lines
1.2 KiB
Groovy
|
pipeline {
|
||
|
agent any
|
||
|
parameters {
|
||
|
string(name: 'svcname', description: "service name")
|
||
|
string(name: 'svcdesc', description: "service description")
|
||
|
}
|
||
|
stages {
|
||
|
stage("type strengthening") {
|
||
|
steps {
|
||
|
script {
|
||
|
if (svcname.isEmpty()) {
|
||
|
error("svcname mandatory")
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
stage("gitea project"){
|
||
|
steps{
|
||
|
script {
|
||
|
//TODO: clone _template-service
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
stage("service account"){
|
||
|
steps{
|
||
|
script {
|
||
|
ssh user@host username=$svcname svcpw=$ARG2 'echo "rootpass" | sudo -Sv && bash -s' << 'ENDSSH'
|
||
|
#commands to run on remote host
|
||
|
useradd -m -s /bin/bash $username
|
||
|
echo "$username:$password" | chpasswd
|
||
|
ENDSSH
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
stage("initial service setup"){
|
||
|
steps{
|
||
|
script {
|
||
|
//TODO
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|