No edit summary |
No edit summary |
||
| Line 26: | Line 26: | ||
sudo service jenkins start | sudo service jenkins start | ||
sudo chkconfig jenkins on | sudo chkconfig jenkins on | ||
</syntaxhighlight> | |||
== JenkinsFile == | |||
For jenkins pipeline you will need to add a jenkins file to your repo which will be used to configure the build when the changes are pushed to the repo. | |||
Example of the jenkinsfile:<syntaxhighlight lang="bash"> | |||
pipeline { | |||
agent any | |||
stages { | |||
stage('Install dependencies') { | |||
steps { | |||
sh 'pip3 install -r requirements.txt' | |||
} | |||
} | |||
stage('Start application') { | |||
steps { | |||
sh 'python3 app.py' | |||
} | |||
} | |||
} | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 13:42, 11 September 2024
Install jenkins
On CentOS / RedHad based linux:
cd ~
sudo yum remove java -y
sudo yum install java-1.11.0-openjdk-devel -y
sudo yum install -y git
sudo wget -O /etc/yum.repos.d/jenkins.repo \
http://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import http://pkg.jenkins.io/redhat-stable/jenkins.io.
key
sudo yum install -y jenkins
On Ubuntu:
sudo apt install default-jre
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins
start jenkins service and set to start on boot
sudo service jenkins start
sudo chkconfig jenkins on
JenkinsFile
For jenkins pipeline you will need to add a jenkins file to your repo which will be used to configure the build when the changes are pushed to the repo.
Example of the jenkinsfile:
pipeline {
agent any
stages {
stage('Install dependencies') {
steps {
sh 'pip3 install -r requirements.txt'
}
}
stage('Start application') {
steps {
sh 'python3 app.py'
}
}
}
}