diff --git a/JenkinsNouvelleImage/Jenkinsfile b/JenkinsNouvelleImage/Jenkinsfile new file mode 100644 index 0000000000000000000000000000000000000000..adf39907f32a9e8c599c1141314d12b6d6d61b1a --- /dev/null +++ b/JenkinsNouvelleImage/Jenkinsfile @@ -0,0 +1,39 @@ +node{ + def app + def registryProject='http://registry-nexus: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=jenkins-blueocean --clair="http://clair-local-scan:6060" debian:buster || exit 0 + ''' + } + stage('Push on repo nexus'){ + docker.withRegistry(registryProject,'Jenkins-credential'){ + app.push() + } + } + +}