From bb8d523f474e6910b2c2fccfccbe1c8b63ca28a3 Mon Sep 17 00:00:00 2001 From: s_zsolt Date: Thu, 5 Feb 2026 17:52:01 +0000 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6d81f9e..4047397 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 ''' } }