-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipeline.txt
60 lines (46 loc) · 959 Bytes
/
pipeline.txt
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
Ubuntu Jenkins Pipeline-
sudo apt-get install git
git --version
sudo apt update
sudo apt install openjdk-11-jdk
javac -version
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
source ~/.bashrc
New Item
-> pipeline
-> click "OK"
Configure
-> Pipeline
-> Definition: Pipeline script from SCM
-> SCM : Git
-> Github repo
-> Credentials -> Jenkins -> Username and Pswd
-> Branch : */main
-> Script path : jenkins.txt
-> SAVE
To be uploaded in Github repo:
Test.java :
class Test {
public static void main(String[] args) {
System.out.println("Hello World!!");
}
}
jenkins.txt :
pipeline {
agent any
stages {
stage('version') {
steps {
echo 'Stage Version'
}
}
stage('hello') {
steps {
echo 'Stage Hello'
sh 'javac Test.java'
sh 'java Test'
}
}
}
}