Skip to content

Commit

Permalink
Merge pull request #1755 from nextcloud/devel
Browse files Browse the repository at this point in the history
Update to 1.51.1
  • Loading branch information
theCalcaholic authored Apr 8, 2023
2 parents 0827781 + 81d4d68 commit b85d8ff
Show file tree
Hide file tree
Showing 16 changed files with 234 additions and 99 deletions.
98 changes: 66 additions & 32 deletions .github/workflows/build-lxd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
git_ref:
required: true
type: string
arch:
required: false
type: string
default: 'x86'
outputs:
artifact_name:
value: "${{ jobs.build-current.outputs.artifact_name }}"
Expand All @@ -20,52 +24,54 @@ on:
- release/*

jobs:
build-current:
determine-runner:
env:
LXD_ARCH: "${{ inputs.arch || 'x86' }}"
runs-on: ubuntu-20.04
outputs:
runner_label: ${{ steps.script.outputs.runner_label }}
steps:
- name: script
id: script
run: |
if [[ "${LXD_ARCH}" == "arm64" ]]
then
RUNNER_LABEL=ubuntu-20.04-arm64
else
RUNNER_LABEL=ubuntu-20.04
fi
echo "runner_label=$RUNNER_LABEL" | tee -a $GITHUB_OUTPUT
build-current:
needs:
- determine-runner
runs-on:
- ${{ needs.determine-runner.outputs.runner_label }}
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"
ARTIFACT_NAME: "${{ github.run_id }}-lxd-${{ inputs.arch || 'x86' }}-image"
LXD_ARCH: "${{ inputs.arch || 'x86' }}"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: "${{ env.VERSION }}"
- name: Cleanup lxd
run: test -z "$(lxc profile device show default | grep eth0)" || lxc profile device remove default eth0
- 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
- name: Pack LXD image
id: pack-lxd
run: |
. ./build/buildlib.sh
ARTIFACT_FILE="NextCloudPi_LXD_${VERSION//\//_}"
ARTIFACT_FILE="NextCloudPi_LXD_${LXD_ARCH:-x86}_${VERSION//\//_}"
lxc image export -q ncp/"${version}" "output/${ARTIFACT_FILE}"
echo "artifact_file=${ARTIFACT_FILE}.tar.gz" >> $GITHUB_OUTPUT
- name: upload LXD image to artifact store
Expand All @@ -77,14 +83,16 @@ jobs:

build-previous:
runs-on: ubuntu-20.04
if: ${{ inputs.arch == 'x86' || inputs.arch == '' }}
outputs:
artifact_name: "${{ env.ARTIFACT_NAME }}"
artifact_file: "${{ steps.pack-lxd.outputs.artifact_file }}"
previous_version: "${{ steps.checkout_previous_version.outputs.previous_version }}"
env:
VERSION: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
ARTIFACT_NAME: "${{ github.run_id }}-lxd-image-previous"
ARTIFACT_NAME: "${{ github.run_id }}-lxd-${{ inputs.arch || 'x86' }}-image-previous"
LXD_EXTRA_PROFILE: network
LXD_ARCH: "${{ inputs.arch || 'x86' }}"
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -132,14 +140,25 @@ jobs:
nictype: bridged
type: nic
EOF
- name: Set up QEMU
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: Download qemu binaries
run: |
wget -nv https://github.com/multiarch/qemu-user-static/releases/latest/download/qemu-aarch64-static -O qemu-aarch64-static
wget -nv https://github.com/multiarch/qemu-user-static/releases/latest/download/qemu-arm-static -O qemu-arm-static
chmod +x qemu-{arm,aarch64}-static
- name: Build LXD image
run: |
./build/build-LXD.sh
- name: Pack LXD image
id: pack-lxd
run: |
. ./build/buildlib.sh
ARTIFACT_FILE="NextCloudPi_LXD_${VERSION//\//_}"
ARTIFACT_FILE="NextCloudPi_LXD_${LXD_ARCH:-x86}_${VERSION//\//_}"
lxc image export -q ncp/"${version}" "output/${ARTIFACT_FILE}"
echo "artifact_file=${ARTIFACT_FILE}.tar.gz" >> $GITHUB_OUTPUT
- name: upload LXD image to artifact store
Expand All @@ -158,7 +177,7 @@ jobs:
artifact_file: "${{ steps.pack-lxd.outputs.artifact_file }}"
env:
VERSION: "${{ inputs.git_ref || github.ref }}"
ARTIFACT_NAME: "${{ github.run_id }}-lxd-image-updated"
ARTIFACT_NAME: "${{ needs.build-previous.outputs.artifact_name }}"
steps:
- uses: whywaita/setup-lxd@v1
with:
Expand Down Expand Up @@ -227,7 +246,7 @@ jobs:
run: |
set -x
. ./build/buildlib.sh
ARTIFACT_FILE="NextCloudPi_LXD_${VERSION//\//_}"
ARTIFACT_FILE="NextCloudPi_LXD_${LXD_ARCH:-x86}_${VERSION//\//_}"
lxc publish -q ncp -f --alias "ncp/updated"
mkdir -p output
lxc image export -q "ncp/updated" "output/${ARTIFACT_FILE}"
Expand All @@ -241,8 +260,9 @@ jobs:

test-fresh-install:
needs:
- determine-runner
- build-current
runs-on: ubuntu-20.04
runs-on: ${{ needs.determine-runner.outputs.runner_label }}
env:
VERSION: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
ARTIFACT_NAME: ${{ needs.build-current.outputs.artifact_name }}
Expand All @@ -252,10 +272,13 @@ jobs:
uses: actions/checkout@v3
with:
ref: "${{ env.VERSION }}"
- name: Cleanup lxd
run: test -z "$(lxc profile device show default | grep eth0)" || lxc profile device remove default eth0
- uses: whywaita/setup-lxd@v1
with:
lxd_version: latest/stable
- name: Fix LXD
continue-on-error: true
run: |
lxc profile create network
cat <<EOF | lxc profile edit network
Expand All @@ -267,8 +290,10 @@ jobs:
EOF
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
continue-on-error: true
- name: Setup GeckoDriver
uses: ChlodAlejandro/setup-geckodriver@latest
continue-on-error: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Selenium
Expand All @@ -277,12 +302,21 @@ jobs:
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
- name: Remove old lxd images
if: ${{ inputs.arch == 'arm64' }}
run: |
for img in $(lxc image list -c f -f csv)
do
lxc image delete "$img"
done
- name: Launch ncp container
run: |
set -x
. ./build/buildlib.sh
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 image import -q "./${ARTIFACT_FILE?}" --alias "ncp/test" || true
systemd-run --user --scope -p "Delegate=yes" lxc launch -q "ncp/test" ncp || \
sudo systemd-run --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)"
Expand Down
30 changes: 24 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,19 @@ permissions:
contents: write

jobs:
lxd:
lxd-x86:
if: ${{ inputs.lxd || github.event_name != 'workflow_dispatch' }}
uses: ./.github/workflows/build-lxd.yml
with:
git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
arch: 'x86'
secrets: inherit
lxd-arm64:
if: ${{ inputs.lxd || github.event_name != 'workflow_dispatch' }}
uses: ./.github/workflows/build-lxd.yml
with:
git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
arch: 'arm64'
secrets: inherit

docker-x86:
Expand Down Expand Up @@ -148,18 +156,28 @@ jobs:
board_name: OdroidC2
secrets: inherit

lxd-release:
lxd-x86-release:
needs:
- github-release
- lxd
- lxd-x86
if: ${{ inputs.lxd || github.event_name != 'workflow_dispatch' }}
uses: ./.github/workflows/publish-image.yml
with:
git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
artifact_id: "${{ needs.lxd.outputs.artifact_name }}"
artifact_file: "${{ needs.lxd.outputs.artifact_file }}"
artifact_id: "${{ needs.lxd-x86.outputs.artifact_name }}"
artifact_file: "${{ needs.lxd-x86.outputs.artifact_file }}"
dry_run: ${{ (!inputs.release && github.event_name == 'workflow_dispatch') || github.ref_type != 'tag' || !(github.ref_protected || startsWith(github.ref, 'refs/tags/v')) }}
lxd-arm64-release:
needs:
- github-release
- lxd-arm64
if: ${{ inputs.lxd || github.event_name != 'workflow_dispatch' }}
uses: ./.github/workflows/publish-image.yml
with:
git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
artifact_id: "${{ needs.lxd-arm64.outputs.artifact_name }}"
artifact_file: "${{ needs.lxd-arm64.outputs.artifact_file }}"
dry_run: ${{ (!inputs.release && github.event_name == 'workflow_dispatch') || github.ref_type != 'tag' || !(github.ref_protected || startsWith(github.ref, 'refs/tags/v')) }}
secrets: inherit

raspberrypi-release:
needs:
Expand Down
10 changes: 8 additions & 2 deletions bin/ncp-update-nc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ source /usr/local/etc/library.sh
cd "$BASEDIR"
DATADIR="$( get_nc_config_value datadirectory )"
ncc status &>/dev/null || { [[ "$DBG" == x ]] && ncc status; echo "Nextcloud is currently down"; exit 1; }
[[ -d /var/www/nextcloud-old ]] && { echo "Nextcloud backup directory found. Interrupted or already running installation?"; exit 1; }
[[ -d /var/www/nextcloud ]] || { echo "Nextcloud directory not found" ; exit 1; }
[[ -d "${BASEDIR}/nextcloud-old" ]] && { echo "Nextcloud backup directory found. Interrupted or already running installation?"; exit 1; }
[[ -d "${BASEDIR}/nextcloud" ]] || { echo "Nextcloud directory not found" ; exit 1; }
[[ -d "$DATADIR" ]] || { echo "Nextcloud data directory not found" ; exit 1; }

# check version
Expand Down Expand Up @@ -297,6 +297,12 @@ fi
# refresh completions
ncc _completion -g --shell-type bash -p ncc | sed 's|/var/www/nextcloud/occ|ncc|g' > /usr/share/bash-completion/completions/ncp

is_docker && {
killall notify_push
sleep 1
start_notify_push
}

echo "Update completed successfully."
# done
####################
Expand Down
13 changes: 7 additions & 6 deletions bin/ncp/CONFIG/nc-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,16 @@ EOF
ncc config:system:set mail_from_address --value="admin"
ncc config:system:set mail_domain --value="ownyourbits.com"

# NCP theme
# Fix NCP theme
[[ -e /usr/local/etc/logo ]] && {
local ID=$( grep instanceid config/config.php | awk -F "=> " '{ print $2 }' | sed "s|[,']||g" )
[[ "$ID" == "" ]] && { echo "failed to get ID"; return 1; }
mkdir -p data/appdata_${ID}/theming/images
cp /usr/local/etc/background data/appdata_${ID}/theming/images
cp /usr/local/etc/logo data/appdata_${ID}/theming/images/logo
cp /usr/local/etc/logo data/appdata_${ID}/theming/images/logoheader
chown -R www-data:www-data data/appdata_${ID}
local theming_base_path="data/appdata_${ID}/theming/global/images"
mkdir -p "${theming_base_path}"
cp /usr/local/etc/background "${theming_base_path}/"
cp /usr/local/etc/logo "${theming_base_path}/logo"
cp /usr/local/etc/logo "${theming_base_path}/logoheader"
chown -R www-data:www-data "data/appdata_${ID}"
}

mysql nextcloud <<EOF
Expand Down
Loading

0 comments on commit b85d8ff

Please sign in to comment.