Skip to content
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

ci: add reusable job for IOC images. #51

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.ref_name }}
ericonr marked this conversation as resolved.
Show resolved Hide resolved
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' }}
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

* 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

### Bug fixes

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
```

## Containers

### Accessing `iocsh` inside containers
Expand Down