Open Jgerardopine opened 6 years ago
No response? Having a very similar problem with --with-variables option. I thought it would work similar to --extra-vars in ansible-playbook but no dice. Has no real documentation and AFAICT it does nothing.
Hi @bmcgair , They didn't answer but I found the way to do it. You need to use the environment variables under your role:
services:
jenkins-master:
from: "image"
roles:
- role: master
environment:
JENKINS_UC_DOWNLOAD: http://mirrors.jenkins-ci.org
JAVA_OPTS: "-Xmx4096m -Djenkins.install.runSetupWizard=false"
JENKINS_OPTS: "--logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --argumentsRealm.passwd.jenkins={{ JENKINS_PWD }} --argumentsRealm.roles.jenkins=admin --httpPort={{ HTTP_PORT }} --prefix=/jenkins"
After doing it this way it works perfectly. Hope it helps.
ISSUE TYPE
Hi,
I am struggling with a similar situation exposed here but it is a bit different as he has a workaround when running it, whereas I need it when being build. I followed the example contained here WHAT I AM TRYING TO DO: Create a jenkins container. My Dockerfile works fine but when translating it (manually, not using the import option of ansible-container) I have problems because the environment variables needed for the build are not taken in consideration, thus it fails.
container.yml (uncomment the environment variables when testing)
tasks/main.yml
Dockerfile
DEBUG ERROR:
SUMMARY
WHAT I HAVE DONE:
As you can see the ENV JENKINS_UC_DOWNLOAD is "http://mirrors.jenkins-ci.org" but when it builds the container it still uses the default URL. As you can see it is important to make those variables available for the building process as there are some of them that needs to be passed to the container so it can work properly when being build.
Do you have a workaround or maybe getting closer to get this feature working anytime soon?
STEPS TO REPRODUCE
or
EXPECTED RESULTS
ACTUAL RESULTS
It fails when trying any different way there si to include ENV VARIABLES
Thanks for your help and support in advance.