Skip to content
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
1 change: 1 addition & 0 deletions .github/buildbot-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11.8
31 changes: 25 additions & 6 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ on:
type: number

env:
BUILDBOT_VERSION: 3.11.8
GITHUB_SHA_LEN: 8

concurrency:
Expand Down Expand Up @@ -77,17 +76,27 @@ jobs:

- name: Environment variables
run: |
echo "GIT_SHA_SHORT=${GITHUB_SHA::${{ env.GITHUB_SHA_LEN }}}" >> $GITHUB_ENV
echo "BUILDBOT_VERSION=$(cat .github/buildbot-version)" >> $GITHUB_ENV
echo "GIT_SHA_SHORT=$(git rev-parse --short=${{ env.GITHUB_SHA_LEN }} HEAD)" >> $GITHUB_ENV
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "CONTAINER_TAG=pr-${{ inputs.pr_number }}" >> $GITHUB_ENV
elif [ "${{ startsWith(github.ref, 'refs/tags/') }}" = "true" ]; then
echo "CONTAINER_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "CONTAINER_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
fi

- name: Build container and export it to local Docker
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: local/${{ matrix.container_flavor }}
file: docker/build${{ matrix.container_flavor }}/Dockerfile
build-args: |
BUILDBOT_VERSION=${{ env.BUILDBOT_VERSION }}
OPENWRT_VERSION=${{ env.GIT_SHA_SHORT }}
BUILDBOT_CONFIG_SHA=${{ env.GIT_SHA_SHORT }}
CONTAINER_TAG=${{ env.CONTAINER_TAG }}

- name: Test ${{ matrix.container_flavor }} Docker container
run: |
Expand Down Expand Up @@ -121,7 +130,15 @@ jobs:

- name: Environment variables
run: |
echo "GIT_SHA_SHORT=${GITHUB_SHA::${{ env.GITHUB_SHA_LEN }}}" >> $GITHUB_ENV
echo "BUILDBOT_VERSION=$(cat .github/buildbot-version)" >> $GITHUB_ENV
echo "GIT_SHA_SHORT=$(git rev-parse --short=${{ env.GITHUB_SHA_LEN }} HEAD)" >> $GITHUB_ENV
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "CONTAINER_TAG=pr-${{ inputs.pr_number }}" >> $GITHUB_ENV
elif [ "${{ startsWith(github.ref, 'refs/tags/') }}" = "true" ]; then
echo "CONTAINER_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "CONTAINER_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
fi

- name: Docker meta
id: meta
Expand All @@ -130,7 +147,7 @@ jobs:
images: ghcr.io/${{ github.repository }}/build${{ matrix.container_flavor }}-v${{ env.BUILDBOT_VERSION }}
tags: |
type=raw,value=pr-${{ inputs.pr_number }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=ref,event=branch
type=ref,event=branch,enable=${{ github.event_name != 'workflow_dispatch' }}
type=sha,prefix=sha-,enable=${{ github.event_name != 'workflow_dispatch' }}
type=semver,pattern={{version}}

Expand All @@ -144,10 +161,12 @@ jobs:
- name: Build container again and push it
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: docker/build${{ matrix.container_flavor }}/Dockerfile
build-args: |
BUILDBOT_VERSION=${{ env.BUILDBOT_VERSION }}
OPENWRT_VERSION=${{ env.GIT_SHA_SHORT }}
BUILDBOT_CONFIG_SHA=${{ env.GIT_SHA_SHORT }}
CONTAINER_TAG=${{ env.CONTAINER_TAG }}
9 changes: 6 additions & 3 deletions .github/workflows/cleanup-pr-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
pull_request:
types: [closed]

env:
BUILDBOT_VERSION: 3.11.8

jobs:
cleanup:
name: Delete PR container images
Expand All @@ -21,6 +18,12 @@ jobs:
- worker

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Read Buildbot version
run: echo "BUILDBOT_VERSION=$(cat .github/buildbot-version)" >> $GITHUB_ENV

- name: Delete PR container image
uses: actions/delete-package-versions@v5
with:
Expand Down
4 changes: 2 additions & 2 deletions docker/buildmaster/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ LABEL maintainer="OpenWrt Maintainers"

ARG DEBIAN_FRONTEND=noninteractive
ARG BUILDBOT_VERSION=2.10.1
ARG OPENWRT_VERSION=unknown
ARG BUILDBOT_CONFIG_SHA=unknown

ENV BUILDMASTER_CONFIG=config.ini
ENV BUILDMASTER_PHASE=1
Expand Down Expand Up @@ -74,7 +74,7 @@ RUN \

RUN \
sed -i \
"s;\"col-sm-12\"><ul><li ng-repeat;\"col-sm-12\"><ul><li>OpenWrt version: <a href=\"https://git.openwrt.org/$OPENWRT_VERSION\">$OPENWRT_VERSION</a></li><li ng-repeat;" \
"s;\"col-sm-12\"><ul><li ng-repeat;\"col-sm-12\"><ul><li>OpenWrt buildbot config: <a href=\"https://git.openwrt.org/$BUILDBOT_CONFIG_SHA\">$BUILDBOT_CONFIG_SHA</a></li><li ng-repeat;" \
/opt/venv/lib/python*/site-packages/buildbot_www/static/scripts.js

ENV LANG=en_US.utf8
Expand Down
5 changes: 3 additions & 2 deletions docker/buildworker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ LABEL maintainer="OpenWrt Maintainers"

ARG DEBIAN_FRONTEND=noninteractive
ARG BUILDBOT_VERSION=2.10.1
ARG OPENWRT_VERSION=unknown
ARG BUILDBOT_CONFIG_SHA=unknown
ARG CONTAINER_TAG=unknown

ENV BUILDWORKER_MASTER=builds.openwrt.org:9990
ENV BUILDWORKER_ADMIN=contact@openwrt.org
ENV BUILDWORKER_DESCRIPTION="Docker Container https://git.openwrt.org/$OPENWRT_VERSION"
ENV BUILDWORKER_DESCRIPTION="Container ($CONTAINER_TAG) https://git.openwrt.org/$BUILDBOT_CONFIG_SHA"

USER root

Expand Down
Loading