Welcome to the Linux Foundation Forum!

Lab 6 Containers not building

I followed the directions and pushed upstream then created and accepted PR. However, when I am looking at the logs, I am not seeing containers being built. Below is my console output from my most recent worker-build:

Started by an SCM change
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/instavote/worker-build
The recommended git tool is: NONE
No credentials specified


  git rev-parse --resolve-git-dir /var/jenkins_home/workspace/instavote/worker-build/.git # timeout=10


Fetching changes from the remote Git repository


  git config remote.origin.url https://github.com/5c077-60rd0n/example-voting-app.git # timeout=10


Fetching upstream changes from https://github.com/5c077-60rd0n/example-voting-app.git


  git --version # timeout=10

Answers

  • I will just leave the tail of the log since it seems there is a char limit:

    <===[JENKINS REMOTING CAPACITY]===>channel started
    Executing Maven:  -B -f /var/jenkins_home/workspace/instavote/worker-build/worker/pom.xml compile
    [INFO] Scanning for projects...
    [INFO] 
    [INFO] ---------------------------< worker:worker >----------------------------
    [INFO] Building worker 1.0-SNAPSHOT
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ worker ---
    [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] skip non existing resourceDirectory /var/jenkins_home/workspace/instavote/worker-build/worker/src/main/resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ worker ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  1.527 s
    [INFO] Finished at: 2023-11-03T15:04:12Z
    [INFO] ------------------------------------------------------------------------
    Waiting for Jenkins to finish collecting data
    [JENKINS] Archiving /var/jenkins_home/workspace/instavote/worker-build/worker/pom.xml to worker/worker/1.0-SNAPSHOT/worker-1.0-SNAPSHOT.pom
    Triggering a new build of instavote » worker-test
    Finished: SUCCESS
    
  • This is my Jenkinsfile that resides in my worker directory: It shows code from Lab 7 as well.

    ipeline {
      agent {
        docker {
          image 'maven:3.6.1-jdk-8-slim'
          args '-v $HOME/.m2:/root/.m2'
        }
      } 
    
      stages {
        stage('build') {
          steps {
            echo 'building worker app'
            dir('worker') {
              sh 'mvn compile'
            }
          }
        }
        stage('test') {
          steps {
            echo 'running unit tests on morker app'
            dir('worker') {
              sh 'mvn clean test'
            }
          }
        }
        stage('package') {
          steps {
            echo 'packaging worker app into a jarfile'
            dir('worker') {
              sh 'mvn package -DskipTests'
              archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
            }
          }
        }
        stage('docker-package') {
          agent any
          steps {
            echo 'Packaging worker app with docker'
            script {
              docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') {
                def workerImage = docker.build("sagordondevops/worker:v${env.BUILD_ID}", "./worker")
                workerImage.push()
                workerImage.push('latest')
              }
            }
          }
        }
      }
    
      post {
        always {
          echo 'the job is complete'
        }
      }
    }
    
  • Hi @scott.gordon, I'll go through Lab 6 and will provide you an update as soon as I can.

    Regards,
    Luis.

  • luisviveropena
    luisviveropena Posts: 1,249
    edited November 2023

    Hi @scott.gordon,

    The console output looks good, in fact it finished with "BUILD SUCCESS".

    What do you get when you take a look at the 'docker ps' with watch, as shown in the Validation section of Lab 6?

    Regards,
    Luis.

Categories

Upcoming Training