Jenkins 詹金斯没有';t运行更新的文件

Jenkins 詹金斯没有';t运行更新的文件,jenkins,jenkins-pipeline,Jenkins,Jenkins Pipeline,我让Jenkins和GitLab在Docker容器中运行。 Jenkins Maven管道从GitLab实例获取其代码。管道中的commit标记是最后一次正确的推送,但管道始终使用inital Jenkinsfile,并且在每次推送后不会更新 pipeline { enviroment{ BUILD_IMAGE = getImageName() REGISTRY = 'http://127.0.0.1:8082' CRED_ID = 'max'

我让Jenkins和GitLab在Docker容器中运行。 Jenkins Maven管道从GitLab实例获取其代码。管道中的commit标记是最后一次正确的推送,但管道始终使用inital Jenkinsfile,并且在每次推送后不会更新

pipeline {
    enviroment{
      BUILD_IMAGE = getImageName()
      REGISTRY = 'http://127.0.0.1:8082'
      CRED_ID = 'max'
    }
    def app

    def getImageName(){
        return mvn help:evaluate -Dexpression=project.build.finalName -q -DforceStdout
    }

    agent any

    stages {
        stage('build') {
            steps {
                sh 'mvn package -Dmaven.test.skip=true'
            }
        }
        stage('test'){
            steps {
                sh 'mvn test'
            }
        }
        stage('docker build'){
            steps{
                app = docker.build(BUILD_IMAGE)
            }
        }
        stage("docker push"){
            steps{
                docker.withRegistry(REGISTRY,CRED_ID){
                    GIT_TAG = sh(git rev-parse --short HEAD)
                    app.push(GIT_TAG)
                    app.push("latest")
                }
            }
        }
    }
}

这是docker compose的

version: '3.7'

services:
  gitlab:
    image: gitlab/gitlab-ce
    ports: 
      - "9080:80"
      - "9443:433"
      - "9022:22"
    volumes:
      - ./data/gitlab/config:/etc/gitlab
      - ./data/gitlab/logs:/var/log/gitlab
      - ./data/gitlab/data:/var/opt/gitlab

  jenkins:
    build:
      context: ./jenkins/.
    ports:
      - "9083:8080"
    depends_on:
      - gitlab
      - nexus
    volumes:
      - ./data/jenkins:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/local/Cellar/maven/3.6.1/libexec:/usr/local/Cellar/maven/3.6.1/libexec
    links:
      - gitlab:gitlab
      - nexus:nexus
    depends_on:
      - gitlab

以及相应的
Dockerfile

FROM jenkins/jenkins

USER root
RUN apt-get update -qq \
    && apt-get install -qqy apt-transport-https ca-certificates curl gnupg2 software-properties-common 
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
RUN add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/debian \
    $(lsb_release -cs) \
    stable"
RUN apt-get update  -qq \
    && apt-get install docker-ce -y
RUN usermod -aG docker jenkins
通过查看(Jenkins容器的)共享卷,我找到了repo。它有一个新的詹金斯档案

也许Jenkins会缓存初始的Jenkins文件而忽略较新的文件