|
|
@ -65,4 +65,51 @@ ps ax |
|
|
**and then:** |
|
|
**and then:** |
|
|
```sh |
|
|
```sh |
|
|
strace -ff -p <pid> |
|
|
strace -ff -p <pid> |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## Debug a Build Job |
|
|
|
|
|
|
|
|
|
|
|
Let's say that a Java build is failing and you need to troubleshoot the issue. |
|
|
|
|
|
For the record, let's pretend it's a Java build based on maven. For instance, |
|
|
|
|
|
you are trying to build [openshift-tasks](https://github.com/lbroudoux/openshift-tasks/tree/eap-7) |
|
|
|
|
|
application. |
|
|
|
|
|
|
|
|
|
|
|
Spawn a persistent Build Pod and get a shell on this pod: |
|
|
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
|
oc new-app --name java-debug redhat-openjdk18-openshift:1.2 |
|
|
|
|
|
oc patch dc java-debug --type=json -p '[{"op": "add", "path": "/spec/template/spec/containers/0/command", "value": ["/bin/sh", "-c", "while :; do sleep 1; done" ]}]' |
|
|
|
|
|
oc get pods |
|
|
|
|
|
oc rsh $(oc get pods -l app=java-debug -o name|tail -n 1) |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Since the Maven has been installed in the container using the Software |
|
|
|
|
|
Collections, you will need to enable this environment with: |
|
|
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
|
scl -l |
|
|
|
|
|
scl enable rh-maven33 /bin/bash |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
The source code is usually fetched using GIT but from another container. |
|
|
|
|
|
So, to fetch the source code to build, you can do a `git clone` and pack it from |
|
|
|
|
|
another machine or if you are using GitHub, you can directly fetch a ZIP: |
|
|
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
|
curl -Lo /tmp/src.zip https://github.com/lbroudoux/openshift-tasks/zipball/eap-7 |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Unpack it: |
|
|
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
|
mkdir -p /tmp/src |
|
|
|
|
|
cd /tmp/src |
|
|
|
|
|
unzip /tmp/src.zip |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
And then, replicate what the S2I build is doing: |
|
|
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
|
cd lbroudoux-openshift-tasks-d745675 |
|
|
|
|
|
/usr/local/s2i/assemble |
|
|
|
|
|
``` |
|
|
|