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

Enhancement: Add libvirt-9 and libvirt-10 variants #50

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
268 changes: 268 additions & 0 deletions .github/workflows/ci-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,140 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-2-8-1-libvirt-10
run: |
set -e

# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )

# Get short commit hash E.g. 'abc0123'
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )

# Generate docker image tags
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
VARIANT="2.8.1-libvirt-10"
REF_VARIANT="${REF}-${VARIANT}"
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"

# Pass variables to next step
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT

- name: 2.8.1-libvirt-10 - Build (PRs)
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v5
with:
context: variants/2.8.1-libvirt-10
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: false
tags: |
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-10.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-10.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 2.8.1-libvirt-10 - Build and push (master)
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: variants/2.8.1-libvirt-10
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-10.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-10.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 2.8.1-libvirt-10 - Build and push (release)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: variants/2.8.1-libvirt-10
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-10.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-10.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-10.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-2-8-1-libvirt-9
run: |
set -e

# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )

# Get short commit hash E.g. 'abc0123'
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )

# Generate docker image tags
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
VARIANT="2.8.1-libvirt-9"
REF_VARIANT="${REF}-${VARIANT}"
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"

# Pass variables to next step
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT

- name: 2.8.1-libvirt-9 - Build (PRs)
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v5
with:
context: variants/2.8.1-libvirt-9
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: false
tags: |
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-9.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-9.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 2.8.1-libvirt-9 - Build and push (master)
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: variants/2.8.1-libvirt-9
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-9.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-9.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 2.8.1-libvirt-9 - Build and push (release)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: variants/2.8.1-libvirt-9
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-9.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-9.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-8-1-libvirt-9.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-2-8-1-libvirt-8
Expand Down Expand Up @@ -532,6 +666,140 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-2-7-0-libvirt-10
run: |
set -e

# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )

# Get short commit hash E.g. 'abc0123'
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )

# Generate docker image tags
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
VARIANT="2.7.0-libvirt-10"
REF_VARIANT="${REF}-${VARIANT}"
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"

# Pass variables to next step
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT

- name: 2.7.0-libvirt-10 - Build (PRs)
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v5
with:
context: variants/2.7.0-libvirt-10
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: false
tags: |
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-10.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-10.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 2.7.0-libvirt-10 - Build and push (master)
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: variants/2.7.0-libvirt-10
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-10.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-10.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 2.7.0-libvirt-10 - Build and push (release)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: variants/2.7.0-libvirt-10
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-10.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-10.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-10.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-2-7-0-libvirt-9
run: |
set -e

# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )

# Get short commit hash E.g. 'abc0123'
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )

# Generate docker image tags
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
VARIANT="2.7.0-libvirt-9"
REF_VARIANT="${REF}-${VARIANT}"
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"

# Pass variables to next step
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT

- name: 2.7.0-libvirt-9 - Build (PRs)
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v5
with:
context: variants/2.7.0-libvirt-9
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: false
tags: |
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-9.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-9.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 2.7.0-libvirt-9 - Build and push (master)
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: variants/2.7.0-libvirt-9
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-9.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-9.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 2.7.0-libvirt-9 - Build and push (release)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: variants/2.7.0-libvirt-9
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-9.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-9.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-2-7-0-libvirt-9.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-2-7-0-libvirt-8
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ Dockerized [`webhook`](https://github.com/adnanh/webhook) with useful tools.
| Tag | Dockerfile Build Context |
|:-------:|:---------:|
| `:2.8.1`, `:latest` | [View](variants/2.8.1) |
| `:2.8.1-libvirt-10` | [View](variants/2.8.1-libvirt-10) |
| `:2.8.1-libvirt-9` | [View](variants/2.8.1-libvirt-9) |
| `:2.8.1-libvirt-8` | [View](variants/2.8.1-libvirt-8) |
| `:2.8.1-curl-git-jq-sops-ssh` | [View](variants/2.8.1-curl-git-jq-sops-ssh) |
| `:2.8.1-libvirt-7` | [View](variants/2.8.1-libvirt-7) |
| `:2.8.1-libvirt-6` | [View](variants/2.8.1-libvirt-6) |
| `:2.7.0` | [View](variants/2.7.0) |
| `:2.7.0-libvirt-10` | [View](variants/2.7.0-libvirt-10) |
| `:2.7.0-libvirt-9` | [View](variants/2.7.0-libvirt-9) |
| `:2.7.0-libvirt-8` | [View](variants/2.7.0-libvirt-8) |
| `:2.7.0-curl-git-jq-sops-ssh` | [View](variants/2.7.0-curl-git-jq-sops-ssh) |
| `:2.7.0-libvirt-7` | [View](variants/2.7.0-libvirt-7) |
Expand Down
10 changes: 10 additions & 0 deletions generate/definitions/VARIANTS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ $local:VARIANTS_MATRIX = @(
distro_version = '3.20'
subvariants = @(
@{ components = @() }
@{ components = @( 'libvirt-10' ) }
)
}
@{
package = 'webhook'
package_version = $v
distro = 'alpine'
distro_version = '3.19'
subvariants = @(
@{ components = @( 'libvirt-9' ) }
)
}
@{
Expand Down
28 changes: 28 additions & 0 deletions variants/2.7.0-libvirt-10/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM golang:1.20-alpine as builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
apk add --no-cache git; \
git clone https://github.com/adnanh/webhook.git /src --branch 2.7.0; \
cd /src; \
go build -ldflags="-s -w" -o /usr/local/bin/webhook;

FROM alpine:3.20
COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook
RUN webhook --version

RUN apk add --no-cache ca-certificates

# Install Task Spooler
RUN apk add --no-cache ts

RUN apk add --no-cache libvirt-client
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

WORKDIR /config
ENTRYPOINT [ "/docker-entrypoint.sh" ]
EXPOSE 9000
CMD [ "-verbose", "-hooks=/config/hooks.yml", "-hotreload" ]
8 changes: 8 additions & 0 deletions variants/2.7.0-libvirt-10/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webhook "$@"
fi

exec "$@"
28 changes: 28 additions & 0 deletions variants/2.7.0-libvirt-9/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM golang:1.20-alpine as builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
apk add --no-cache git; \
git clone https://github.com/adnanh/webhook.git /src --branch 2.7.0; \
cd /src; \
go build -ldflags="-s -w" -o /usr/local/bin/webhook;

FROM alpine:3.19
COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook
RUN webhook --version

RUN apk add --no-cache ca-certificates

# Install Task Spooler
RUN apk add --no-cache ts

RUN apk add --no-cache libvirt-client
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

WORKDIR /config
ENTRYPOINT [ "/docker-entrypoint.sh" ]
EXPOSE 9000
CMD [ "-verbose", "-hooks=/config/hooks.yml", "-hotreload" ]
8 changes: 8 additions & 0 deletions variants/2.7.0-libvirt-9/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webhook "$@"
fi

exec "$@"
Loading