Skip to content
Snippets Groups Projects
Select Git revision
  • 669f4a5f4e423488a8b8b109ae69457fc83ba187
  • master default protected
2 results

Jenkinsfile

Blame
  • user avatar
    Thibault authored
    669f4a5f
    History
    Jenkinsfile 1.03 KiB
    node{
        def app
        def registryProject='http://172.20.0.2:8083/repository/RegistryDocker/' 
        def image="${registryProject}:version-${env.BUILD_ID}"
    
            stage('Clone') {
                checkout scm
            }
    
            stage('Scan hadolint'){
                sh 'docker run --rm -i hadolint/hadolint < Dockerfile > rapportHadolint || true'
            }
    
            stage('Build image') {
                app = docker.build ("debian:buster")
            }
    
            stage('Test image') {
                docker.image('debian:buster').withRun() { c -> 
                            
                sh 'docker ps'
            }
            }
            stage('Scan Dockle'){
                sh 'dockle debian:buster > rapportDockle'
            }
    
            stage('Scan Clair'){
                sh '''
                ./clair-scanner --report="rapportClair" --ip="172.20.0.5" --clair="http://172.20.0.6:6060" debian:buster || exit 0
                '''
            }
            stage('Push on repo nexus'){
                docker.withRegistry(registryProject,'Jenkins-credential'){
                app.push()
        }     
      }
    
    
       
    }