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
112 changes: 112 additions & 0 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build images

on:
workflow_call:
inputs:
build_type:
required: true
type: string

env:
BUILDKIT_CACHE_MAP: |
{
"var-cache-apt": "/var/cache/apt",
"var-lib-apt": "/var/lib/apt",
"ccache": "/ccache"
}

DO_PUSH: y

jobs:
build-images:
runs-on:
- ubuntu-24.04

steps:
- name: Checkout
uses: actions/checkout@v5
with:
# for git describe
fetch-depth: 0

- name: Prepare repo
run: |
git config --global user.email "dummy@example.com"
git config --global user.name "dummy user"

- name: Login to the registry
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY_DOMAIN }}
username: ${{ secrets.QUAY_USER_ID }}
password: ${{ secrets.QUAY_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker

- name: Set up Buildkit Cache action
run: |
set -e
git clone https://github.com/reproducible-containers/buildkit-cache-dance.git
cd buildkit-cache-dance
git checkout 5b81f4d29dc8397a7d341dba3aeecc7ec54d6361

- name: Restore apt caches
uses: actions/cache/restore@v3
with:
path: |
var-lib-apt
var-cache-apt
key: apt-${{ hashFiles('Dockerfile') }}-${{ hashFiles('vpp-builder.Dockerfile') }}-${{ hashFiles('vpp.spec') }}
restore-keys: apt-

- name: Restore ccache
uses: actions/cache/restore@v3
with:
path: ccache
key: ccache-${{ inputs.build_type }}-${{ hashFiles('Dockerfile') }}-${{ hashFiles('vpp-builder.Dockerfile') }}-${{ hashFiles('vpp.spec') }}
restore-keys: ccache-${{ inputs.build_type }}-

- name: Inject caches into docker
run:
node ./buildkit-cache-dance/dist/index.js --cache-map "${BUILDKIT_CACHE_MAP}"

- name: Build images
id: build
run: |
BUILD_TYPE="${{ inputs.build_type }}" \
CI_BUILD=1 \
BUILDKIT_PROGRESS=plain \
DO_PUSH="${{ env.DO_PUSH }}" \
BASE_REPO="${{ vars.BASE_REPO }}" \
BUILDER_REPO="${{ vars.BUILDER_REPO }}" \
QUAY_IO_IMAGE_EXPIRES_AFTER="${{ vars.QUAY_IO_IMAGE_EXPIRES_AFTER }}" \
make image

- name: Retag base image
if: github.ref_type == 'tag'
run: |
BUILD_TYPE="${{ inputs.build_type }}" BASE_REPO="${{ vars.BASE_REPO }}" build/retag-base-image.sh

- name: Extract caches from docker
run:
node ./buildkit-cache-dance/dist/index.js --extract --cache-map "${BUILDKIT_CACHE_MAP}"

- name: Save apt caches
if: steps.build.outputs.registry_cache_used == 'none'
uses: actions/cache/save@v3
with:
path: |
var-lib-apt
var-cache-apt
key: apt-${{ hashFiles('Dockerfile') }}-${{ hashFiles('vpp-builder.Dockerfile') }}-${{ hashFiles('vpp.spec') }}

- name: Save ccache
if: steps.build.outputs.registry_cache_used != 'vpp-base'
uses: actions/cache/save@v3
with:
path: ccache
key: ccache-${{ inputs.build_type }}-${{ hashFiles('Dockerfile') }}-${{ hashFiles('vpp-builder.Dockerfile') }}-${{ hashFiles('vpp.spec') }}

18 changes: 18 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CI

on:
push:
branches:
- "**"

jobs:
build-images:
strategy:
matrix:
build_type: [debug, release]

uses: ./.github/workflows/build-images.yaml
with:
build_type: ${{ matrix.build_type }}
secrets: inherit

66 changes: 0 additions & 66 deletions .github/workflows/main.yaml

This file was deleted.

Loading