Update Jenkinsfile
This commit is contained in:
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@@ -1,8 +1,13 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
|
environment {
|
||||||
|
GIT_CREDENTIALS = 'gitea-creds'
|
||||||
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
|
||||||
|
stage('Checkout SCM') {
|
||||||
steps {
|
steps {
|
||||||
checkout scm
|
checkout scm
|
||||||
}
|
}
|
||||||
@@ -11,7 +16,8 @@ pipeline {
|
|||||||
stage('Create file') {
|
stage('Create file') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
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 {
|
steps {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
usernamePassword(
|
usernamePassword(
|
||||||
credentialsId: 'gitea-creds',
|
credentialsId: env.GIT_CREDENTIALS,
|
||||||
usernameVariable: 'GIT_USER',
|
usernameVariable: 'GIT_USER',
|
||||||
passwordVariable: 'GIT_PASS'
|
passwordVariable: 'GIT_PASS'
|
||||||
)
|
)
|
||||||
@@ -29,10 +35,10 @@ pipeline {
|
|||||||
git config user.email "jenkins@local"
|
git config user.email "jenkins@local"
|
||||||
git config user.name "Jenkins"
|
git config user.name "Jenkins"
|
||||||
|
|
||||||
git add jenkis_test.txt
|
git add jenkis.txt
|
||||||
git commit -m "Jenkins: add jenkis_test.txt" || echo "Nothing to commit"
|
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
|
|
||||||
|
|
||||||
|
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