From 9b20f493b2714cbee8d6b731779755a1c266a0eb Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Tue, 16 Jul 2024 08:23:27 +0100 Subject: [PATCH] initial version --- .github/dependabot.yml | 13 +++++++ .github/workflows/build.yml | 69 +++++++++++++++++++++++++++++++++++++ Dockerfile | 3 ++ README.md | 4 +++ 4 files changed, 89 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml create mode 100644 Dockerfile create mode 100644 README.md diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bb7b5a8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# We no longer look for updates to docker and python dependencies in ioc-xxx +# projects. +# +# This is because they should be updated in a controlled manner using the +# copier template so that all changes are kept in sync. + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every weekday + interval: "monthly" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9619962 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,69 @@ +name: Build and publish image to ghcr.io/epics-containers + +on: + push: + pull_request: + +jobs: + build: + # pull requests are a duplicate of a branch push if within the same repo. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + permissions: + contents: read + packages: write + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest # everyone is on ubuntu-latest + + runs-on: ${{ matrix.os }} + env: + TAG: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }} + steps: + + - name: Log in to GitHub Docker Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io/${{ github.repository_owner }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build image + uses: docker/build-push-action@v5 + with: + tags: ci_test + load: true + + - name: Push developer image + if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} + uses: docker/build-push-action@v5 + with: + tags: ${{ env.TAG }}:${{ github.ref_name }} + push: true + + + release: + # Release on tag push - publish ioc schema + needs: [build] + if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} + runs-on: ubuntu-latest + + # this job runs in the native developer container we just made + container: + image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-developer:${{ github.ref_name }} + + steps: + - name: generate-schema + run: | + ibek ioc generate-schema --output ibek.ioc.schema.json + + - name: Github Release + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 + with: + files: | + ibek.ioc.schema.json + generate_release_notes: true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1eec032 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:3.20.1 + +RUN apk update && apk add inotify-tools diff --git a/README.md b/README.md new file mode 100644 index 0000000..afcb01e --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Lightweight utility container for epics-containers + +Used to run alongside an IOC container to monitor the state of its configMap +and restart it when it changes. \ No newline at end of file