Skip to content

Commit

Permalink
Merge branch 'main' into opcua
Browse files Browse the repository at this point in the history
  • Loading branch information
guirodrigueslima committed Apr 10, 2024
2 parents a5c391b + d595fd1 commit e4b8689
Show file tree
Hide file tree
Showing 14 changed files with 155 additions and 63 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ioc-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build image
on:
workflow_call:

jobs:
build_and_push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
REGISTRY: ghcr.io/${{ github.repository_owner }}
SOURCE: https://github.com/${{ github.repository }}
TAG: ${{ github.event_name == 'push' && github.ref_name || github.head_ref }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: docker/setup-buildx-action@v3
- name: Log in to registry
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push tagged image
uses: docker/bake-action@v4
with:
workdir: ./
files: docker-compose.yml
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
push: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
17 changes: 17 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

## Unreleased

### New features

* base: add PVXS module. by @ericonr in
https://github.com/cnpem/epics-in-docker/pull/42
* ci: add reusable job for IOC images. by @ericonr in
https://github.com/cnpem/epics-in-docker/pull/49
* base: Add OPCUA IOC. by @guirodrigueslima in
https://github.com/cnpem/epics-in-docker/pull/57

### Bug fixes

* base: update modules. by @ericonr in
https://github.com/cnpem/epics-in-docker/pull/43
* This updates the autosave module and removes some resource leaks.
* base: build CALC with Sequencer support. by @henriquesimoes in
https://github.com/cnpem/epics-in-docker/pull/48

## v0.6.0

Users interested in the retools module should update to this release.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG DEBIAN_VERSION=11.7

FROM ghcr.io/cnpem/lnls-debian-11-epics-7:v0.6.0 AS build-image
FROM ghcr.io/cnpem/lnls-debian-11-epics-7:v0.6.0-dev AS build-image

FROM debian:${DEBIAN_VERSION}-slim AS base

Expand Down
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ Packages essential to all (or most) IOCs should be added to [this repository's
The template above assumes the containers will be uploaded to the GitHub
registry.

`:${TAG}` adds versioning to images using [our CI workflows](#ci-workflows),
and when building images locally and exporting the `TAG` environment variable.
If there is no interest in using versioned images and the resulting container
image should be tagged as `latest`, `:${TAG}` can simply be omitted.

### areaDetector IOCs

`areaDetector` IOCs must be built with target `dynamic-link`. In addition, they
Expand All @@ -80,6 +85,34 @@ module depends on it.
Known build and runtime issues are documented in the [SwC
wiki](http://swc.lnls.br/).

## CI Workflows

Users of this repository for building IOC images can also take advantage of
pre-defined continuous integration workflows in order to verify that images are
built correctly after changes, and for uploading container images to the
desired registry on Git tag creation.

### GitHub Actions

A YAML file must be added to the repository's `.github/workflows/` directory
(e.g. `.github/workflows/build.yml`), with the following contents:

```
name: Build image
on:
push:
tags:
- 'v*'
pull_request:
jobs:
build_and_push:
permissions:
packages: write
contents: read
uses: cnpem/epics-in-docker/.github/workflows/ioc-images.yml@main
```

## Containers

### Accessing `iocsh` inside containers
Expand Down
9 changes: 5 additions & 4 deletions base/.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ DEBIAN_VERSION=11.7
ALPINE_VERSION=3.18.4

EPICS7_BASE_VERSION=7.0.7
PVXS_VERSION=1.3.1

SEQUENCER_VERSION=2.2.9
CALC_VERSION=R3-7-4
SEQUENCER_VERSION=R2-2-9
CALC_VERSION=R3-7-5
ASYN_VERSION=R4-44-2
STREAMDEVICE_VERSION=2.8.24
BUSY_VERSION=R1-7-4
AUTOSAVE_VERSION=R5-10-2
SSCAN_VERSION=R2-11-5
AUTOSAVE_VERSION=R5-11
SSCAN_VERSION=R2-11-6
RECCASTER_VERSION=1.5
IPAC_VERSION=2.16
CAPUTLOG_VERSION=R4.0
Expand Down
4 changes: 3 additions & 1 deletion base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN apt update -y && \
build-essential \
git \
libaravis-dev \
libevent-dev \
libreadline-dev \
libssh2-1-dev \
libtiff-dev \
Expand All @@ -37,6 +38,7 @@ COPY install_epics.sh .
RUN ./install_epics.sh

ARG DEBIAN_VERSION
ARG PVXS_VERSION
ARG SEQUENCER_VERSION
ARG CALC_VERSION
ARG ASYN_VERSION
Expand All @@ -62,7 +64,7 @@ WORKDIR ${EPICS_MODULES_PATH}
COPY install_modules.sh .
RUN ./install_modules.sh

COPY nanohttp_stream.patch .
COPY backport-adsupport-nanohttp.patch .
COPY install_area_detector.sh .
RUN ./install_area_detector.sh

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
From https://github.com/areaDetector/ADSupport/pull/41
From 0ecb38c9b8981b4e92c2ebbdff5503052a5c0ba9 Mon Sep 17 00:00:00 2001
From 9326adbf88b7e4501b4ba1b53d267c2c3f921c78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Nogueira?= <erico.rolim@lnls.br>
Date: Thu, 3 Aug 2023 08:16:00 -0300
Subject: [PATCH] Fix nanohttp_stream build with external libxml2.
Expand All @@ -16,14 +15,14 @@ only define IN_LIBXML in that case.
2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/supportApp/xml2Src/Makefile b/supportApp/xml2Src/Makefile
index 1ba2696..1a0c189 100644
index 1ba2696..b855c48 100644
--- a/supportApp/xml2Src/Makefile
+++ b/supportApp/xml2Src/Makefile
@@ -123,6 +123,7 @@ ifeq ($(XML2_EXTERNAL),NO)
LIB_SRCS += xmlstring.c

nanohttp_stream_LIBS += xml2
+ USR_CFLAGS = -DIN_LIBXML
+ nanohttp_stream_CFLAGS += -DIN_LIBXML

else
nanohttp_stream_SYS_LIBS += xml2
Expand Down
1 change: 1 addition & 0 deletions base/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
JOBS: ${JOBS:-1}
DEBIAN_VERSION: ${DEBIAN_VERSION}
EPICS_BASE_VERSION: ${EPICS7_BASE_VERSION}
PVXS_VERSION: ${PVXS_VERSION}
SEQUENCER_VERSION: ${SEQUENCER_VERSION}
CALC_VERSION: ${CALC_VERSION}
ASYN_VERSION: ${ASYN_VERSION}
Expand Down
13 changes: 11 additions & 2 deletions base/install-functions.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
get_module_path() {
for module in $@; do
if [ -n "$module" ]; then
grep -E "^$module=" $EPICS_RELEASE_FILE
fi
done
}

download_github_module() {
github_org=$1
module_name=$2
Expand All @@ -11,10 +19,11 @@ download_github_module() {
install_module() {
module_name=$1
dependency_name=$2
release_content="$3"
release_modules="$3"

cd $module_name
echo "$release_content" > configure/RELEASE
get_module_path "$release_modules" > configure/RELEASE

if [ -n "$NEEDS_TIRPC" ]; then
echo "TIRPC=YES" >> configure/CONFIG_SITE
fi
Expand Down
25 changes: 11 additions & 14 deletions base/install_area_detector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ ADCORE=${EPICS_MODULES_PATH}/areaDetector/ADCore

echo "$module_releases" >> ${EPICS_RELEASE_FILE}

echo "
EPICS_BASE=${EPICS_BASE_PATH}
$module_releases
ASYN=${EPICS_MODULES_PATH}/asyn
BUSY=${EPICS_MODULES_PATH}/busy
SSCAN=${EPICS_MODULES_PATH}/sscan
get_module_path "
EPICS_BASE
ASYN
BUSY
SSCAN
" > RELEASE.local
echo "$module_releases" >> RELEASE.local

ln -s RELEASE.local RELEASE_PRODS.local
ln -s RELEASE.local RELEASE_LIBS.local
Expand Down Expand Up @@ -94,7 +92,7 @@ ARAVIS_INCLUDE=$(pkg-config --cflags-only-I aravis-0.8 | sed -e "s|-I||g")

cd -

git apply --directory ADSupport ${EPICS_MODULES_PATH}/nanohttp_stream.patch
patch -d ADSupport -Np1 < ${EPICS_MODULES_PATH}/backport-adsupport-nanohttp.patch

make -j${JOBS}
make clean
Expand All @@ -105,9 +103,8 @@ download_github_module cnpem ssc-pimega $LIBSSCPIMEGA_VERSION
make -C ssc-pimega/c install

install_github_module cnpem NDSSCPimega NDSSCPIMEGA $NDSSCPIMEGA_VERSION "
EPICS_BASE = ${EPICS_BASE_PATH}
ASYN=${EPICS_MODULES_PATH}/asyn
AREA_DETECTOR=${EPICS_MODULES_PATH}/areaDetector
ADCORE=${EPICS_MODULES_PATH}/areaDetector/ADCore
EPICS_BASE
ASYN
AREA_DETECTOR
ADCORE
"
48 changes: 22 additions & 26 deletions base/install_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,58 @@ set -ex

. /opt/epics/install-functions.sh

# Build seq first since it doesn't depend on anything
lnls-get-n-unpack -l "https://static.erico.dev/seq-$SEQUENCER_VERSION.tar.gz"
mv seq-$SEQUENCER_VERSION seq
install_module seq SNCSEQ "
EPICS_BASE = ${EPICS_BASE_PATH}
install_github_module mdavidsaver pvxs PVXS $PVXS_VERSION "
EPICS_BASE
"

install_github_module epics-modules calc CALC $CALC_VERSION "
EPICS_BASE = ${EPICS_BASE_PATH}
install_github_module epics-modules sequencer SNCSEQ $SEQUENCER_VERSION "
EPICS_BASE
"

SEQ = ${EPICS_MODULES_PATH}/seq
install_github_module epics-modules calc CALC $CALC_VERSION "
EPICS_BASE
SNCSEQ
"

# Build asyn without seq since it's only needed for testIPServer
install_github_module epics-modules asyn ASYN $ASYN_VERSION "
EPICS_BASE = ${EPICS_BASE_PATH}
CALC = ${EPICS_MODULES_PATH}/calc
EPICS_BASE
CALC
"

install_github_module paulscherrerinstitute StreamDevice STREAM $STREAMDEVICE_VERSION "
EPICS_BASE = ${EPICS_BASE_PATH}
ASYN = ${EPICS_MODULES_PATH}/asyn
CALC = ${EPICS_MODULES_PATH}/calc
EPICS_BASE
ASYN
CALC
"

install_github_module epics-modules busy BUSY $BUSY_VERSION "
EPICS_BASE = ${EPICS_BASE_PATH}
ASYN = ${EPICS_MODULES_PATH}/asyn
EPICS_BASE
ASYN
"

install_github_module epics-modules autosave AUTOSAVE $AUTOSAVE_VERSION "
EPICS_BASE = ${EPICS_BASE_PATH}
EPICS_BASE
"

install_github_module epics-modules sscan SSCAN $SSCAN_VERSION "
EPICS_BASE = ${EPICS_BASE_PATH}
SNCSEQ = ${EPICS_MODULES_PATH}/seq
EPICS_BASE
SNCSEQ
"

download_github_module ChannelFinder recsync $RECCASTER_VERSION
install_module recsync/client RECCASTER "
EPICS_BASE = ${EPICS_BASE_PATH}
EPICS_BASE
"

install_github_module epics-modules ipac IPAC $IPAC_VERSION "
EPICS_BASE = ${EPICS_BASE_PATH}
EPICS_BASE
"

install_github_module epics-modules caPutLog CAPUTLOG $CAPUTLOG_VERSION "
EPICS_BASE = ${EPICS_BASE_PATH}
EPICS_BASE
"

install_github_module brunoseivam retools RETOOLS $RETOOLS_VERSION "
EPICS_BASE = ${EPICS_BASE_PATH}
EPICS_BASE
"
22 changes: 11 additions & 11 deletions base/install_motor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ echo "$module_releases" >> ${EPICS_RELEASE_FILE}

cd ../configure

echo "
EPICS_BASE=${EPICS_BASE_PATH}
ASYN=${EPICS_MODULES_PATH}/asyn
SNCSEQ=${EPICS_MODULES_PATH}/seq
BUSY=${EPICS_MODULES_PATH}/busy
IPAC=${EPICS_MODULES_PATH}/ipac
get_module_path "
EPICS_BASE
ASYN
SNCSEQ
BUSY
IPAC
" > RELEASE.local

echo "
Expand Down Expand Up @@ -57,9 +57,9 @@ WITH_BOOST = NO
" >> pmac/configure/CONFIG_SITE

JOBS=1 install_module pmac PMAC "
EPICS_BASE=${EPICS_BASE_PATH}
ASYN=${EPICS_MODULES_PATH}/asyn
CALC=${EPICS_MODULES_PATH}/calc
MOTOR=${EPICS_MODULES_PATH}/motor
BUSY=${EPICS_MODULES_PATH}/busy
EPICS_BASE
ASYN
CALC
MOTOR
BUSY
"
1 change: 1 addition & 0 deletions base/musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ COPY backport-epics-base-musl.patch .
COPY install_epics.sh .
RUN ./install_epics.sh

ARG PVXS_VERSION
ARG SEQUENCER_VERSION
ARG CALC_VERSION
ARG ASYN_VERSION
Expand Down
1 change: 1 addition & 0 deletions base/musl/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
JOBS: ${JOBS:-1}
ALPINE_VERSION: ${ALPINE_VERSION}
EPICS_BASE_VERSION: ${EPICS7_BASE_VERSION}
PVXS_VERSION: ${PVXS_VERSION}
SEQUENCER_VERSION: ${SEQUENCER_VERSION}
CALC_VERSION: ${CALC_VERSION}
ASYN_VERSION: ${ASYN_VERSION}
Expand Down

0 comments on commit e4b8689

Please sign in to comment.