From 203f05100b9dec45630c8cee19336da62058deb0 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Tue, 16 May 2023 23:39:10 +0200 Subject: [PATCH 1/3] add lxc-helpers --- .forgejo/workflows/forgejo-sh.yml | 2 ++ .forgejo/workflows/integration.yml | 2 ++ .gitmodules | 3 +++ forgejo-test-helper.sh | 4 ++-- lxc-helpers | 1 + testdata/sanity-checks/.forgejo/workflows/test.yml | 2 ++ 6 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 160000 lxc-helpers diff --git a/.forgejo/workflows/forgejo-sh.yml b/.forgejo/workflows/forgejo-sh.yml index 7fecb0d..b18b4b4 100644 --- a/.forgejo/workflows/forgejo-sh.yml +++ b/.forgejo/workflows/forgejo-sh.yml @@ -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 diff --git a/.forgejo/workflows/integration.yml b/.forgejo/workflows/integration.yml index fc0e253..c751d55 100644 --- a/.forgejo/workflows/integration.yml +++ b/.forgejo/workflows/integration.yml @@ -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 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2a45ddd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lxc-helpers"] + path = lxc-helpers + url = https://code.forgejo.org/forgejo/lxc-helpers diff --git a/forgejo-test-helper.sh b/forgejo-test-helper.sh index a0bdc29..50f8b2a 100755 --- a/forgejo-test-helper.sh +++ b/forgejo-test-helper.sh @@ -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" diff --git a/lxc-helpers b/lxc-helpers new file mode 160000 index 0000000..0e3a7b3 --- /dev/null +++ b/lxc-helpers @@ -0,0 +1 @@ +Subproject commit 0e3a7b3f4835b45cc3758f974f09819c923b2398 diff --git a/testdata/sanity-checks/.forgejo/workflows/test.yml b/testdata/sanity-checks/.forgejo/workflows/test.yml index f09e670..a648dcb 100644 --- a/testdata/sanity-checks/.forgejo/workflows/test.yml +++ b/testdata/sanity-checks/.forgejo/workflows/test.yml @@ -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: From 178b7fa387f3d90ea6820063160d415c5850946c Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Wed, 17 May 2023 01:01:54 +0200 Subject: [PATCH 2/3] upgrade to go 1.20.4 --- forgejo-test-helper.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forgejo-test-helper.sh b/forgejo-test-helper.sh index 50f8b2a..cc6eddb 100755 --- a/forgejo-test-helper.sh +++ b/forgejo-test-helper.sh @@ -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 } From 7bb4ff5671e9f52e73c047d3488524c2f9a42fe0 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Wed, 17 May 2023 01:02:22 +0200 Subject: [PATCH 3/3] DRY: re-use lxc-helpers --- forgejo-dependencies.sh | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/forgejo-dependencies.sh b/forgejo-dependencies.sh index 42ee283..ace9635 100755 --- a/forgejo-dependencies.sh +++ b/forgejo-dependencies.sh @@ -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 <