Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-27132

Build not properly inheriting environment

    XMLWordPrintable

Details

    Description

      We're building a rails app into a Docker container, and as part of that in our Dockerfile we:

      `RUN bundle exec rake assets:precompile`

      This uses sprockets to compile the assets, generates a manifest file into the Docker image, and synchronizes the assets to S3 for exposure on the CDN. Asset synchronization occurs via credentials exposed in the environment of the user running the docker build command.

      This works locally, but it appears that this plugin doesn't run the build command in the same environment that the jenkins user runs, nor does it respect the environment variables injected into the workspace by jenkins.

      I'm not sure if this is a bug or a feature request, but either way, it'd be cool if this worked.

      Attachments

        Activity

          michaelneale Michael Neale added a comment -

          Not sure what you mean by environment variables - in a docker build - it can't really be parametrised by environment variables (the idea is that it runs the same, the Dockerfile is self describing).

          Can you explain more the steps you are doing? The environment from jenkins is provided the same as for a freestyle step when running the docker command - but that won't mean anything when running a docker build.

          I am probably not understanding what you are doing exactly - I gather in your image somewhere are pre-compiled assets you need to publish? what does it look like when you script it from outside?

          michaelneale Michael Neale added a comment - Not sure what you mean by environment variables - in a docker build - it can't really be parametrised by environment variables (the idea is that it runs the same, the Dockerfile is self describing). Can you explain more the steps you are doing? The environment from jenkins is provided the same as for a freestyle step when running the docker command - but that won't mean anything when running a docker build. I am probably not understanding what you are doing exactly - I gather in your image somewhere are pre-compiled assets you need to publish? what does it look like when you script it from outside?
          msaffitz Mike Saffitz added a comment -

          My apologies-- I had a .env file in the root of the directory that the base image was inheriting environment from without my knowledge. This isn't an issue for the docker build plugin

          msaffitz Mike Saffitz added a comment - My apologies-- I had a .env file in the root of the directory that the base image was inheriting environment from without my knowledge. This isn't an issue for the docker build plugin

          People

            michaelneale Michael Neale
            msaffitz Mike Saffitz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: