gitlab-ci: initial #9

Merged
ayakael merged 1 commit from gitlab-ci/initial into master 2023-08-26 23:08:34 +00:00
2 changed files with 148 additions and 0 deletions
Showing only changes of commit 5aa132b5f8 - Show all commits

107
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,107 @@
stages:
- build
- release
variables:
GIT_STRATEGY: clone
GIT_DEPTH: "500"
.verify:
stage: build
rules:
- if: $CI_MERGE_REQUEST_ID
interruptible: true
script:
- |
sudo apk add rpm wget losetup coreutils eudev e2fsprogs xen
doas addgroup $USER abuild
export PATH="$PATH:$CI_PROJECT_DIR/.gitlab/bin"
git clone https://github.com/QubesOS/qubes-builder
mkdir qubes-builder/qubes-src
ln -s $CI_PROJECT_DIR qubes-builder/qubes-src/builder-alpine
cp builder.conf qubes-builder/.
git clone https://github.com/QubesOS/qubes-linux-template-builder qubes-builder/qubes-src/linux-template-builder
echo "%define _arch x86_64" >> qubes-builder/qubes-src/linux-template-builder/templates.spec
cd qubes-builder
make linux-template-builder
cp qubes-src/linux-template-builder/rpm/noarch/qubes-template-*.rpm $CI_PROJECT_DIR/.
artifacts:
paths:
- qubes-template-*.rpm
expire_in: 7 days
when: always
tags:
- qubes-template
verify-alpine318:
extends: .verify
variables:
CI_ALPINE_TARGET_RELEASE: alpine318
.build:
stage: build
rules:
- if: $CI_COMMIT_TAG
interruptible: true
script:
- |
sudo apk add rpm wget losetup coreutils eudev e2fsprogs xen
doas addgroup $USER abuild
export PATH="$PATH:$CI_PROJECT_DIR/.gitlab/bin"
git clone https://github.com/QubesOS/qubes-builder
mkdir qubes-builder/qubes-src
ln -s $CI_PROJECT_DIR qubes-builder/qubes-src/builder-alpine
cp builder.conf qubes-builder/.
git clone https://github.com/QubesOS/qubes-linux-template-builder qubes-builder/qubes-src/linux-template-builder
echo "%define _arch x86_64" >> qubes-builder/qubes-src/linux-template-builder/templates.spec
cd qubes-builder
make linux-template-builder
cp qubes-src/linux-template-builder/rpm/noarch/qubes-template-*.rpm $CI_PROJECT_DIR/.
cd $CI_PROJECT_DIR
CI_ALPINE_RPM_NAME="$(find qubes-template*.rpm)"
echo "ALPINE_RPM_NAME=$CI_ALPINE_RPM_NAME" > job.env
echo "Generating sha512sum"
sha512sum $CI_ALPINE_RPM_NAME > $CI_ALPINE_RPM_NAME.sha512sum
after_script:
- echo "JOB_ID=$CI_JOB_ID" >> job.env
artifacts:
paths:
- qubes-template*.rpm
- qubes-template*.sha512sum
expire_in: never
when: always
reports:
dotenv: job.env
tags:
- qubes-template
build-alpine318:
extends: .build
variables:
CI_ALPINE_TARGET_RELEASE: alpine318
release:
stage: release
allow_failure: false
tags:
- qubes-template
rules:
- if: $CI_COMMIT_TAG
when: on_success
script:
- echo "Create Release $GI_COMMIT_TAG"
- echo $JOB_ID
- echo $ALPINE_RPM_NAME
release:
name: 'Release $CI_COMMIT_TAG'
description: 'Release $CI_COMMIT_TAG'
tag_name: '$CI_COMMIT_TAG'
ref: '$CI_COMMIT_SHA'
assets:
links:
- name: "$ALPINE_RPM_NAME"
filepath: "/template/qubes-template-$CI_COMMIT_TAG.rpm"
url: "https://lab.ilot.io/ayakael/qubes-builder-alpine/-/jobs/$JOB_ID/artifacts/raw/$ALPINE_RPM_NAME"
- name: "$ALPINE_RPM_NAME.sha512sum"
filepath: "/template/qubes-template-$CI_COMMIT_TAG.rpm.sha512sum"
url: "https://lab.ilot.io/ayakael/qubes-builder-alpine/-/jobs/$JOB_ID/artifacts/raw/$ALPINE_RPM_NAME.sha512sum"

41
builder.conf Normal file
View file

@ -0,0 +1,41 @@
# Debian based template configuration file for qubes-builder
#
# Copy or soft link this file into the qubes-builder directory
# and name it builder.conf
#
# All lines which begins with "#" are treated as comments
# Assigments can be made with VAR_NAME="VALUE"
# TEMPLATE_ONLY - Only build templates
# Set 1 to only build template or clear the value for a full build
# Default: novalue
TEMPLATE_ONLY ?= 1
# Release Version
# 2 - Release 2
# 3 - Release 3
# Default: 3
RELEASE := 1
# GIT_PREFIX - Git release repo prefix
# Default: R2: qubes-r2/ R3: qubes-r3/
GIT_PREFIX := QubesOS/qubes-
# DISTS_VM - Choose the templates to build. Multiple templates can be defined
# to build. Uncomment tempalte dist to build.
DISTS_VM := alpine318
COMPONENTS += builder-alpine
BUILDER_PLUGINS += builder-alpine
# DEBUG - Print verbose messages about qubes-builder itself - set "1" to use it
# Default: no value
DEBUG = 0
# VERBOSE - Verbosity level of build process
# 0 - print almost no messages but all build process
# 1 - print (almost) only warnings
# 2 - full output
# Default: 0
VERBOSE = 2
# vim: filetype=make