Update Jenkinsfile
This commit is contained in:
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@@ -1,8 +1,13 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
GIT_CREDENTIALS = 'gitea-creds'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
|
||||
stage('Checkout SCM') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
@@ -11,7 +16,8 @@ pipeline {
|
||||
stage('Create file') {
|
||||
steps {
|
||||
sh '''
|
||||
echo "Hello from Jenkins" > jenkis_test.txt
|
||||
echo "Hello from Jenkins! Current time is $(date), run number ${BUILD_NUMBER}" > jenkis.txt
|
||||
cat jenkis.txt
|
||||
'''
|
||||
}
|
||||
}
|
||||
@@ -20,7 +26,7 @@ pipeline {
|
||||
steps {
|
||||
withCredentials([
|
||||
usernamePassword(
|
||||
credentialsId: 'gitea-creds',
|
||||
credentialsId: env.GIT_CREDENTIALS,
|
||||
usernameVariable: 'GIT_USER',
|
||||
passwordVariable: 'GIT_PASS'
|
||||
)
|
||||
@@ -29,10 +35,10 @@ pipeline {
|
||||
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
|
||||
git add jenkis.txt
|
||||
git commit -m "Jenkins: update jenkis.txt for run ${BUILD_NUMBER}" || echo "Nothing to commit"
|
||||
|
||||
git push https://$GIT_USER:$GIT_PASS@gitea.dev.bodnarescu.ro/s_zsolt/test_git.git HEAD:main
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user