mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-24 00:50:56 -05:00
Merge pull request 'DRY: re-use lxc-helpers' (#18) from earl-warren/setup-forgejo:wip-helpers into main
Reviewed-on: https://code.forgejo.org/actions/setup-forgejo/pulls/18 Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
This commit is contained in:
commit
9c653c5938
7 changed files with 19 additions and 26 deletions
|
@ -11,6 +11,8 @@ jobs:
|
|||
runs-on: self-hosted
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: 'true'
|
||||
- run: |
|
||||
set -x
|
||||
./forgejo-dependencies.sh install_docker
|
||||
|
|
|
@ -4,6 +4,8 @@ jobs:
|
|||
runs-on: self-hosted
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: 'true'
|
||||
- run: |
|
||||
set -x
|
||||
LXC_IP_PREFIX=10.0.9 ./forgejo-dependencies.sh
|
||||
|
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "lxc-helpers"]
|
||||
path = lxc-helpers
|
||||
url = https://code.forgejo.org/forgejo/lxc-helpers
|
|
@ -3,35 +3,18 @@
|
|||
|
||||
set -x
|
||||
|
||||
source $(dirname $0)/lxc-helpers/enough-lxc-helpers.sh
|
||||
|
||||
: ${LXC_IP_PREFIX:=10.0.8}
|
||||
|
||||
function install_docker() {
|
||||
if ! systemctl is-active --quiet docker; then
|
||||
echo deb http://deb.debian.org/debian bullseye-backports main | tee /etc/apt/sources.list.d/backports.list && apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --quiet -y -t bullseye-backports git docker.io
|
||||
fi
|
||||
}
|
||||
|
||||
function install_lxc() {
|
||||
if ! systemctl is-active --quiet lxc-net; then
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq make git libvirt0 libpam-cgfs bridge-utils uidmap dnsmasq-base dnsmasq dnsmasq-utils qemu-user-static
|
||||
systemctl disable --now dnsmasq
|
||||
apt-get install -y -qq lxc
|
||||
systemctl stop lxc-net
|
||||
cat >> /etc/default/lxc-net <<EOF
|
||||
LXC_ADDR="$LXC_IP_PREFIX.1"
|
||||
LXC_NETMASK="255.255.255.0"
|
||||
LXC_NETWORK="$LXC_IP_PREFIX.0/24"
|
||||
LXC_DHCP_RANGE="$LXC_IP_PREFIX.2,$LXC_IP_PREFIX.254"
|
||||
LXC_DHCP_MAX="253"
|
||||
EOF
|
||||
systemctl start lxc-net
|
||||
lxc_install_docker_inside
|
||||
fi
|
||||
}
|
||||
|
||||
function install_other() {
|
||||
local packages="sudo"
|
||||
local packages="sudo git"
|
||||
if ! which $packages ; then
|
||||
apt-get install -y -qq $packages
|
||||
fi
|
||||
|
@ -40,7 +23,7 @@ function install_other() {
|
|||
function setup() {
|
||||
install_other
|
||||
install_docker
|
||||
install_lxc
|
||||
lxc_install_lxc_inside $LXC_IP_PREFIX
|
||||
}
|
||||
|
||||
"${@:-setup}"
|
||||
|
|
|
@ -13,8 +13,8 @@ function dependency_go() {
|
|||
if ! which go > /dev/null ; then
|
||||
apt-get update
|
||||
apt-get install -y -qq wget tar
|
||||
wget https://go.dev/dl/go1.20.3.linux-amd64.tar.gz
|
||||
tar zxf go1.20.3.linux-amd64.tar.gz
|
||||
wget --quiet https://go.dev/dl/go1.20.4.linux-amd64.tar.gz
|
||||
tar zxf go1.20.4.linux-amd64.tar.gz
|
||||
export PATH=$PATH:$(pwd)/go/bin
|
||||
fi
|
||||
}
|
||||
|
@ -138,10 +138,10 @@ function push_self_action() {
|
|||
local tag="$4"
|
||||
|
||||
local dir="$DIR/self"
|
||||
git clone . $dir
|
||||
git clone --recurse-submodules . $dir
|
||||
(
|
||||
cd $dir
|
||||
rm -fr .forgejo .git
|
||||
rm -fr .forgejo .git lxc-helpers/.git
|
||||
git init
|
||||
git checkout -b main
|
||||
git remote add origin "$url/$owner/$self_action"
|
||||
|
|
1
lxc-helpers
Submodule
1
lxc-helpers
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 0e3a7b3f4835b45cc3758f974f09819c923b2398
|
|
@ -10,6 +10,8 @@ jobs:
|
|||
echo +++++++++++++++++++++++++++++++++++++++++++
|
||||
echo about to actions/checkout@v3 for SELF@vTest
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: 'true'
|
||||
- id: forgejo
|
||||
uses: SELF@vTest
|
||||
with:
|
||||
|
|
Loading…
Reference in a new issue