Page 51 - Yazılım Teknolojileri Araştırma Bülteni 2023
P. 51

CI/CD Süreç Yönetimi | 51






                       sh ‘git push --set-upstream origin master’
                    }
                 }
              }
            }
            pipeline {
             agent any
             stages {
                stage(‘JIRA Version Check’) {
                   steps {
                      jiraVersionCheck()
                   }
                }
                stage(‘Checkout code’) {
                   steps {
                      checkout scm
                   }
                }
                stage(‘Package’) {
                   steps {
                      echo ‘Build & Deploy’
                      sh’’’
                      docker build -t yte.bilgem.gov.tr/demo_app:v$VERSION .
                      docker login -u username -p password yte.bilgem.gov.tr:9092
                      docker push yte.bilgem.gov.tr/demo_app:v$VERSION
                      ‘’’
                   }
                }
                stage(‘Create git tag’) {
                   steps {
                      withCredentials([gitUsernamePassword(credentialsId: ‘hf6783nc-
            23mb4a-                       f36-g423-e563454wpfn4’, gitToolName: ‘Default’)]) {
                         sh ‘git tag -fa $VERSION -m “$VERSION”’
                         sh ‘git push origin --tags’
                      }
                   }
                }
             }
             post {
                success {
                   script {
                      build job:’YTE-SONAR/SONAR-Demo-App’ , parameters:[
                              string(name: ‘BRANCHNAME’,value: getBranch()),
                              string(name: ‘VERSION’,value:”${VERSION}”)
                      ] , wait: false
                   }
               gitOpsDeploy()
                   cleanWs()
                }
                failure {
                   cleanWs()
                }
             }
            }
   46   47   48   49   50   51   52   53   54   55   56