Skip to content

vm-kernel

vm-kernel #103

Workflow file for this run

name: vm-kernel
on:
schedule:
- cron: '42 4 * * 2' # run once a week
workflow_dispatch: # adds ability to run this manually
inputs:
push:
description: 'Push to Docker Hub'
type: boolean
default: false
tag:
description: 'Tag to use for Docker image'
required: false
env:
VM_KERNEL_IMAGE: "neondatabase/vm-kernel"
jobs:
vm-kernel:
outputs:
image: ${{ fromJSON(steps.build-linux-kernel.outputs.metadata)['image.name'] }}@${{ steps.build-linux-kernel.outputs.digest }}
runs-on: [ self-hosted, gen3, large ]
steps:
- name: git checkout
uses: actions/checkout@v3
# Use custom DOCKER_CONFIG directory to avoid conflicts with default settings
# The default value is ~/.docker
- name: set custom docker config directory
run: |
mkdir -p .docker-custom
echo DOCKER_CONFIG=$(pwd)/.docker-custom >> $GITHUB_ENV
- name: docker - install qemu
uses: docker/setup-qemu-action@v2
- name: docker - setup buildx
uses: docker/setup-buildx-action@v2
- name: login to docker hub
uses: docker/login-action@v2
with:
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }}
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }}
- name: get kernel version
id: get-kernel-version
run: |
linux_config=$(ls neonvm/hack/linux-config-*) # returns something like "neonvm/hack/linux-config-6.1.63"
kernel_version=${linux_config##*-} # returns something like "6.1.63"
echo VM_KERNEL_VERSION=$kernel_version >> $GITHUB_OUTPUT
- name: build linux kernel
id: build-linux-kernel
uses: docker/build-push-action@v3
with:
build-args: KERNEL_VERSION=${{ steps.get-kernel-version.outputs.VM_KERNEL_VERSION }}
context: neonvm/hack
platforms: linux/amd64
# Push only if this is a scheduled run or if the workflow_dispatch input push is set to true
push: ${{ github.event_name == 'schedule' && 'true' || ( github.event_name == 'workflow_dispatch' && inputs.push || 'false' ) }}
pull: true
no-cache: true
file: neonvm/hack/Dockerfile.kernel-builder
# Tag the image with the tag from the workflow_dispatch input or the VM_KERNEL_VERSION from linux-config-* file
tags: ${{ env.VM_KERNEL_IMAGE }}:${{ (github.event_name == 'workflow_dispatch' && inputs.tag != '') && inputs.tag || steps.get-kernel-version.outputs.VM_KERNEL_VERSION }}
- name: remove custom docker config directory
if: always()
run: |
rm -rf .docker-custom
e2e-tests:
needs: vm-kernel
uses: ./.github/workflows/e2e-test.yaml
with:
kernel-image: ${{ needs.vm-kernel.outputs.image }}