Skip to content

Commit

Permalink
Merge pull request #2166 from WindhoverLabs/ci
Browse files Browse the repository at this point in the history
Add Dockerfile and use docker in CI
  • Loading branch information
shroffk authored Mar 16, 2022
2 parents 4c19cb1 + f73b9aa commit 62fbfab
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@ name: Phoebus build

on: [push, pull_request]


env:
MAVEN_OPTS: -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120


jobs:
build:
runs-on: ubuntu-latest
container:
image: lgomezwhl/phoebus-ci:latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
java-version: '11'
- name: Build
run: mvn --batch-mode install
run: mvn -Pdocker-tests --batch-mode install
- name: Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
21 changes: 21 additions & 0 deletions docs/source/docker.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Docker
===============

In an effort to ensure consistency of deployment, testing and build environments, we have a Dockerfile that developers
may use to build a docker image. The following instructions assume that the developer is using linux and has Docker installed::

cd misc/
sudo docker build -t phoebus:latest .
sudo docker run -it phoebus:latest



From another shell(make sure to leave the previous shell open)::

sudo docker cp phoebus [CONTAINER_ID]:/


You may also pull the following image from docker hub if you don't want to build the image yourself::

sudo docker pull lgomezwhl/phoebus-ci:latest

42 changes: 42 additions & 0 deletions docs/source/eclipse_debugging.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Eclipse Debugging
=================

Download Eclipse Oxygen 4.7.1a or later from http://download.eclipse.org/eclipse/downloads/

Start Eclipse like this::

export JAVA_HOME=/path/to/your/jdk-9-or-later
export PATH="$JAVA_HOME/bin:$PATH"
eclipse/eclipse -consoleLog

Check Eclipse Preferences::

Java, Installed JREs: JDK 9-or-later should be the default
Java, Compiler: JDK Compliance should be "9" or higher

Debugging with Eclipse

This assumes the project has been imported as a maven project into Eclipse(see instructions in README)::

1. Open Eclipse
2. Go to `Run->External Tools->External Run COnfigurations`
3. Create a new `Program` configuration. Set location to `usr/bin/java` on linux.
This is the location of the Java executable. For any other OS, it should not be too hard
to find that directory.
4. Set `Working Directory` to `phoebus/phoebus-product/target`.
5. Set arguments to:
```
--add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar path_to_repo/phoebus/phoebus-product/target/product-4.6.6-SNAPSHOT.jar
```
6. Click `Run`. The Eclipse console should output a port number. Write it down; we'll use it for
debugging later on.
7. Go to `Debug Configurations`
8. Create a new `Remote Java Application`
9. Click on the `Source` tab and make sure all of the sub-modules/projects of the phoebus project
are checked. This will allow you to travel through source code when debugging code in Eclipse.
10. For port, add the port from step 6.
11. Click `Debug`


Now this should connect to your JVM process you started on step 6 and you start debugging your code. Happy debugging!
2 changes: 2 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Developer Documentation:
localization
preference_properties
changelog
docker
eclipse_debugging

Appendix
========
Expand Down
10 changes: 10 additions & 0 deletions misc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ubuntu:20.04
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
RUN apt-get install -y openjdk-11-jdk
RUN apt-get install -y maven
RUN apt-get install -y openjfx
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/" >> /root/.bashrc
19 changes: 19 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,25 @@
</plugin>
</plugins>
</build>
</profile>
<!-- The docker-tests profile sets the ignore_local_ipv6
environment variable to true since IPV6 is not supported in Github Actions at the moment. See ticket #2161 -->
<profile>
<id>docker-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<systemPropertyVariables>
<ignore_local_ipv6>true</ignore_local_ipv6>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!-- a profile for generating javadocs and sources -->
<profile>
Expand Down

0 comments on commit 62fbfab

Please sign in to comment.