Pull request 2465: AGDNS-2909-upd-snap

Squashed commit of the following:

commit d865bfd703dcfe81b2317efe534aeb084eaa7b5c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Sep 3 14:40:56 2025 +0300

    all: upd snap
This commit is contained in:
Ainar Garipov
2025-09-03 15:08:51 +03:00
parent aab19465b3
commit 2bffd664f0
5 changed files with 26 additions and 29 deletions

View File

@@ -20,6 +20,7 @@ NOTE: Add new changes BELOW THIS COMMENT.
### Changed
- Our snap package now uses the `core24` image as its base.
- Outgoing HTTP requests now use the `User-Agent` header `AdGuardHome/v0.107.66` (where `v0.107.66` is the current version) instead of `Go-http-client/1.1` ([#7979]).
### Fixed

View File

@@ -10,7 +10,7 @@
# Make sure to sync any changes with the branch overrides below.
'variables':
'channel': 'edge'
'dockerSnap': 'adguard/snap-builder:1.1'
'dockerSnap': 'adguard/snap-builder:2.0'
'snapcraftChannel': 'edge'
'stages':
@@ -191,7 +191,7 @@
# need to build a few of these.
'variables':
'channel': 'beta'
'dockerSnap': 'adguard/snap-builder:1.1'
'dockerSnap': 'adguard/snap-builder:2.0'
'snapcraftChannel': 'beta'
# release-vX.Y.Z branches are the branches from which the actual final
# release is built.
@@ -207,5 +207,5 @@
# are the ones that actually get released.
'variables':
'channel': 'release'
'dockerSnap': 'adguard/snap-builder:1.1'
'dockerSnap': 'adguard/snap-builder:2.0'
'snapcraftChannel': 'candidate'

View File

@@ -182,6 +182,10 @@ Required environment:
Builds the Snapcraft packages from the binaries created by `download.sh`.
Optional environment:
- `SNAPCRAFT_CMD`: Overrides the Snapcraft command. Default: `snapcraft`.
### `download.sh`
Downloads the binaries to pack them into Snapcraft packages.

View File

@@ -19,6 +19,10 @@ log() {
fi
}
# Allow developers to overwrite the command, e.g. for testing.
snapcraft_cmd="${SNAPCRAFT_CMD:-snapcraft}"
readonly snapcraft_cmd
version="$(./AdGuardHome_amd64 --version | cut -d ' ' -f 4)"
if [ "$version" = '' ]; then
log 'empty version from ./AdGuardHome_amd64'
@@ -51,19 +55,7 @@ for arch in \
./snap/snap.tmpl.yaml \
>"${snap_dir}/meta/snap.yaml"
# TODO(a.garipov): The snapcraft tool will *always* write everything,
# including errors, to stdout. And there doesn't seem to be a way to change
# that. So, save the combined output, but only show it when snapcraft
# actually fails.
set +e
snapcraft_output="$(snapcraft pack "$snap_dir" --output "$snap_output" 2>&1)"
snapcraft_exit_code="$?"
set -e
if [ "$snapcraft_exit_code" -ne '0' ]; then
log "$snapcraft_output"
exit "$snapcraft_exit_code"
fi
"$snapcraft_cmd" pack "$snap_dir" --output "$snap_output"
log "$snap_output"

View File

@@ -11,17 +11,17 @@ set -e -f -u
channel="${CHANNEL:?please set CHANNEL}"
readonly channel
printf '%s %s\n' \
'386' 'i386' \
'amd64' 'amd64' \
'armv7' 'armhf' \
'arm64' 'arm64' \
| while read -r arch snap_arch; do
release_url="https://static.adtidy.org/adguardhome/${channel}/AdGuardHome_linux_${arch}.tar.gz"
output="./AdGuardHome_linux_${arch}.tar.gz"
while read -r arch snap_arch; do
release_url="https://static.adtidy.org/adguardhome/${channel}/AdGuardHome_linux_${arch}.tar.gz"
output="./AdGuardHome_linux_${arch}.tar.gz"
curl -o "$output" -v "$release_url"
tar -f "$output" -v -x -z
cp ./AdGuardHome/AdGuardHome "./AdGuardHome_${snap_arch}"
rm -f -r "$output" ./AdGuardHome
done
curl -o "$output" -v "$release_url"
tar -f "$output" -v -x -z
cp ./AdGuardHome/AdGuardHome "./AdGuardHome_${snap_arch}"
rm -f -r "$output" ./AdGuardHome
done <<-'EOF'
386 i386
amd64 amd64
armv7 armhf
arm64 arm64
EOF