Skip to content

Commit f645a6a

Browse files
authored
Merge pull request #201 from epics-containers/ansible
update with ansible for container build steps
2 parents 9478d80 + 1b92c0c commit f645a6a

File tree

4 files changed

+104
-161
lines changed

4 files changed

+104
-161
lines changed

.vscode/settings.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88
"[python]": {
99
"editor.defaultFormatter": "charliermarsh.ruff",
1010
},
11-
"grammarly.selectors": [
12-
{
13-
"language": "markdown",
14-
"scheme": "file"
15-
}
16-
],
1711
"workbench.colorCustomizations": {
18-
"titleBar.activeBackground": "#cc69b5",
12+
"titleBar.activeBackground": "#555555",
1913
},
2014
}

docs/reference/docker.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Therefore:
1111

1212
We do fully support `docker`, please report any issues you find.
1313

14+
If you would like to use docker in rootless mode then it is almost identical to podman and the following instructions are NOT required. To switch to rootless mode see the description of `dockerd-rootless-setuptool.sh` in [these instructions](https://docs.docker.com/engine/security/rootless/#install).
15+
1416
There are a few things to know if you are using `docker` in your developer containers:
1517

1618
1. add `export EC_REMOTE_USER=$USER` into your `$HOME/.bashrc` (or `$HOME/.zshrc` for zsh users). The epics-containers devcontainer.json files will use this to set the account that your user will use inside devcontainers.

docs/tutorials/debug_generic_ioc.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ In this tutorial we will look debugging the build from *inside* the container.
2626

2727
Let us break the build of our ioc-lakeshore340 project in the last
2828
tutorial. Open the the file
29-
`ioc-lakeshore340/ibek-support/StreamDevice/install.sh`.
30-
Comment out the apt-install line like this:
29+
`ioc-lakeshore340/ibek-support/StreamDevice/StreamDevice.install.yml`.
30+
Comment out the app_developer section like this:
3131

32-
```bash
33-
# ibek support apt-install libpcre3-dev
32+
```yaml
33+
# apt_developer:
34+
# - libpcre3-dev
3435
```
3536

36-
Now rebuild the container - do this command from a new terminal *outside* of
37-
the devcontainer:
37+
This removes installation of the system dependency on the `libpcre3-dev` package and StreamDevice will therefore fail to build.
38+
39+
Now rebuild the container - do this command from a new terminal *outside* of the devcontainer:
3840

3941
```bash
4042
# for docker users - builkit complicates debugging at present
@@ -66,21 +68,21 @@ investigate the build failure by running a shell in the container.
6668
- scroll up the page until you see the last successful build step e.g.
6769

6870
```bash
69-
STEP 14/19: COPY ibek-support/StreamDevice/ StreamDevice/
70-
--> 631291db1751
71-
STEP 15/19: RUN StreamDevice/install.sh 2.8.24
71+
--> 43eb74c72eab
72+
STEP 17/22: COPY ibek-support/StreamDevice/ StreamDevice
73+
--> da81452bc214
74+
STEP 18/22: RUN ansible.sh StreamDevice
7275
... etc ...
7376
```
7477

75-
- copy the hash of the step you want to debug e.g. `631291db1751` in this case
76-
- `docker run -it --entrypoint /bin/bash 631291db1751 # (the hash you copied)`
78+
- copy the hash of the step you want to debug e.g. `da81452bc214` in this case
79+
- `docker run -it --entrypoint /bin/bash da81452bc214 # (the hash you copied)`
7780

7881
Now we have a prompt inside the part-built container and can retry the failed
7982
command.
8083

8184
```bash
82-
cd /workspaces/ioc-lakeshore340/ibek-support
83-
StreamDevice/install.sh 2.8.24
85+
ansible.sh StreamDevice
8486
```
8587

8688
You should see the same error again.
@@ -129,28 +131,29 @@ Now we can install the missing package in the container and retry the build:
129131

130132
```bash
131133
apt-get install -y libpcre3-dev
132-
StreamDevice/install.sh 2.8.24
134+
ansible.sh StreamDevice
133135
```
134136

135-
You should find the build succeeds. But this is not the whole story. There
136-
is another line in `install.h` that I added to make this work:
137+
You should find the build succeeds. But this is not the whole story. There is another section in `StreamDevice.install.yml` that I added to make this work:
137138

138-
```bash
139-
ibek support add-config-macro ${NAME} PCRE_LIB /usr/lib/x86_64gnu
139+
```yaml
140+
patch_lines:
141+
- path: "{{ config_linux_host }}"
142+
regexp: PCRE_LIB
143+
line: PCRE_LIB=/usr/lib/x86_64-linux-gnu
144+
when: "{{ is_linux }}"
140145
```
141146
142147
This added a macro to `CONFIG_SITE.linux-x86_64.Common` that tells the
143148
Makefiles to add an extra include path to the compiler command line. working
144149
out how to do this is a matter of taking a look in the Makefiles. But the
145150
nice thing is that you can experiment with things inside the container and
146151
get them working without having to keep rebuilding the container.
152+
(TODO: strictly speaking this could be improved, we should remove the {{ is_linux }} and use the path {{ config_linux_target }} instead, that updates CONFIG_SITE.Common.linux-x86_64 which only affects the linux-x86_64 target)
147153

148-
Note that `ibek support add-config-macro` is idempotent, so you can run it
149-
multiple times without getting repeated entries in the CONFIG. All `ibek`
150-
commands behave this way as far as possible.
154+
Note that ansible is idempotent, so you can run it multiple times without getting repeated entries in the CONFIG.
151155

152-
Once you are happy with your manual changes you can make them permanent by
153-
adding to the install.sh or Dockerfile, then try a full rebuild.
156+
Once you are happy with your manual changes you can make them permanent by adding to the `<module>install.yml` or Dockerfile, then try a full rebuild.
154157

155158
## Tools Inside the Container
156159

0 commit comments

Comments
 (0)