Manage immich-sync with Argo CD
This commit is contained in:
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "$#" -ne 1 ] || ! printf '%s\n' "$1" | grep -Eq '^[0-9a-f]{40}$'; then
|
||||
echo "usage: $0 <full-lowercase-git-sha>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
repository_dir=$(dirname -- "${script_dir}")
|
||||
kustomization="${repository_dir}/apps/immich-sync/kustomization.yaml"
|
||||
temporary="${kustomization}.tmp"
|
||||
|
||||
awk -v tag="$1" '
|
||||
/^ newTag: / {
|
||||
if (updated) {
|
||||
print "multiple newTag fields found" > "/dev/stderr"
|
||||
exit 1
|
||||
}
|
||||
print " newTag: " tag
|
||||
updated = 1
|
||||
next
|
||||
}
|
||||
{ print }
|
||||
END {
|
||||
if (!updated) {
|
||||
print "newTag field not found" > "/dev/stderr"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
' "${kustomization}" > "${temporary}"
|
||||
mv "${temporary}" "${kustomization}"
|
||||
Reference in New Issue
Block a user