Files
test_git/Jenkinsfile
2026-02-05 17:33:02 +00:00

42 lines
1.1 KiB
Groovy

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 https://$GIT_USER:$GIT_PASS@gitea.dev.bodnarescu.ro/s_zsolt/test_git.git HEAD:main
'''
}
}
}
}
}