Update Jenkinsfile
This commit is contained in:
40
Jenkinsfile
vendored
40
Jenkinsfile
vendored
@@ -0,0 +1,40 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Create file') {
|
||||
steps {
|
||||
sh '''
|
||||
echo "Hello from Jenkins" > jenkis_test.txt
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Commit & Push') {
|
||||
steps {
|
||||
withCredentials([
|
||||
usernamePassword(
|
||||
credentialsId: 'gitea-creds',
|
||||
usernameVariable: 'GIT_USER',
|
||||
passwordVariable: 'GIT_PASS'
|
||||
)
|
||||
]) {
|
||||
sh '''
|
||||
git config user.email "jenkins@local"
|
||||
git config user.name "Jenkins"
|
||||
|
||||
git add jenkis_test.txt
|
||||
git commit -m "Jenkins: add jenkis_test.txt" || echo "Nothing to commit"
|
||||
git push
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user