Closed martinpring closed 6 years ago
We have no feedback on this part. Happy to see some users !
So, it seems you're right. @martinpring : would you like to contribute to fix it ?
The openjdk image only has a user root so if you do that you’ll be logged as an anonymous user. Some tools such as bower don’t like that and will fail.
The correct way to fix it is to do a userns-remap. See #4600 for details
The workflow is more complex than I thought. If I understand well:
I know this has been discussed at length in #4600 but I really wonder whether the use of Docker should be a question of ci-cd generator. Beside this user mapping issue, I'm also concerned by memory settings for both java and node as we know it's something to be careful with in Docker, this morning I just had to increase max_old_space_size to 6GB for webpack prod build.
@pascalgrimaud the workflow is as you described it. I'm out of town a few days but will read what is said in #4600 It seems that this issue will affect more things so I will follow the discussion further.
IMO we already have a standard way to build docker image and that is using the dockerfile maven plugin. I know doing this with the Jenkinsfile might give a better UI and access to Jenkins API but it would be better if we stick to the standard way which is mvn dockerfile:build
@PierreBesson the problem would be that if you use a docker image to build you need to do docker-in-docker which is a PITA...
@cbornet I understand that the use of docker is meant to install as less as possible dependencies/plugins in Jenkins but as far as I know the only dependency our builds have is the JDK, mvn and gradle are installed locally due to wrappers, node/npm/yarn are also installed locally due to frontend-maven-plugin.
So I really think docker should be an option.
@gmarziou it IS an option 😃
😳 Oops, sorry it's been long time since I used it . Just did it now and it's great. :)
One solution I found is to add a new question: Do you use a Dockerized Jenkins version ?
What do you think?
I don’t think this is linked to using a dockerized jenkins
This has been stuck for more than 2 months, should we close it as we can't find a good solution? I understand we need to use userns-remap but that's a lot of work, and it's complex to test - if nobody volunteers to do this, let's close this
yes, let's close this In all case, I need to test the CICD before the JHipster release v5, and will probably rework this sub generator as we won't need bower/gulp anymore
Overview of the issue
The jhipster ci-cd subgenerator creates an Jenkinsfile which I have to modify to make it run without errors.
In the Jenkinsfile the user
root
is used to execute processes inside the docker container. This cause problems whenjenkins
later want to copy to target directory which now is owned byroot
.Motivation for or Use Case
To execute every step in the Jenkinsfile created by the ci-cd subgenerator.
Reproduce the error
Create an monolith application with maven to build the backend
$ yo jhipster:ci-cd
Add, commit and push to remote git repository
The Jenkinsfile should look like this
The projects workspace directory on Jenkins will look like this:
Related issues
Suggest a Fix
docker.image('openjdk:8').inside('-e MAVEN_OPTS="-Duser.home=./"')
everything will run as expected and the projects workspace directory on Jenkins will now look like this:JHipster Version(s)
4.10.0
JHipster configuration
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryBrowsers and Operating System
Jenkins run on Ubuntu Server 16.04 ( Ubuntu 16.04.3 LTS )