Sounds like a bug - could you open a JIRA in the pipeline-model-definition
component?

On Dec 27, 2016 17:03, "Josh S" <joshery...@gmail.com> wrote:

> Jenkins v2.19.4 (running in a Docker container with -v
> /var/run/docker.sock:/var/run/docker.sock to help prevent
> Docker-in-Docker issues)
> Blue Ocean beta plugin v1.0.0-b14
>
> Simply put, I'm having trouble getting a Declarative Pipeline to work with
> a Dockerfile.
> As you can see in the copied Jenkinsfile and Dockerfile below, if I use
> the openjdk:8-jdk docker image directly everything is dandy, but if I use a
> Docker file that contains *the exact same code* as the current 8-jdk
> Dockerfile, nothing works right.
>
> From the log output (also below via paste.ee, since pastebin wasn't
> working for me!) it appears to *build* the Docker image, but it never
> runs it for some reason.
>
> Can someone help me understand what I'm doing wrong?
>
> Jenkinsfile
> #!groovy
>
> pipeline {
>     // The following fails!
>     agent label:'docker', dockerfile:true
>     // Yet using the exact same content as a pre-built Docker image works!
>     // agent label:'docker', docker:'openjdk:8-jdk'
>     stages {
>         stage('Build It!') {
>             steps {
>                 echo 'Def building here.'
>                 sh 'hostname'
>                 sh 'java -version'
>             }
>         }
>
>
>         stage('Deploy & Test It!!') {
>             steps {
>                 parallel (
>                     'Hyper-V Windows Server 2012 R2': {
>                         echo 'Should deploy Windows 2012 R2 things here!'
>                         sh 'hostname'
>                         sh 'java -version'
>                     },
>                     'Hyper-V Windows Server 2016': {
>                         echo 'Should deploy Windows 2016 things here!'
>                         sh 'hostname'
>                         sh 'java -version'
>                     }
>                 )
>             }
>         }
>
>
>         stage('Report It!') {
>             steps {
>                 echo 'Tell \'em what you found!'
>                 sh 'hostname'
>                 sh 'java -version'
>             }
>         }
>     }
>
>
>     post {
>         always {
>             echo 'Deleting workspace directories...'
>             deleteDir()
>         }
>
>
>         success {
>             echo 'Huzzah, it actually worked!'
>         }
>
>
>         failure {
>             echo 'Nyet, again!'
>         }
>     }
> }
>
>
> Dockerfile
> FROM buildpack-deps:jessie-scm
>
>
> # A few problems with compiling Java from source:
> #  1. Oracle.  Licensing prevents us from redistributing the official JDK.
> #  2. Compiling OpenJDK also requires the JDK to be installed, and it gets
> #       really hairy.
>
>
> RUN apt-get update && apt-get install -y --no-install-recommends \
>  bzip2 \
>  unzip \
>  xz-utils \
>  && rm -rf /var/lib/apt/lists/*
>
>
> RUN echo 'deb http://deb.debian.org/debian jessie-backports main' >
> /etc/apt/sources.list.d/jessie-backports.list
>
>
> # Default to UTF-8 file.encoding
> ENV LANG C.UTF-8
>
>
> # add a simple script that can auto-detect the appropriate JAVA_HOME value
> # based on whether the JDK or only the JRE is installed
> RUN { \
>  echo '#!/bin/sh'; \
>  echo 'set -e'; \
>  echo; \
>  echo 'dirname "$(dirname "$(readlink -f "$(which javac || which
> java)")")"'; \
>  } > /usr/local/bin/docker-java-home \
>  && chmod +x /usr/local/bin/docker-java-home
>
>
> ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
>
>
> ENV JAVA_VERSION 8u111
> ENV JAVA_DEBIAN_VERSION 8u111-b14-2~bpo8+1
>
>
> # see https://bugs.debian.org/775775
> # and https://github.com/docker-library/java/issues/19#
> issuecomment-70546872
> ENV CA_CERTIFICATES_JAVA_VERSION 20140324
>
>
> RUN set -x \
>  && apt-get update \
>  && apt-get install -y \
>  openjdk-8-jdk="$JAVA_DEBIAN_VERSION" \
>  ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
>  && rm -rf /var/lib/apt/lists/* \
>  && [ "$JAVA_HOME" = "$(docker-java-home)" ]
>
>
> # see CA_CERTIFICATES_JAVA_VERSION notes above
> RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure
>
>
> # If you're reading this and have any feedback on how this image could be
> #   improved, please open an issue or a pull request so we can discuss it!
>
>
> Jenkins console log
> https://paste.ee/p/3Xfec#
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-dev/1ea1b20a-9930-45ea-a7b5-154a517de009%
> 40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/1ea1b20a-9930-45ea-a7b5-154a517de009%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAPbPdOaKR%3Da_K_4-Qd-8K-UJEpNjHMUQO_S2P%2B5NtPOFp0Qi0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to