chore: gitea pipeline

This commit is contained in:
Radostin Emanuilov 2024-08-28 16:40:20 +01:00
parent f00b160a42
commit a47812d345
No known key found for this signature in database
3 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# action.yml
name: 'Build VM disk'
description: 'Setups a Rocky Linux 9 Cloud based VM disk capable of building the bootc image'
runs:
using: 'docker'
image: 'docker://docker.io/monolithify/gitlab-runner-image:latest'
post-entrypoint: './scripts/setupBuilder/main.sh'

View File

View File

@ -0,0 +1,57 @@
env:
VM_DISK_OUTPUT_DIR: "/rockyDisks"
SECURE_FILES_DOWNLOAD_PATH: "/secureFiles"
REPO_DIR: /base-image-build
VM_DISK_FILE_TO_DOWNLOAD: "Rocky-9-GenericCloud-Base-9.4-20240609.0.x86_64.qcow2"
BASE_DISK_FILEPATH: "${{ env.VM_DISK_OUTPUT_DIR }}/${{ env.VM_DISK_FILE_TO_DOWNLOAD }}"
OUTPUT_FILE_PATH: "${{ env.VM_DISK_OUTPUT_DIR }}/${{ env.VM_DISK_FILE_TO_DOWNLOAD }}-${{ env.CI_COMMIT_SHA }}"
ROCKY_VERSION: "9.4"
CONTAINER_REGISTRY_DOMAIN: docker.io
CONTAINER_REGISTRY_ORG: monolithify
CONTAINER_REGISTRY_WITH_ORG: ${{ env.CONTAINER_REGISTRY_DOMAIN }}/${{ env.CONTAINER_REGISTRY_ORG}}
CONTAINER_REGISTRY_RW_USER: ${{ vars.CONTAINER_REGISTRY_RW_USER }}
CONTAINER_REGISTRY_RW_PASS: ${{ secrets.CONTAINER_REGISTRY_RW_PASS }}
CI_COMMIT_SHA: ${{ github.sha }}
BUILDER_PRIVATE_KEY: ${{ secrets.BUILDER_PRIVATE_KEY }}
BUILDER_PUBLIC_KEY: ${{ secrets.BUILDER_PUBLIC_KEY }}
BUILDER_CONTAINER_NAME: bootc-builder
OUTPUT_BOOTC_IMAGE_NAME: "rocky9-bootc:${{ env.CI_COMMIT_SHA }}"
OUTPUT_BOOTC_IMAGE_NAME_LATEST: "rocky9-bootc:latest"
name: build and push bootc image
on:
push:
branches:
- main
jobs:
build:
runs-on: bootc-runner
container:
image: docker:27.0.3
services:
docker:
image: docker:27.0.3-dind
steps:
- name: Setup the build environment
run: |
export BUILDER_PRIVATE_KEY=$(echo -ne "$BUILDER_PRIVATE_KEY" | awk '{printf "%s\\n", $0}')
export BUILDER_PUBLIC_KEY=$(echo -ne "$BUILDER_PUBLIC_KEY" | awk '{printf "%s\\n", $0}')
printenv > .env
docker run -d --name $BUILDER_CONTAINER_NAME --privileged \
--env-file .env \
docker.io/monolithify/gitlab-runner-image
docker exec $BUILDER_CONTAINER_NAME git clone https://gitlab.com/monolithify/base-image-build.git $REPO_DIR
docker exec $BUILDER_CONTAINER_NAME chmod -R +x $REPO_DIR/scripts
docker exec $BUILDER_CONTAINER_NAME mkdir /rockyDisks
- name: Setup builder VM
run: |
docker exec $BUILDER_CONTAINER_NAME $REPO_DIR/scripts/setupBuilder/main.sh
- name: Build-Push the bootc container image
run:
docker exec $BUILDER_CONTAINER_NAME $REPO_DIR/scripts/buildPushBootcContainerImage/main.sh
- name: Stop the dangling builder container
if: always()
run: docker rm -f $BUILDER_CONTAINER_NAME || true