forked from eclipse-wildwebdeveloper/wildwebdeveloper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
104 lines (104 loc) · 3.12 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
pipeline {
options {
timeout(time: 2, unit: 'HOURS')
buildDiscarder(logRotator(numToKeepStr:'10'))
disableConcurrentBuilds(abortPrevious: true)
}
agent {
kubernetes {
label 'wildwebdeveloper-buildtest-pod'
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
spec:
containers:
- name: container
image: docker.io/akurtakov/fedora-gtk3-mutter-java-node:f41-node22
imagePullPolicy: Always
tty: true
resources:
limits:
memory: "4Gi"
cpu: "2000m"
requests:
memory: "4Gi"
cpu: "1000m"
- name: jnlp
image: 'eclipsecbi/jenkins-jnlp-agent'
volumeMounts:
- name: volume-known-hosts
mountPath: /home/jenkins/.ssh
- name: settings-xml
mountPath: /home/jenkins/.m2/settings.xml
subPath: settings.xml
readOnly: true
- name: m2-repo
mountPath: /home/jenkins/.m2/repository
volumes:
- name: volume-known-hosts
configMap:
name: known-hosts
- name: settings-xml
secret:
secretName: m2-secret-dir
items:
- key: settings.xml
path: settings.xml
- name: m2-repo
emptyDir: {}
"""
}
}
environment {
NPM_CONFIG_USERCONFIG = "$WORKSPACE/.npmrc"
MAVEN_OPTS="-Xmx1024m"
GITHUB_API_CREDENTIALS_ID = 'github-bot-token'
}
stages {
stage('Prepare-environment') {
steps {
container('container') {
sh 'java -version'
sh 'mvn --version'
sh 'node --version'
sh 'npm --version'
sh 'npm config set cache="$WORKSPACE/npm-cache"'
}
}
}
stage('Build') {
steps {
container('container') {
withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING'), string(credentialsId: 'gpg-passphrase', variable: 'MAVEN_GPG_PASSPHRASE')]) {
withCredentials([string(credentialsId: "${GITHUB_API_CREDENTIALS_ID}", variable: 'GITHUB_API_TOKEN')]) {
wrap([$class: 'Xvnc', useXauthority: true]) {
sh '''mvn clean verify -B -fae -Ddownload.cache.skip=true -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true -Psign -Dmaven.repo.local=$WORKSPACE/.m2/repository -Dgithub.api.token="${GITHUB_API_TOKEN}" -Dtycho.pgp.signer.bc.secretKeys="${KEYRING}" '''
}
}
}
}
}
post {
always {
junit '*/target/surefire-reports/TEST-*.xml'
archiveArtifacts artifacts: 'repository/target/repository/**,*/target/work/configuration/*.log,*/target/work/data/.metadata/.log,*/target/work/data/languageServers-log/**,org.eclipse.wildwebdeveloper/target/chrome-debug-adapter/chromeDebugAdapter.zip'
}
}
}
stage('Deploy') {
when {
branch 'master'
}
steps {
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh '''
ssh [email protected] rm -rf /home/data/httpd/download.eclipse.org/wildwebdeveloper/snapshots
ssh [email protected] mkdir -p /home/data/httpd/download.eclipse.org/wildwebdeveloper/snapshots
scp -r repository/target/repository/* [email protected]:/home/data/httpd/download.eclipse.org/wildwebdeveloper/snapshots
'''
}
}
}
}
}