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

feat: refactor for renovate version automated updating #9

Merged
merged 2 commits into from
Feb 21, 2025
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
22 changes: 17 additions & 5 deletions .github/workflows/build_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ jobs:
- name: Source checkout
uses: actions/checkout@v4

- name: 'Setup yq'
uses: dcarbone/[email protected]

- id: set-matrix
run: echo "matrix=$(cat build_versions.json | jq -c)" >> $GITHUB_OUTPUT
run: echo "matrix=$(yq -o json build_versions.yaml | jq -c)" >> $GITHUB_OUTPUT

build-X86-container:
runs-on: ubuntu-24.04
Expand All @@ -36,7 +39,7 @@ jobs:
registry_password: ${{ secrets.GITHUB_TOKEN }}
build_args: |
OPENVOX_RELEASE=${{ matrix.release }}
OPENVOXDB_VERSION=${{ matrix.version }}
OPENVOXDB_VERSION=${{ matrix.db_version }}
build_arch: linux/amd64
build_context: openvoxdb
buildfile: openvoxdb/Containerfile
Expand All @@ -58,7 +61,7 @@ jobs:
registry_password: ${{ secrets.GITHUB_TOKEN }}
build_args: |
OPENVOX_RELEASE=${{ matrix.release }}
OPENVOXDB_VERSION=${{ matrix.version }}
OPENVOXDB_VERSION=${{ matrix.db_version }}
build_arch: linux/arm64
build_context: openvoxdb
buildfile: openvoxdb/Containerfile
Expand All @@ -85,13 +88,22 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version number
id: extract_version
uses: actions/github-script@v7
with:
script: |
const agentVersion = '${{ matrix.db_version }}';
const version = agentVersion.split('-')[0];
core.setOutput('version', version);

- name: Create multi arch manifests
run: |
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxdb:${{ matrix.version }}-${{ github.ref_name }} \
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxdb:${{ steps.extract_version.outputs.version }}-${{ github.ref_name }} \
ghcr.io/openvoxproject/openvoxdb:${{ matrix.release }}-${{ github.sha }}-arm64 \
ghcr.io/openvoxproject/openvoxdb:${{ matrix.release }}-${{ github.sha }}-x86_64

docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxdb:${{ matrix.version }}-latest \
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxdb:${{ steps.extract_version.outputs.version }}-latest \
ghcr.io/openvoxproject/openvoxdb:${{ matrix.release }}-${{ github.sha }}-arm64 \
ghcr.io/openvoxproject/openvoxdb:${{ matrix.release }}-${{ github.sha }}-x86_64

Expand Down
19 changes: 16 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ jobs:
- name: Source checkout
uses: actions/checkout@v4

- name: 'Setup yq'
uses: dcarbone/[email protected]

- id: set-matrix
run: echo "matrix=$(jq -c . build_versions.json)" >> $GITHUB_OUTPUT
run: echo "matrix=$(yq -o json build_versions.yaml | jq -c)" >> $GITHUB_OUTPUT

general_ci:
permissions:
Expand All @@ -41,16 +44,26 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Extract version number
id: extract_version
uses: actions/github-script@v7
with:
script: |
const agentVersion = '${{ matrix.db_version }}';
const version = agentVersion.split('-')[0];
core.setOutput('version', version);


- name: Build image
uses: docker/build-push-action@v6
with:
tags: 'ci/openvoxdb:${{ matrix.version }}'
tags: 'ci/openvoxdb:${{ steps.extract_version.outputs.version }}'
context: openvoxdb
file: openvoxdb/Containerfile
push: false
build-args: |
OPENVOX_RELEASE=${{ matrix.release }}
OPENVOXDB_VERSION=${{ matrix.version }}
OPENVOXDB_VERSION=${{ matrix.db_version }}

tests:
needs:
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/security_scanning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ jobs:
- name: Source checkout
uses: actions/checkout@v4

- name: 'Setup yq'
uses: dcarbone/[email protected]

- id: set-matrix
run: echo "matrix=$(jq -c . build_versions.json)" >> $GITHUB_OUTPUT
run: echo "matrix=$(yq -o json build_versions.yaml | jq -c)" >> $GITHUB_OUTPUT

scan_ci_container:
name: 'Scan CI container'
Expand All @@ -35,22 +38,32 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Extract version number
id: extract_version
uses: actions/github-script@v7
with:
script: |
const agentVersion = '${{ matrix.db_version }}';
const version = agentVersion.split('-')[0];
core.setOutput('version', version);


