DO-63/Waydroid_build (#1)
+ Added jobs-dsl and gitea events Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Co-committed-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
This commit is contained in:
committed by
Aleksandr Vodyanov
parent
70e286b008
commit
9046f994f1
62
pipelines/jobs-dsl/jobs-dsl.groovy
Normal file
62
pipelines/jobs-dsl/jobs-dsl.groovy
Normal file
@@ -0,0 +1,62 @@
|
||||
@Library('shared-lib') _
|
||||
|
||||
import tech.avroid.scm.Git
|
||||
import tech.avroid.ssh.Ssh
|
||||
|
||||
properties([
|
||||
disableConcurrentBuilds(),
|
||||
parameters([
|
||||
string(name: 'PROJECT_NAME', defaultValue: 'DevOps/jenkins-pipelines'),
|
||||
string(name: 'BRANCH_NAME', defaultValue: 'master')
|
||||
]),
|
||||
])
|
||||
|
||||
podTemplate(yaml: '''
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
spec:
|
||||
containers:
|
||||
- name: linux
|
||||
image: harbor.avroid.tech/devops/base-build-image:1.0
|
||||
tty: true
|
||||
resources:
|
||||
limits:
|
||||
cpu: 300m
|
||||
memory: 256Mi
|
||||
requests:
|
||||
cpu: 300m
|
||||
memory: 256Mi
|
||||
imagePullPolicy: Always
|
||||
imagePullSecrets:
|
||||
- name: harbor-registry-secret
|
||||
'''
|
||||
) {
|
||||
node(POD_LABEL) {
|
||||
stage('Get repository') {
|
||||
println(params.BRANCH_NAME)
|
||||
withCredentials(bindings: [sshUserPrivateKey(credentialsId: env.JENKINS_GIT_CREDENTIALS_SSH,
|
||||
keyFileVariable: 'SSH_KEY')]) {
|
||||
def ssh = new Ssh(this, SSH_KEY, "id_ecdsa")
|
||||
def git = new Git(this)
|
||||
|
||||
ssh.configureSshClient()
|
||||
git.clone([urlRepo: "$env.JENKINS_GIT_REPOSITORY_SSH_URL/$params.PROJECT_NAME",
|
||||
branch: params.BRANCH_NAME])
|
||||
ssh.cleanupSshConfiguration()
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run job dsl') {
|
||||
jobDsl(
|
||||
targets: 'jobs-dsl/folders/*.groovy\n' +
|
||||
'jobs-dsl/jobs/**/*.groovy\n' +
|
||||
'jobs-dsl/views/**/*.groovy',
|
||||
failOnSeedCollision: true,
|
||||
lookupStrategy: 'JENKINS_ROOT',
|
||||
removedJobAction: 'IGNORE',
|
||||
removedViewAction: 'IGNORE',
|
||||
removedConfigFilesAction: 'IGNORE'
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user