mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-10 15:12:01 -03:30
build-lxd.yml: Include LXC build
Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
parent
e170cec36e
commit
280ca821aa
80
.github/workflows/build-lxd.yml
vendored
80
.github/workflows/build-lxd.yml
vendored
@ -6,10 +6,14 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
outputs:
|
||||
artifact_name:
|
||||
value: "${{ jobs.build-current.outputs.artifact_name }}"
|
||||
artifact_file:
|
||||
value: "${{ jobs.build-current.outputs.artifact_file }}"
|
||||
lxd_artifact_name:
|
||||
value: "${{ jobs.build-lxd-current.outputs.artifact_name }}"
|
||||
lxd_artifact_file:
|
||||
value: "${{ jobs.build-lxd-current.outputs.artifact_file }}"
|
||||
lxc_artifact_name:
|
||||
value: "${{ jobs.build-lxc-current.outputs.artifact_name }}"
|
||||
lxc_artifact_file:
|
||||
value: "${{ jobs.build-lxc-current.outputs.artifact_file }}"
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
@ -20,7 +24,44 @@ on:
|
||||
- release/*
|
||||
|
||||
jobs:
|
||||
build-current:
|
||||
|
||||
build-lxc-current:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
artifact_name: "${{ env.ARTIFACT_NAME }}"
|
||||
artifact_file: "${{ steps.pack-lxd.outputs.artifact_file }}"
|
||||
env:
|
||||
VERSION: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
|
||||
ARTIFACT_NAME: "${{ github.run_id }}-lxd-image"
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: "${{ env.VERSION }}"
|
||||
- name: Setup LXC
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install lxc
|
||||
|
||||
- name: Build LXC image
|
||||
run: |
|
||||
export IMG="NextCloudPi_LXD_${VERSION//\//_}.img"
|
||||
./build/build-LXC.sh
|
||||
- name: Pack LXC image
|
||||
id: pack-lxc
|
||||
run: |
|
||||
. ./build/buildlib.sh
|
||||
ARTIFACT_FILE="NextCloudPi_LXD_${VERSION//\//_}"
|
||||
pack_image "tmp/${ARTIFACT_FILE}.img" output/${ARTIFACT_FILE}"
|
||||
echo "artifact_file=${ARTIFACT_FILE}.tar.gz" >> $GITHUB_OUTPUT
|
||||
- name: upload LXD image to artifact store
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: "${{ env.ARTIFACT_NAME }}"
|
||||
path: "output/${{ steps.pack-lxc.outputs.artifact_file }}"
|
||||
if-no-files-found: error
|
||||
|
||||
build-lxd-current:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
artifact_name: "${{ env.ARTIFACT_NAME }}"
|
||||
@ -37,27 +78,6 @@ jobs:
|
||||
with:
|
||||
lxd_version: latest/stable
|
||||
|
||||
# - name: Fix LXD
|
||||
# run: |
|
||||
# ip address
|
||||
# ip route list
|
||||
# lxc profile create network
|
||||
# cat <<EOF | lxc profile edit network
|
||||
# devices:
|
||||
# eth0:
|
||||
# name: eth0
|
||||
# parent: lxdbr0
|
||||
# nictype: bridged
|
||||
# type: nic
|
||||
# EOF
|
||||
# ip route list
|
||||
# ifconfig lxdbr0
|
||||
|
||||
- name: Debug LXD
|
||||
run: |
|
||||
lxc version
|
||||
lxc network set lxdbr0 ipv4.nat true
|
||||
lxc network list
|
||||
- name: Build LXD image
|
||||
run: |
|
||||
./build/build-LXD.sh
|
||||
@ -239,14 +259,14 @@ jobs:
|
||||
path: "output/${{ steps.pack-lxd.outputs.artifact_file }}"
|
||||
if-no-files-found: error
|
||||
|
||||
test-fresh-install:
|
||||
test-lxd-fresh-install:
|
||||
needs:
|
||||
- build-current
|
||||
- build-lxd-current
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
VERSION: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
|
||||
ARTIFACT_NAME: ${{ needs.build-current.outputs.artifact_name }}
|
||||
ARTIFACT_FILE: ${{ needs.build-current.outputs.artifact_file }}
|
||||
ARTIFACT_NAME: ${{ needs.build-lxd-current.outputs.artifact_name }}
|
||||
ARTIFACT_FILE: ${{ needs.build-lxd-current.outputs.artifact_file }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
1
.github/workflows/lxd-trigger.yml
vendored
1
.github/workflows/lxd-trigger.yml
vendored
@ -9,6 +9,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- devel
|
||||
- feature/cicd/restore-unsupported-release-targets
|
||||
|
||||
jobs:
|
||||
lxd:
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
# Usage:
|
||||
#
|
||||
|
||||
set -e
|
||||
set -ex
|
||||
source build/buildlib.sh
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP LXC ]\e[0m"
|
||||
|
||||
#CLEAN=0 # Pass this envvar to skip cleaning download cache
|
||||
IMG="NextCloudPi_LXC_$( date "+%m-%d-%y" ).img"
|
||||
IMG="${IMG:-"NextCloudPi_LXC_$( date "+%m-%d-%y" ).img"}"
|
||||
IMG=tmp/"$IMG"
|
||||
|
||||
TAR=output/"$( basename "$IMG" .img ).tar.bz2"
|
||||
@ -40,12 +40,14 @@ sudo lxc-attach -n ncp --clear-env -- bash -c 'while [ "$(systemctl is-system-ru
|
||||
sudo lxc-attach -n ncp --clear-env -- CODE_DIR="$(pwd)" bash /build/install.sh
|
||||
sudo lxc-attach -n ncp --clear-env -- bash -c 'source /build/etc/library.sh; run_app_unsafe /build/post-inst.sh'
|
||||
sudo lxc-attach -n ncp --clear-env -- bash -c "echo '$(basename "$IMG")' > /usr/local/etc/ncp-baseimage"
|
||||
sudo lxc-attach -n ncp --clear-env -- usermod -s /bin/bash ncp
|
||||
sudo lxc-attach -n ncp --clear-env -- usermod -a -G sudo ncp
|
||||
sudo lxc-attach -n ncp --clear-env -- poweroff
|
||||
|
||||
exit 0 # TODO
|
||||
|
||||
## pack
|
||||
pack_image "$IMG" "$TAR"
|
||||
[[ " $* " =~ .*" --pack ".* ]] && pack_image "$IMG" "$TAR"
|
||||
|
||||
exit 0
|
||||
|
||||
## test
|
||||
#set_static_IP "$IMG" "$IP"
|
||||
|
||||
@ -14,7 +14,7 @@ source build/buildlib.sh
|
||||
echo -e "\e[1m\n[ Build NCP LXD ]\e[0m"
|
||||
|
||||
#CLEAN=0 # Pass this envvar to skip cleaning download cache
|
||||
IMG="NextCloudPi_LXD_$( date "+%m-%d-%y" ).img"
|
||||
IMG="${IMG:-"NextCloudPi_LXD_$( date "+%m-%d-%y" ).img"}"
|
||||
IMG=tmp/"$IMG"
|
||||
|
||||
TAR=output/"$( basename "$IMG" .img ).tar.bz2"
|
||||
@ -41,6 +41,8 @@ lxc exec ncp -- bash -c 'while [ "$(systemctl is-system-running 2>/dev/null)" !=
|
||||
lxc exec ncp -- bash -c 'CODE_DIR=/build DBG=x bash /build/install.sh'
|
||||
lxc exec ncp -- bash -c 'source /build/etc/library.sh; run_app_unsafe /build/post-inst.sh'
|
||||
lxc exec ncp -- bash -c "echo '$(basename "$IMG")' > /usr/local/etc/ncp-baseimage"
|
||||
lxc exec ncp -- usermod -s /bin/bash ncp
|
||||
lxc exec ncp -- usermod -a -G sudo ncp
|
||||
lxc stop ncp
|
||||
lxc config device remove ncp buildcode
|
||||
lxc publish -q ncp -f --alias ncp/"${version}"
|
||||
|
||||
@ -38,7 +38,7 @@ umount_raspbian
|
||||
pack_image "$IMG" "$TAR"
|
||||
|
||||
# upload
|
||||
create_torrent "$TAR"
|
||||
# create_torrent "$TAR"
|
||||
#upload_ftp "$( basename "$TAR" .tar.bz2 )"
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user