-
Notifications
You must be signed in to change notification settings - Fork 738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automate build instructions using Ansible #1213
Automate build instructions using Ansible #1213
Conversation
Hi @samolisov. Thanks for the contribution. Before we can accept your contribution (which still needs to be reviewed) please follow the contribution guidelines https://github.com/eclipse/openj9/blob/master/CONTRIBUTING.md in the "Legal considerations" section in order to pass the ip-validation check. Until this check passes the contribution cannot be accepted. All the files should be updated with the Eclipse & Apache license which you can copy from almost any other file, such as https://github.com/eclipse/openj9/blob/master/.travis.yml |
Hi @pshipton I've added the headers (just squashing the commit). Unfortunately, the build doesn't work, it looks like fremarker is not available. |
The docker file (i.e. https://github.com/eclipse/openj9/blob/master/buildenv/docker/jdk8/x86_64/ubuntu16/Dockerfile) shows how to get freemarker. There are some instructions for specifying the location of freemarker here https://www.eclipse.org/openj9/oj9_build.html |
@pshipton Freemarker wasn't available not only for me but also for the Travis CI environment as well. Now everything is ok. I've activated my ECA record and added the license headers to all files. Could anyone trigger the Travis CI build if it's required for the merge process? |
Please push a new commit to re-run the ip-validation check, we can't restart it. |
@pshipton Thank you for the advice. All checks have passed |
tags: | ||
- buildenv | ||
- build | ||
- name: Install python to container if there isn''t one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit pick isn''t
-> isn't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to name: Install python to the container if there is no one
.
@samolisov if I'm not mistaken, you're not an IBM employee. In which case, you may not want to include IBM's copyright notice (top line in each file header) in the new files you're contributing. You can have your own copyright if you're submitting under your own name, otherwise your employer may wish to exert their copyright. I am not giving you legal advice, just want to make you aware you have options. Also, I would like to suggest changing ibm:ibmuser to openj9:openj9 or openj9:openj9user since this project is OpenJ9 and not owned by IBM. |
platform: x86_64 # ppc64le, s390x, x86_64 | ||
target: | ||
namespace: eclipse | ||
javahome: /opt/ibm/openj9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here's another thing that shouldn't be associated with IBM, please
&& apt-get update | ||
|
||
# Set the java home directory | ||
ARG JAVA_HOME=/opt/ibm/openj9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another ibm here
&& chown -f $USER:$GROUP $JAVA_HOME/sample || : | ||
# small hach to ensure chown for a non-exist directory won't interrupt the build process. | ||
|
||
# Change to the IBM user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and an unnecessary IBM here that should be removed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update all the ibm and IBM references (in the files as well as the commit message) and consider if you want to change the copyright statements you've put into these new files.
Ansible is the most popular open source automation tool on GitHub today with more than a quarter million downloads per month. The ansible playbook produces a docker image based on Ubuntu 16.4. The docker image contains the Eclipse OpenJ9 virtual machine. The owner of the virtual machine is the 'openj9' user (configurable) who is a member of the 'openj9' group (configurable). A container created over the image runs as the 'openj9' non-privileged user. The build process is broken down into the following phases: - create a docker container with the build environment - checkout the sources of ibmruntimes, omr and openj9 - build openj9 from sources - archive the jdk - create a docker image and put the jdk inside - clean-up the build-environment (the phase might be skipped) To start the build do: $ ansible-playbook -i inventories/local/hosts openj9-docker-image.yml Signed-off-by: Pavel Samolysov <samolisov@gmail.com>
@mstoodle Thank you very much for your comments. Yes, I left IBM about 1.5 years ago and currently I'm not an IBM employee, so I've considered changing the copyright header to my name. Also, I've changed all Unfortunately, currently (11.03.2018 10:00-11:00 MSK) the
|
Copyright checks fail since I've change the copyright header for the new files. Does the PR have a chance to be merged? // cc @mstoodle |
Jenkins copyright check |
|
@samolisov Are you still seeing the build problems you mentioned on March 11 ? I'm loathe to merge the PR if the scripts aren't quite working. Also one other question: can you think of a way we could make an executable test out of these files, so that we can easily make sure they keep working once they get merged? Finally, would you please update the |
@mstoodle I can't see the problem anymore: $ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
eclipse/openj9-jdk8 linux-x86_64-20180319202723 b8426d36e151 13 hours ago 447MB
$ docker run -it --name openj9-jdk8-new -v /home/ansible/hostdir:/opt/hostdir eclipse/openj9-jdk8:linux-x86_64-20180319202723
openj9@96e5788ea010:/opt/openj9$ whoami
openj9
openj9@96e5788ea010:/opt/openj9$ java -version
openjdk version "1.8.0_162-internal"
OpenJDK Runtime Environment (build 1.8.0_162-internal-_2018_03_19_15_12-b00)
Eclipse OpenJ9 VM (build master-8f002eb, JRE 1.8.0 Linux amd64-64 Compressed References 20180319_000000 (JIT enabled, AOT enabled)
OpenJ9 - 8f002eb
OMR - e79d614
JCL - 7580d49 based on jdk8u162-b12)
openj9@96e5788ea010:/opt/openj9$ About testing Ansible playbooks, please have a look at an amazing Ansible documentation: Check Mode (“Dry Run”). A brief description: this command will report what changes the playbook would have made rather than making them: $ ansible-playbook -i inventories/local/hosts openj9-docker-image.yml --check --diff But it works only if an Ansible module supports dry run else a task should just be ignored but, as I see, the Generally speaking, testing of Infrastructure as Code is a common problem in DevOps. If you don't run your scripts automatically and often, in some time they become absolutely unusable. The better way maybe is just to use this playbook on a CI platform to build and test Eclipse OpenJ9 docker images. |
@Sorry for the delay @samolisov! @AdamBrousseau are you also ok with this PR at this point? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lftm
@AdamBrousseau or @jdekonin are you able to run the build and confirm that it still works? |
Is the PR still actual for the project? |
I haven't been able to get this to work, mind you I have very limited ansible experience. The error I am getting is The existing build scripts used on jenkins via pipelines are how we use them in a larger across more than one platform at a time scale, but I am not opposed to different methods of generating a OpenJ9 binary, this is just a method that I personally am not familiar with. |
I am no expert in this area, but I finally "broke down" and installed ansible into a docker container to try this out, and had the same experience as @jdekonin reported above (expecting key=value in the inventory file). For giggles, I also tried removing that -i option and got the following output:
...which just looks like a file is not being interpreted correctly by something. @samolisov we're probably making foolish noob mistakes, can you help to point us in the right direction? I was just following the direction in your commit message (i.e. I just ran |
@mstoodle @jdekonin Thank you for the interest to the PR! Could you check the ansible version, please? I tested all stuff on Ansible 2.4.2.0. The error you got with the inventory file seems to indicate that ansible can't interpret a yaml-formatted inventory file, a new in version 2.4 feature. This is my bad, unfortunately; I've added the minimum version info to the PR's description. |
Editted: I am running docker on a mac to load ub16, I thought it was with ansible 2.4.2.0 but now I am doubting...trying again. |
Tried this, works fine on an Ubuntu 16.04 VM and creates what was expected. The only wrinkles are that you need a newer version of docker than is provided in the 16.04 repos, and you need docker-py, which I installed from pip. |
Looks like a great way to automate things on our build farm as well. Looking forward to seeing this merged! |
Unless there are any objections I'm going to merge this tomorrow-ish since it has value and works as advertised. |
Merged. Thanks for the contribution. |
Ansible is the most popular open source automation tool on GitHub today
with more than a quarter million downloads per month.
The ansible playbook produces a docker image based on Ubuntu 16.4. The docker
image contains the Eclipse OpenJ9 virtual machine. The owner of the virtual
machine is the
openj9
user (configurable) who is a member of theopenj9
group(configurable). A container created over the image runs as the
openj9
non-privileged user.
The build process is broken down into the following phases:
How to run the build:
Note: Ansible 2.4+ is required.