Installer and pipeline fixes

Signed-off-by: Tobias K <6317548+theCalcaholic@users.noreply.github.com>
Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias K 2023-01-05 02:11:52 +01:00 committed by Tobias Knöppler
parent 8149493439
commit 2072f77720
No known key found for this signature in database
GPG Key ID: 3510056072886A8F
11 changed files with 272 additions and 98 deletions

View File

@ -30,14 +30,17 @@ jobs:
env:
VERSION: "${{ inputs.git_ref || github.ref }}"
ARCH: "${{ inputs.arch || 'x86' }}"
LOG_DCKR: "\\033[1;34mDCKR::\\033[0m"
LOG_NCP: "\\033[1;36m~NCP::\\033[0m"
LOG_CICD: "\\033[1;35mCICD::\\033[0m"
LOG_TEST: "\\033[1;33mTEST::\\033[0m"
LOG_DIAG: "\\033[1;31mDIAG::\\033[0m"
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Checkout code
uses: actions/checkout@v3
@ -66,7 +69,14 @@ jobs:
env:
VERSION: "${{ inputs.git_ref || github.ref }}"
ARCH: "${{ inputs.arch || 'x86' }}"
LOG_DCKR: "\\033[1;34mDCKR::\\033[0m"
LOG_NCP: "\\033[1;36m~NCP::\\033[0m"
LOG_CICD: "\\033[1;35mCICD::\\033[0m"
LOG_TEST: "\\033[1;33mTEST::\\033[0m"
LOG_DIAG: "\\033[1;31mDIAG::\\033[0m"
steps:
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Checkout code
uses: actions/checkout@v3
with:
@ -101,9 +111,12 @@ jobs:
}
echo "Previous version is '$version'"
echo "PREVIOUS_VERSION=$version" >> "$GITHUB_ENV"
echo "::set-output name=previous_version::${version}"
echo "previous_version=${version}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Enable qemu SUID
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes
- name: Start ncp container
run: |
@ -117,10 +130,10 @@ jobs:
RUN echo 'Mutex posixsem' >> /etc/apache2/mods-available/ssl.conf
EOF
docker build . -t ncp-testing -f Dockerfile
docker buildx build --platform "$platform" . -t ncp-testing -f Dockerfile
popd
rm -r "$tmpdir"
docker run --platform "$platform" -v ncdata:/data -d --rm -p 8443:443 -p 4443:4443 --name nextcloudpi ncp-testing
docker run --platform "$platform" -v ncdata:/data -d --rm -p 8443:443 -p 4443:4443 --name nextcloudpi ncp-testing localhost
- name: Checkout code
uses: actions/checkout@v3
@ -137,10 +150,10 @@ jobs:
- name: Activate container
working-directory: ./tests
run: |
docker logs nextcloudpi |& awk '{ print "CONTAINER::" $0 }'
echo 'CONTAINER:: =========='
docker logs -f nextcloudpi |& awk '{ print "CONTAINER::" $0 }' &
docker exec nextcloudpi bash -c 'tail -f /var/log/ncp.log' |& awk '{ print "NCP::" $0 }' &
docker logs nextcloudpi |& awk "{ print \"${LOG_DCKR} \" \$0 }"
echo -e "${LOG_DCKR} =========="
docker logs -f nextcloudpi |& awk "{ print \"${LOG_DCKR} \" \$0 }" &
docker exec nextcloudpi bash -c 'tail -f /var/log/ncp.log' |& awk "{ print \"${LOG_NCP} \" \$0 }" &
cmd=(python activation_tests.py --no-gui localhost 8443 4443)
[[ "${ARCH?}" == "x86" ]] || { sleep 30; cmd+=(--timeout 300); }
@ -148,10 +161,13 @@ jobs:
for attempt in {1..3}
do
echo ":: Activation Tests (attempt $attempt/3) ::"
"${cmd[@]}" || {
tail -n 20 geckodriver.log >&2 || true
echo "CI:: Activation test (attempt $attempt/3) failed!"
docker exec nextcloudpi bash /usr/local/bin/ncp-diag
"${cmd[@]}" |& awk "{ print \"${LOG_TEST} \" \$0 }"
[[ ${PIPESTATUS[0]} -eq 0 ]] || {
tail -n 20 geckodriver.log |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
echo -e "${LOG_CICD} Activation test (attempt $attempt/3) failed!"
docker exec nextcloudpi bash /usr/local/bin/ncp-diag |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
cat /proc/sys/fs/binfmt_misc/qemu-aarch64 |& awk "{ print \"${LOG_DIAG} (qemu-aarch64) \" \$0 }" || true
cat /proc/sys/fs/binfmt_misc/qemu-arm |& awk "{ print \"${LOG_DIAG} (qemu-arm) \" \$0 }" || true
sleep 12
continue
}
@ -159,21 +175,24 @@ jobs:
break
done
[[ "$success" == "true" ]] || {
echo "CI:: Activation test failed in all attempts!"
echo -e "${LOG_CICD} Activation test failed in all attempts!"
echo "Creating error report..."
docker exec nextcloudpi bash /usr/local/bin/ncp-report > error-report.txt
echo "done."
exit 1
}
echo "CI:: Activation test successful"
echo -e "${LOG_CICD} Activation test successful"
- name: Start new container
run: |
docker stop nextcloudpi
docker run -d -v ncdata:/data --rm -p 8443:443 -p 4443:4443 --name nextcloudpi thecalcaholic/ncp-internal-${ARCH?}:${{ github.run_id }}-testing
docker run -d -v ncdata:/data --rm -p 8443:443 -p 4443:4443 --name nextcloudpi thecalcaholic/ncp-internal-${ARCH?}:${{ github.run_id }}-testing localhost
- name: Integration Tests
working-directory: ./tests
run: |
docker logs nextcloudpi |& awk '{ print "CONTAINER::" $0 }'
echo 'CONTAINER:: =========='
docker logs -f nextcloudpi |& awk '{ print "CONTAINER::" $0 }' &
docker exec nextcloudpi bash -c 'tail -f /var/log/ncp.log' |& awk '{ print "NCP::" $0 }' &
docker logs nextcloudpi |& awk "{ print \"${LOG_DCKR} \" \$0 }"
echo -e "${LOG_DCKR} =========="
docker logs -f nextcloudpi |& awk "{ print \"${LOG_DCKR} \" \$0 }" &
docker exec nextcloudpi bash -c 'tail -f /var/log/ncp.log' |& awk "{ print \"${LOG_NCP} \" \$0 }" &
[[ "${ARCH?}" == "x86" ]] || sleep 30
sleep 20
@ -182,8 +201,9 @@ jobs:
for attempt in {1..3}
do
echo ":: System Tests (attempt $attempt/3) ::"
python system_tests.py --no-ping --non-interactive || {
echo "CI:: System test (attempt $attempt) failed!"
python system_tests.py --no-ping --non-interactive || awk "{ print \"${LOG_TEST} \" \$0 }"
[[ ${PIPESTATUS[0]} -eq 0 ]] || {
echo -e "${LOG_CICD} System test (attempt $attempt) failed!"
sleep 12
continue
}
@ -191,18 +211,19 @@ jobs:
break
done
[[ "$success" == "true" ]] || {
echo "CI:: System test failed in all attempts!"
echo -e "${LOG_CICD} System test failed in all attempts!"
exit 1
}
echo "CI:: System test successful"
echo -e "${LOG_CICD} System test successful"
success=false
for attempt in {1..3}
do
echo ":: Nextcloud Tests (attempt $attempt/3) ::"
python nextcloud_tests.py --no-gui localhost 8443 4443 || {
tail -n 20 geckodriver.log >&2 || true
echo "CI:: Nextcloud test (attempt $attempt/3) failed!"
python nextcloud_tests.py --no-gui localhost 8443 4443 |& awk "{ print \"${LOG_TEST} \" \$0 }"
[[ ${PIPESTATUS[0]} -eq 0 ]] || {
tail -n 20 geckodriver.log |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
echo -e "${LOG_CICD} Nextcloud test (attempt $attempt/3) failed!"
sleep 12
continue
}
@ -210,12 +231,21 @@ jobs:
break
done
[[ "$success" == "true" ]] || {
echo "CI:: Nextcloud test failed in all attempts!"
echo -e "${LOG_CICD} Nextcloud test failed in all attempts!"
echo -e "${LOG_CICD} Creating error report..."
docker exec nextcloudpi bash /usr/local/bin/ncp-report > error-report.txt
echo -e "${LOG_CICD} done."
exit 1
}
echo "CI:: Nextcloud test successful"
echo -e "${LOG_CICD} Nextcloud test successful"
docker exec nextcloudpi bash /usr/local/bin/ncp-diag
docker exec nextcloudpi bash /usr/local/bin/ncp-diag |& awk "{ print \"${LOG_DIAG} \" \$0 }"
- name: "Upload error report"
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: ${{ github.run_id }}-docker-${{ env.ARCH }}-update-test-error-report
path: tests/error-report.txt
test:
needs:
@ -224,16 +254,21 @@ jobs:
env:
VERSION: "${{ inputs.git_ref || github.ref }}"
ARCH: "${{ inputs.arch || 'x86' }}"
LOG_DCKR: "\\033[1;34mDCKR::\\033[0m"
LOG_NCP: "\\033[1;36m~NCP::\\033[0m"
LOG_CICD: "\\033[1;35mCICD::\\033[0m"
LOG_TEST: "\\033[1;33mTEST::\\033[0m"
LOG_DIAG: "\\033[1;31mDIAG::\\033[0m"
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Login to docker
run: |
echo "${{ secrets.DOCKER_PASSWORD_INTERNAL }}" | docker login -u "${{ secrets.DOCKER_LOGIN_INTERNAL }}" --password-stdin
- name: Start ncp container
run: |
docker run -d --rm -p 8443:443 -p 4443:4443 --name nextcloudpi thecalcaholic/ncp-internal-${ARCH?}:${{ github.run_id }}-testing
docker run -d --rm -p 8443:443 -p 4443:4443 --name nextcloudpi thecalcaholic/ncp-internal-${ARCH?}:${{ github.run_id }}-testing localhost
- name: Checkout code
uses: actions/checkout@v3
@ -250,10 +285,10 @@ jobs:
- name: Integration Tests
working-directory: ./tests
run: |
docker logs nextcloudpi |& awk '{ print "CONTAINER::" $0 }'
echo 'CONTAINER:: =========='
docker logs -f nextcloudpi |& awk '{ print "CONTAINER::" $0 }' &
docker exec nextcloudpi bash -c 'tail -f /var/log/ncp.log' |& awk '{ print "NCP::" $0 }' &
docker logs nextcloudpi |& awk "{ print \"${LOG_DCKR} \" \$0 }"
echo -e "${LOG_DCKR} =========="
docker logs -f nextcloudpi |& awk "{ print \"${LOG_DCKR} \" \$0 }" &
docker exec nextcloudpi bash -c 'tail -f /var/log/ncp.log' |& awk "{ print \"${LOG_NCP} \" \$0 }" &
cmd=(python activation_tests.py --no-gui localhost 8443 4443)
[[ "${ARCH?}" == "x86" ]] || cmd+=(--timeout 300)
@ -261,10 +296,11 @@ jobs:
for attempt in {1..3}
do
echo ":: Activation Tests (attempt $attempt/3) ::"
"${cmd[@]}" || {
tail -n 20 geckodriver.log >&2 || true
echo "CI:: Activation test (attempt $attempt/3) failed!"
docker exec nextcloudpi bash /usr/local/bin/ncp-diag
"${cmd[@]}" |& awk "{ print \"${LOG_TEST} \" \$0 }"
[[ ${PIPESTATUS[0]} -eq 0 ]] || {
tail -n 20 geckodriver.log >&2 |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
echo -e "${LOG_CICD} Activation test (attempt $attempt/3) failed!"
docker exec nextcloudpi bash /usr/local/bin/ncp-diag |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
sleep 12
continue
}
@ -272,17 +308,18 @@ jobs:
break
done
[[ "$success" == "true" ]] || {
echo "CI:: Activation test failed in all attempts!"
echo -e "${LOG_CICD} Activation test failed in all attempts!"
exit 1
}
echo "CI:: Activation test successful"
echo -e "${LOG_CICD} Activation test successful"
success=false
for attempt in {1..3}
do
echo ":: System Tests (attempt $attempt/3) ::"
python system_tests.py --no-ping --non-interactive || {
echo "CI:: System test (attempt $attempt) failed!"
python system_tests.py --no-ping --non-interactive |& awk "{ print \"${LOG_TEST} \" \$0 }"
[[ ${PIPESTATUS[0]} -eq 0 ]] || {
echo -e "${LOG_CICD} System test (attempt $attempt) failed!"
sleep 5
continue
}
@ -290,18 +327,19 @@ jobs:
break
done
[[ "$success" == "true" ]] || {
echo "CI:: System test failed in all attempts!"
echo -e "${LOG_CICD} System test failed in all attempts!"
exit 1
}
echo "CI:: System test successful"
echo -e "${LOG_CICD} System test successful"
success=false
for attempt in {1..3}
do
echo ":: Nextcloud Tests (attempt $attempt/3) ::"
python nextcloud_tests.py --no-gui localhost 8443 4443 || {
tail -n 20 geckodriver.log >&2 || true
echo "CI:: Nextcloud test (attempt $attempt/3) failed!"
python nextcloud_tests.py --no-gui localhost 8443 4443 |& awk "{ print \"${LOG_TEST} \" \$0 }"
[[ ${PIPESTATUS[0]} -eq 0 ]] || {
tail -n 20 geckodriver.log >&2 |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
echo -e "${LOG_CICD} Nextcloud test (attempt $attempt/3) failed!"
sleep 5
continue
}
@ -309,10 +347,19 @@ jobs:
break
done
[[ "$success" == "true" ]] || {
echo "CI:: Nextcloud test failed in all attempts!"
echo -e "${LOG_CICD} Nextcloud test failed in all attempts!"
echo -e "${LOG_CICD} Creating error report..."
docker exec nextcloudpi bash /usr/local/bin/ncp-report > error-report.txt
echo -e "${LOG_CICD} done."
exit 1
}
echo "CI:: Nextcloud test successful"
echo -e "${LOG_CICD} Nextcloud test successful"
docker exec nextcloudpi bash /usr/local/bin/ncp-diag
docker exec nextcloudpi bash /usr/local/bin/ncp-diag |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
- name: "Upload error report"
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: ${{ github.run_id }}-docker-${{ env.ARCH }}-install-test-error-report
path: tests/error-report.txt

View File

@ -19,8 +19,8 @@ on:
- "devel"
jobs:
build:
runs-on: ubuntu-latest
build-current:
runs-on: ubuntu-20.04
outputs:
artifact_name: "${{ env.ARTIFACT_NAME }}"
artifact_file: "${{ steps.pack-lxd.outputs.artifact_file }}"
@ -35,6 +35,28 @@ jobs:
- uses: whywaita/setup-lxd@v1
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
@ -44,7 +66,7 @@ jobs:
. ./build/buildlib.sh
ARTIFACT_FILE="NextCloudPi_LXD_${VERSION//\//_}"
lxc image export -q ncp/"${version}" "output/${ARTIFACT_FILE}"
echo "::set-output name=artifact_file::${ARTIFACT_FILE}.tar.gz"
echo "artifact_file=${ARTIFACT_FILE}.tar.gz" >> $GITHUB_OUTPUT
- name: upload LXD image to artifact store
uses: actions/upload-artifact@v3
with:
@ -53,7 +75,7 @@ jobs:
if-no-files-found: error
build-previous:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
outputs:
artifact_name: "${{ env.ARTIFACT_NAME }}"
artifact_file: "${{ steps.pack-lxd.outputs.artifact_file }}"
@ -61,6 +83,7 @@ jobs:
env:
VERSION: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
ARTIFACT_NAME: "${{ github.run_id }}-lxd-image-previous"
LXD_EXTRA_PROFILE: network
steps:
- name: Checkout code
uses: actions/checkout@v3
@ -93,10 +116,21 @@ jobs:
echo "Previous version is '$version'"
git checkout "$version"
echo "VERSION=$version" >> "$GITHUB_ENV"
echo "::set-output name=previous_version::${version}"
echo "previous_version=${version}" >> $GITHUB_OUTPUT
- uses: whywaita/setup-lxd@v1
with:
lxd_version: latest/stable
- name: Fix LXD
run: |
lxc profile create network
cat <<EOF | lxc profile edit network
devices:
eth0:
name: eth0
parent: lxdbr0
nictype: bridged
type: nic
EOF
- name: Build LXD image
run: |
./build/build-LXD.sh
@ -106,7 +140,7 @@ jobs:
. ./build/buildlib.sh
ARTIFACT_FILE="NextCloudPi_LXD_${VERSION//\//_}"
lxc image export -q ncp/"${version}" "output/${ARTIFACT_FILE}"
echo "::set-output name=artifact_file::${ARTIFACT_FILE}.tar.gz"
echo "artifact_file=${ARTIFACT_FILE}.tar.gz" >> $GITHUB_OUTPUT
- name: upload LXD image to artifact store
uses: actions/upload-artifact@v3
with:
@ -117,7 +151,7 @@ jobs:
update-previous:
needs:
- build-previous
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
outputs:
artifact_name: "${{ env.ARTIFACT_NAME }}"
artifact_file: "${{ steps.pack-lxd.outputs.artifact_file }}"
@ -128,6 +162,17 @@ jobs:
- uses: whywaita/setup-lxd@v1
with:
lxd_version: latest/stable
- name: Fix LXD
run: |
lxc profile create network
cat <<EOF | lxc profile edit network
devices:
eth0:
name: eth0
parent: lxdbr0
nictype: bridged
type: nic
EOF
- name: Checkout code
uses: actions/checkout@v3
with:
@ -185,7 +230,7 @@ jobs:
lxc publish -q ncp -f --alias "ncp/updated"
mkdir -p output
lxc image export -q "ncp/updated" "output/${ARTIFACT_FILE}"
echo "::set-output name=artifact_file::${ARTIFACT_FILE}.tar.gz"
echo "artifact_file=${ARTIFACT_FILE}.tar.gz" >> $GITHUB_OUTPUT
- name: upload LXD image to artifact store
uses: actions/upload-artifact@v3
with:
@ -193,23 +238,14 @@ jobs:
path: "output/${{ steps.pack-lxd.outputs.artifact_file }}"
if-no-files-found: error
test:
test-fresh-install:
needs:
- build
- update-previous
strategy:
matrix:
build:
- source: install
artifact_name: ${{ needs.build.outputs.artifact_name }}
artifact_file: ${{ needs.build.outputs.artifact_file }}
- source: update
artifact_name: ${{ needs.update-previous.outputs.artifact_name }}
artifact_file: ${{ needs.update-previous.outputs.artifact_file }}
fail-fast: false
runs-on: ubuntu-latest
- build-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 }}
steps:
- name: Checkout code
uses: actions/checkout@v3
@ -218,6 +254,16 @@ jobs:
- uses: whywaita/setup-lxd@v1
with:
lxd_version: latest/stable
- name: Fix LXD
run: |
lxc profile create network
cat <<EOF | lxc profile edit network
devices:
eth0:
name: eth0
network: lxdbr0
type: nic
EOF
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
- name: Setup GeckoDriver
@ -227,12 +273,87 @@ jobs:
- name: download LXD image from artifact store
uses: actions/download-artifact@v3
with:
name: ${{ matrix.build.artifact_name }}
name: ${{ env.ARTIFACT_NAME }}
- name: Launch ncp container
run: |
set -x
lxc delete -q -f ncp || true
lxc image import -q "./${{ matrix.build.artifact_file }}" --alias "ncp/test"
lxc image import -q "./${ARTIFACT_FILE?}" --alias "ncp/test"
systemd-run --user --scope -p "Delegate=yes" lxc launch -q "ncp/test" ncp
lxc exec ncp -- bash -c 'while [ "$(systemctl is-system-running 2>/dev/null)" != "running" ] && [ "$(systemctl is-system-running 2>/dev/null)" != "degraded" ]; do :; done'
sleep 30
ip="$(lxc list -c n4 -f csv | grep '^ncp' | cut -d ',' -f2)"
ip="${ip/% *}"
echo "${ip} nextcloudpi.local" | sudo tee /etc/hosts
- name: Test LXD Image
working-directory: ./tests
run: |
lxc exec ncp -- bash -c 'tail -f /var/log/ncp.log' |& awk '{ print "NCP::" $0 }' &
python activation_tests.py --no-gui "nextcloudpi.local" 443 4443 || {
echo "Activation test failed!"
echo "Geckodriver logs:"
tail -n 20 geckodriver.log >&2 || true
echo "================"
echo "ncp.log: "
lxc exec ncp -- "tail -n20 /var/log/ncp.log"
exit 1
}
python system_tests.py --non-interactive || {
echo "System test failed!"
exit 1
}
python nextcloud_tests.py --no-gui "nextcloudpi.local" 443 4443 || {
echo "Nextcloud test failed!"
echo "Geckodriver logs:"
tail -n 20 geckodriver.log >&2 || true
echo "================"
echo "ncp.log: "
lxc exec ncp -- "tail -n20 /var/log/ncp.log"
exit 1
}
lxc stop ncp
test-update:
needs:
- update-previous
runs-on: ubuntu-20.04
env:
VERSION: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
ARTIFACT_NAME: ${{ needs.update-previous.outputs.artifact_name }}
ARTIFACT_FILE: ${{ needs.update-previous.outputs.artifact_file }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: "${{ env.VERSION }}"
- uses: whywaita/setup-lxd@v1
with:
lxd_version: latest/stable
- name: Fix LXD
run: |
lxc profile create network
cat <<EOF | lxc profile edit network
devices:
eth0:
name: eth0
network: lxdbr0
type: nic
EOF
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
- name: Setup GeckoDriver
uses: browser-actions/setup-geckodriver@latest
- name: Setup Selenium
run: pip install selenium
- name: download LXD image from artifact store
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
- name: Launch ncp container
run: |
set -x
lxc delete -q -f ncp || true
lxc image import -q "./${ARTIFACT_FILE?}" --alias "ncp/test"
systemd-run --user --scope -p "Delegate=yes" lxc launch -q "ncp/test" ncp
lxc exec ncp -- bash -c 'while [ "$(systemctl is-system-running 2>/dev/null)" != "running" ] && [ "$(systemctl is-system-running 2>/dev/null)" != "degraded" ]; do :; done'
sleep 30

View File

@ -68,7 +68,7 @@ jobs:
artifacts=("armbian/output/images/Armbian"*.img)
mkdir -p output
mv "${artifacts[0]}" "output/$IMG"
echo "::set-output name=artifact_file::${IMG}"
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
- name: "Build Armbian (2nd attempt)"
if: ${{ inputs.board_id != 'raspberrypi' && steps.build-armbian.outcome == 'failure' }}
@ -87,7 +87,7 @@ jobs:
artifacts=("armbian/output/images/Armbian"*.img)
mkdir -p output
mv "${artifacts[0]}" "output/$IMG"
echo "::set-output name=artifact_file::${IMG}"
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
- name: "Upload Armbian logs"
if: ${{ inputs.board_id != 'raspberrypi' && failure() }}
@ -116,7 +116,7 @@ jobs:
echo "Retrying ($i out of 10)"
done
echo "::set-output name=artifact_file::${IMG}"
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
- name: upload image to artifact store
uses: actions/upload-artifact@v3

View File

@ -81,7 +81,7 @@ jobs:
version="${version%-*-*}"
fi
echo "Previous version is '$version'"
echo "::set-output name=previous_version::${version}"
echo "previous_version=${version}" >> $GITHUB_OUTPUT
- run: |
set -x
mkdir -p ./.ssh
@ -387,7 +387,7 @@ jobs:
steps:
- name: Delete old snapshots
run: |
for snapshot in $(hcloud image list -t snapshot -o noheader -o columns=id | head -n -20)
for snapshot in $(hcloud image list -t snapshot -o noheader -o columns=id | head -n -16)
do
echo "Deleting snapshot '$snapshot'..."
hcloud image delete "$snapshot"

View File

@ -45,19 +45,19 @@ close_summary
##
open_summary "Nextcloud configuration"
sudo -u www-data php /var/www/nextcloud/occ config:list system
sudo -u www-data php /var/www/nextcloud/occ config:list system 2>&1 || true
close_summary
##
open_summary "HTTPd logs"
tail -20 /var/log/apache2/error.log
tail -20 /var/log/apache2/error.log 2>&1 || true
close_summary
##
open_summary "Database logs"
tail -20 /var/log/mysql/*.log
tail -20 /var/log/mysql/*.log 2>&1 || true
close_summary
##
@ -66,7 +66,7 @@ DATADIR="$( grep datadirectory /var/www/nextcloud/config/config.php |
awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )"
open_summary "Nextcloud logs"
tail -20 "$DATADIR"/nextcloud.log
tail -20 "$DATADIR"/nextcloud.log 2>&1 || true
close_summary
# License

View File

@ -31,7 +31,7 @@ DIR="$( cd "$( dirname "$BACKUPFILE" )" &>/dev/null && pwd )" #abspath
[[ "$DIR" =~ "$NCDIR" ]] && { echo "Refusing to restore from $NCDIR"; exit 1; }
TMPDIR="$( mktemp -d "$( dirname "$BACKUPFILE" )"/ncp-restore.XXXXXX )" || { echo "Failed to create temp dir" >&2; exit 1; }
grep -q -e ext -e btrfs -e zfs <( stat -fc%T "$TMPDIR" ) || { echo "Can only restore from ext/btrfs/zfs filesystems" >&2; exit 1; }
grep -q -e ext -e btrfs -e zfs <( stat -fc%T "$TMPDIR" ) || { echo "Can only restore from ext/btrfs/zfs filesystems (found '$(stat -fc%T "${TMPDIR}")" >&2; exit 1; }
TMPDIR="$( cd "$TMPDIR" &>/dev/null && pwd )" || { echo "$TMPDIR not found"; exit 1; } #abspath
cleanup(){ local RET=$?; echo "Cleanup..."; rm -rf "${TMPDIR}"; trap "" EXIT; exit $RET; }
@ -77,6 +77,7 @@ then
[[ -d "$target" ]] && target="$NCDIR/.data_$(date)"
mv -T "$DATA_BKP_DIR" "$target"
else
echo "Not overwriting data directory"
fi
if [[ -n "$DATA_BKP_DIR" ]]

View File

@ -37,7 +37,7 @@ configure()
local BASEDIR=$( dirname "$DBDIR" )
mkdir -p "$BASEDIR"
grep -q -e ext -e btrfs <( stat -fc%T "$BASEDIR" ) || { echo -e "Only ext/btrfs filesystems can hold the data directory"; return 1; }
grep -q -e ext -e btrfs <( stat -fc%T "$BASEDIR" ) || { echo -e "Only ext/btrfs filesystems can hold the data directory (found '$(stat -fc%T "${BASEDIR}")"; return 1; }
sudo -u mysql test -x "$BASEDIR" || { echo -e "ERROR: the user mysql does not have access permissions over $BASEDIR"; return 1; }

View File

@ -79,8 +79,8 @@ configure()
ENCDIR="${BASEDIR}"/ncdata_enc
# checks
grep -q -e ext -e btrfs <( stat -fc%T "${BASEDIR}" ) || {
echo -e "Only ext/btrfs filesystems can hold the data directory"
[[ "$DISABLE_FS_CHECK" == 1 ]] || grep -q -e ext -e btrfs <( stat -fc%T "${BASEDIR}" ) || {
echo -e "Only ext/btrfs filesystems can hold the data directory (found '$(stat -fc%T "${BASEDIR}")')"
return 1
}

View File

@ -32,7 +32,10 @@ prepare_dirs # tmp cache output
## BUILD NCP
lxc delete -f ncp 2>/dev/null || true
systemd-run --user --scope -p "Delegate=yes" lxc launch -q images:debian/bullseye ncp
LXC_LAUNCH=(lxc launch -p default)
[[ -n "$LXD_EXTRA_PROFILE" ]] && LXC_LAUNCH+=(-p "$LXD_EXTRA_PROFILE")
LXC_LAUNCH+=(-q 'images:debian/bullseye' ncp)
systemd-run --user --scope -p "Delegate=yes" "${LXC_LAUNCH[@]}"
lxc config device add ncp buildcode disk source="$(pwd)" path=/build
lxc exec ncp -- bash -c 'while [ "$(systemctl is-system-running 2>/dev/null)" != "running" ] && [ "$(systemctl is-system-running 2>/dev/null)" != "degraded" ]; do :; done'
lxc exec ncp -- bash -c 'CODE_DIR=/build DBG=x bash /build/install.sh'

View File

@ -69,7 +69,8 @@ EXTRA_CONF=build/armbian/"config-$BOARD".conf
rm -rf armbian/output/images
mkdir -p armbian/userpatches
sed -e '/docker.*run/s/-it//' armbian/config/templates/config-docker.conf > armbian/userpatches/config-docker.conf
docker pull "ghcr.io/armbian/build:$(cut -d"." -f1-2 < armbian/VERSION)-$(dpkg --print-architecture)"
docker pull "ghcr.io/armbian/build:$(cut -d"." -f1-2 < armbian/VERSION)-$(dpkg --print-architecture)" \
|| docker pull "ghcr.io/armbian/build:latest-$(dpkg --print-architecture)"
armbian/compile.sh docker ncp
rm "$CONF"

View File

@ -68,13 +68,14 @@ systemctl restart mysqld # TODO this shouldn't be necessary, but somehow it's ne
install_app ncp.sh
run_app_unsafe bin/ncp/CONFIG/nc-init.sh
echo 'Moving data directory to a more sensible location'
df -h
mkdir -p /opt/ncdata
[[ -f "/usr/local/etc/nc-datadir.cfg" ]] || {
[[ -f "/usr/local/etc/ncp-config.d/nc-datadir.cfg" ]] || {
should_rm_datadir_cfg=true
cp etc/ncp-config.d/nc-datadir.cfg /usr/local/etc/nc-datadir.cfg
cp etc/ncp-config.d/nc-datadir.cfg /usr/local/etc/ncp-config.d/nc-datadir.cfg
}
run_app_unsafe bin/ncp/CONFIG/nc-datadir.sh
[[ -z "$should_rm_datadir_cfg" ]] || rm /usr/local/etc/nc-datadir.cfg
DISABLE_FS_CHECK=1 NCPCFG="/usr/local/etc/ncp.cfg" run_app_unsafe bin/ncp/CONFIG/nc-datadir.sh
[[ -z "$should_rm_datadir_cfg" ]] || rm /usr/local/etc/ncp-config.d/nc-datadir.cfg
rm /.ncp-image
# skip on Armbian / Vagrant / LXD ...