forked from eclipse-wildwebdeveloper/wildwebdeveloper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
115 lines (115 loc) · 3.5 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
105
106
107
108
109
110
111
112
113
114
115
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:java-21-node-20
imagePullPolicy: Always
tty: true
command: [ "uid_entrypoint", "cat" ]
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('initialize PGP') {
steps {
container('container') {
withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING')]) {
sh 'gpg --batch --import "${KEYRING}"'
sh 'for fpr in $(gpg --list-keys --with-colons | awk -F: \'/fpr:/ {print $10}\' | sort -u); do echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key ${fpr} trust; done'
}
}
}
}
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([string(credentialsId: 'gpg-passphrase', variable: 'KEYRING_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}" -Dgpg.passphrase="${KEYRING_PASSPHRASE}" """
}
}
}
}
}
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 genie.wildwebdeveloper@projects-storage.eclipse.org rm -rf /home/data/httpd/download.eclipse.org/wildwebdeveloper/snapshots
ssh genie.wildwebdeveloper@projects-storage.eclipse.org mkdir -p /home/data/httpd/download.eclipse.org/wildwebdeveloper/snapshots
scp -r repository/target/repository/* genie.wildwebdeveloper@projects-storage.eclipse.org:/home/data/httpd/download.eclipse.org/wildwebdeveloper/snapshots
'''
}
}
}
}
}