diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 943e892..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,30 +0,0 @@ -node { - def app - - stage('Clone repository') { - sh '/usr/bin/env' - /* Let's make sure we have the repository cloned to our workspace */ - checkout scm - } - - stage('Build image') { - sh '/usr/bin/env' - /* This builds the actual image; synonymous to - * docker build on the command line */ - app = docker.build("jenkins/sos-milter") - } - - stage('Test image') { - /* Ideally, we would run a test framework against our image. - * For this example, we're using a Volkswagen-type approach ;-) */ - app.inside { - sh 'echo "Tests passed"' - } - } - - stage('Push image') { - docker.withRegistry('https://dockreg-fra.zwackl.de') { - app.push() - } - } -} diff --git a/Jenkinsfile b/Jenkinsfile new file mode 120000 index 0000000..ba910c8 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1 @@ +Jenkinsfile.declarative \ No newline at end of file diff --git a/Jenkinsfile.declarative b/Jenkinsfile.declarative new file mode 100644 index 0000000..3d706ae --- /dev/null +++ b/Jenkinsfile.declarative @@ -0,0 +1,37 @@ +pipeline { + agent any + def docker_image + + stages { + stage('Checkout SCM') { + checkout scm + } + + stage('Build image') { + steps { + sh '/usr/bin/env' + /* This builds the actual image; synonymous to + * docker build on the command line */ + docker_image = docker.build("jenkins/sos-milter") + } + } + + stage('Test image') { + steps { + /* Ideally, we would run a test framework against our image. + * For this example, we're using a Volkswagen-type approach ;-) */ + docker_image.inside { + sh 'echo "Tests passed"' + } + } + } + + stage('Push image') { + steps { + docker.withRegistry('https://dockreg-fra.zwackl.de') { + docker_image.push() + } + } + } + } +} diff --git a/Jenkinsfile.scripted b/Jenkinsfile.scripted new file mode 100644 index 0000000..e71a5d3 --- /dev/null +++ b/Jenkinsfile.scripted @@ -0,0 +1,29 @@ +node { + def docker_image + + stage('Clone repository') { + sh '/usr/bin/env' + /* Let's make sure we have the repository cloned to our workspace */ + checkout scm + } + + stage('Build image') { + /* This builds the actual image; synonymous to + * docker build on the command line */ + docker_image = docker.build("jenkins/sos-milter") + } + + stage('Test image') { + /* Ideally, we would run a test framework against our image. + * For this example, we're using a Volkswagen-type docker_imageroach ;-) */ + docker_image.inside { + sh 'echo "Tests passed"' + } + } + + stage('Push image') { + docker.withRegistry('https://dockreg-fra.zwackl.de') { + docker_image.push() + } + } +}