- name: Build CI container
uses: docker/build-push-action@v6
with:
tags: 'ci/openvoxdb:${{ matrix.version }}'
tags: 'ci/openvoxdb:${{ steps.extract_version.outputs.version }}'
context: openvoxdb
file: openvoxdb/Containerfile
push: false
build-args: |
OPENVOX_RELEASE=${{ matrix.release }}
OPENVOXDB_VERSION=${{ matrix.version }}
OPENVOXDB_VERSION=${{ matrix.db_version }}

- name: Scan image with Anchore Grype
uses: anchore/scan-action@v6
id: scan
with:
image: 'ci/openvoxdb:${{ matrix.version }}'
image: 'ci/openvoxdb:${{ steps.extract_version.outputs.version }}'
fail-build: false

- name: Inspect action SARIF report
Expand Down
12 changes: 0 additions & 12 deletions build_versions.json

This file was deleted.

9 changes: 9 additions & 0 deletions build_versions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
include:
- release: 7
# renovate: depName=openvoxdb openVoxRelease=7
db_version: "7.21.1-1+ubuntu24.04"

- release: 8
# renovate: depName=openvoxdb openVoxRelease=8
db_version: "8.9.0-1+ubuntu24.04"
18 changes: 7 additions & 11 deletions openvoxdb/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ LABEL org.label-schema.maintainer="Voxpupuli Release Team <[email protected]>"
org.label-schema.vcs-ref="$vcs_ref" \
org.label-schema.build-date="$build_date"

ARG TARGETARCH
ARG PACKAGES="ca-certificates curl dnsutils netcat-traditional dumb-init"

ARG LOGDIR
ENV LOGDIR=${LOGDIR:-/opt/puppetlabs/server/data/puppetdb/logs}

ARG OPENVOX_RELEASE
ENV OPENVOX_RELEASE=${OPENVOX_RELEASE:-8}

ARG OPENVOXDB_VERSION
ENV OPENVOXDB_VERSION=${OPENVOXDB_VERSION:-8.9.0}
ARG UBUNTU_VERSION=24.04
ARG OPENVOX_RELEASE=8
ARG OPENVOXDB_VERSION=8.9.0+ubuntu${UBUNTU_VERSION}
ARG OPENVOX_RELEASE_PACKAGE=openvox${OPENVOX_RELEASE}-release-ubuntu${UBUNTU_VERSION}.deb

ARG SSLDIR
ENV SSLDIR=${SSLDIR:-/opt/puppetlabs/server/data/puppetdb/certs}
Expand All @@ -42,7 +40,6 @@ ENV CERTNAME="openvoxdb" \
OPENVOXDB_POSTGRES_PORT="5432" \
OPENVOXDB_REPORT_TTL=14d \
OPENVOXDB_POSTGRES_USER=openvoxdb \
UBUNTU_VERSION="24.04" \
OPENVOXDB_CERTIFICATE_ALLOWLIST="" \
USE_OPENVOXSERVER=true \
WAITFORCERT=""
Expand All @@ -57,15 +54,14 @@ COPY docker-entrypoint.d /docker-entrypoint.d

ADD https://apt.overlookinfratech.com/openvox${OPENVOX_RELEASE}-release-ubuntu${UBUNTU_VERSION}.deb /
RUN apt-get update && \
apt-get install -y ca-certificates && \
dpkg -i /openvox${OPENVOX_RELEASE}-release-ubuntu${UBUNTU_VERSION}.deb && \
rm /openvox${OPENVOX_RELEASE}-release-ubuntu${UBUNTU_VERSION}.deb
apt-get install -y ca-certificates /${OPENVOX_RELEASE_PACKAGE} && \
rm /${OPENVOX_RELEASE_PACKAGE}

RUN apt update && \
apt upgrade -y && \
apt install --no-install-recommends -y ${PACKAGES} && \
chmod +x /ssl.sh /wtfc.sh /docker-entrypoint.sh /healthcheck.sh /docker-entrypoint.d/*.sh && \
apt install -y openvoxdb=${OPENVOXDB_VERSION}-1+ubuntu${UBUNTU_VERSION} && \
apt install -y openvoxdb=${OPENVOXDB_VERSION} && \
apt autoremove -y && \
apt clean && \
rm -rf /var/lib/apt/lists/* && \
Expand Down
9 changes: 9 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,14 @@
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"customManagers": [
{
"customType": "regex",
"fileMatch": ["build_versions.yaml"],
"matchStrings": ["#\\s*renovate:\\s*depName=(?<depName>.*?)\\s*openVoxRelease=(?<openVoxRelease>\\d+)\\s*\\n\\s*(?<key>\\w+_version):\\s*\"(?<currentValue>.*?)\""],
"registryUrlTemplate": "https://apt.overlookinfratech.com?suite=ubuntu24.04&components=openvox{{openVoxRelease}}&binaryArch=amd64",
"datasourceTemplate": "deb"
}
]
}
Loading