LLLDDD 麻烦把流水线的各种配置说明一下
包括代码仓库、流水线最终产生的jenkinsfile

    runzexia
    pipeline {
    agent {
    node {
    label ‘maven’
    }

    }
    stages {
    stage(‘Checkout SCM’) {
    steps {
    git(url: ‘http://10.10.8.182/hxpaas/gcweb.git’, credentialsId: ‘gitlab-id’, branch: ‘master’, changelog: true, poll: false)
    }
    }
    stage(‘Unit Test’) {
    steps {
    container(‘maven’) {
    sh ‘mvn clean -o -gs pwd/configuration/settings.xml test’
    }

      }
    }
    stage('Code Analysis') {
      steps {
        container('maven') {
          withCredentials([string(credentialsId : 'sonar-token' ,variable : 'SONAR_TOKEN' ,)]) {
            withSonarQubeEnv('sonar') {
              sh 'mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.branch=$BRANCH_NAME -Dsonar.login=$SONAR_TOKEN'
            }
    
          }
    
          timeout(unit: 'HOURS', activity: true, time: 1) {
            waitForQualityGate 'true'
          }
    
        }
    
      }
    }
    stage('Build and Push') {
      steps {
        container('maven') {
          sh 'mvn -o -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package'
          sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BUILD_NUMBER .'
          withCredentials([usernamePassword(credentialsId : 'dockerhub-id' ,passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,)]) {
            sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
            sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BUILD_NUMBER'
          }
    
        }
    
      }
    }
    stage('Artifacts') {
      steps {
        archiveArtifacts 'target/*.war'
      }
    }
    stage('Deploy to DEV') {
      steps {
        input(message: '@admin  ', submitter: 'admin')
        kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'deploy/dev/**')
        mail(to: '15556695962@163.com', subject: '流水线完成', body: '应用部署完成')
      }
    }

    }
    }

    LLLDDD
    是以devops-java-sample项目为配置的吗?不是的话,对比实例和你本身项目configuration/settings.xml目录问题。

      4 个月 后
      1 年 后

      也是这个问题 用的提供的项目文件 请问是咋解决的啊

      2 年 后

      该github项目之前提了一个commit(kubesphere/devops-maven-sample#5/commits/9b1b30aab87cc405d68aafbf2e23136ac6ebcdb7),将这个settings.xml已经删掉了,所以没有该文件,可以将教程中流水线的bash指令:
      mvn clean -gs `pwd`/configuration/settings.xml test 修改为 mvn clean test 即可。