Git Product home page Git Product logo

jenkins-katas's Introduction

Jenkins Kata

Look into the labs folder for exercises

Open in google cloud shell

Open in Cloud Shell

Spin up the Jenkins server by running: docker-compose up -d Jenkins is running on port 8080

Username: admin Password: 7p4rk3r4qgp3c2020 without 2020

Layout of this repository

.
├── app             # The application itself
├── ci              # Folder for all the ci specific files
├── component-test  # Python component test and setup
├── examples        # Examples of the different exercise solutions and more.
├── img             # Images for the readmes in the labs folder
├── labs            # All different exercises in Jenkins
└── setup           # Setup of jenkins.

jenkins-katas's People

Contributors

asimell avatar atombrella avatar bicschneider avatar cipy avatar dependabot[bot] avatar freyacodes avatar michaeldepner avatar michaelvl avatar mortench3000 avatar sofusalbertsen avatar zanderhavgaard avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jenkins-katas's Issues

Jenkins docker agent not executing correctly

While teaching Jenkins using this kata, multiple students confronted an issue where agents defined as docker containers would not execute.

The problem was persistent throughout different OS's and environments: some were running Vagrant (VirtualBox) on Windows, some Docker Desktop on Windows or macOS.

I personally could not reproduce the problem. My environment was running Jenkins on Docker Desktop (Windows) and everything worked as expected.

Only consistent messages that showed in the logs every time the problem occurred was

...
Jenkins does not seem to be running inside a container - -
...

while everywhere where things worked, the corresponding log-entry was

[Pipeline] sh
+ docker inspect -f . gradle:6-jdk11
.
[Pipeline] withDockerContainer
Jenkins seems to be running inside container 7886fea1c6ff2c3c59dba72500f73d00693fc64e06b600635c16c5ec8d76e2f2
$ docker run -t -d -u 0:0 -w /var/jenkins_home/workspace/jenkins-katas_master@2 --volumes-from 7886fea1c6ff2c3c59dba72500f73d00693fc64e06b600635c16c5ec8d76e2f2 -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** gradle:6-jdk11 cat
$ docker top 58d0ce76181245e4e5a72a3f93718ce18da85a00a159d4ea3d5b78ede3012854 -eo pid,comm

Multibranch pipeline does not scan for changes by default

We have to add to exercise 1 or 2, that students should go and enable periodic scan of repository in the "old" Jenkins UI. If not, their commits will not automatically trigger a build.

Either add it as an optional to the exercise, or add a slide and show it to the students.

Jenkins swarm agent fails in dind scenario.

Working:

pipeline {
  agent any
      
  stages {
    

   stage('Parallel execution') {
      parallel {
        stage('build app') {
          
          steps {
            sh 'echo hello world'
          }
        }
        stage('build app2') {
          
          steps {
            sh 'echo hello world'
          }
        }        
        stage('build app3') {
         
          steps {
            sh 'echo hello world'
          }
        }        
        stage('build app4') {
          
          steps {
            sh 'echo hello world'
          }
        }        
        stage('build app5') {
          
          steps {
            sh 'echo hello world'
          }
        }
        stage('build app6') {
          
          steps {
            sh 'echo hello world'
          }
        }
      }
    }

  }
}

Not working:

pipeline {
  agent any
      
  stages {
    

   stage('Parallel execution') {
      parallel {
        stage('build app') {
          agent {
            docker {
              image 'debian'
            }
          }
          steps {
            sh 'echo hello world'
          }
        }
        stage('build app2') {
          agent {
            docker {
              image 'debian'
            }
          }
          steps {
            sh 'echo hello world'
          }
        }        
        stage('build app3') {
          agent {
            docker {
              image 'debian'
            }
          }
          steps {
            sh 'echo hello world'
          }
        }        
        stage('build app4') {
          agent {
            docker {
              image 'debian'
            }
          }
          steps {
            sh 'echo hello world'
          }
        }        
        stage('build app5') {
          agent {
            docker {
              image 'debian'
            }
          }
          steps {
            sh 'echo hello world'
          }
        }
        stage('build app6') {
          agent {
            docker {
              image 'debian'
            }
          }
          steps {
            sh 'echo hello world'
          }
        }
      }
    }

  }
}

Reason is some kind of sketchy docker in docker part :(

Unable to start Jenkins in Google Cloud Shell

Running docker-compose up -d in Google Cloud Shell leads to the following error:

michael_ingeman_nielsen@cloudshell:~/jenkins-katas/setup$ docker-compose up -d
Creating network "setup_default" with the default driver
Creating volume "setup_jenkins_home" with default driver
Pulling jenkins (praqma/jenkins-kata-jenkins:latest)...
latest: Pulling from praqma/jenkins-kata-jenkins
3192219afd04: Pulling fs layer
17c160265e75: Pulling fs layer
...
Status: Downloaded newer image for praqma/jenkins-kata-jenkins:latest
Building swarm_agent
ERROR: gcloud failed to load: /tmp/_MEITOPJ2m/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /usr/lib/python3.7/lib-dynload/_ssl.cpython-37m-x86_64-linux-gnu.so)
...
docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-gcloud exited with "".',)
[15137] Failed to execute script docker-compose
michael_ingeman_nielsen@cloudshell:~/jenkins-katas/setup$

There are existing issues on this here and here. A workaround is described in the issue: Running export LD_LIBRARY_PATH=/usr/local/lib in the Cloud Shell before building works for me, but really shouldn't be necessary.

Minimum requirements when manually installing a Jenkins server

I've tried running the katas on a Jenkins instance installed using apt. There are a few prerequisites that might be worth mentioning in setup-on-your-own.md.

  1. Docker must be available on the server and/or worker instance
  2. The user running Jenkins ("jenkins" user by default) must be added to the Docker group
  3. Ensure the Blue Ocean plugin is installed. It isn't installed by default or as part of the recommended plugins in a manually installed Jenkins instance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.