blob: 224ebe7c19cb745af8df7a4d8c6f99ccff3c9cb6 [file] [log] [blame]
#!/bin/bash -xe
SALT_OPTS="-l debug -t 10 --retcode-passthrough --no-color"
#aptly
# FIXME: remove duplicate run after fix: PROD-21387
# RC: aptly may fail to import gpg key's randomly(most probably,nw issue), so lets run it twice
salt-call ${SALT_OPTS} state.sls aptly.server || true
sleep 5
salt-call ${SALT_OPTS} state.sls aptly.server
salt-call ${SALT_OPTS} state.sls aptly.publisher
salt-call ${SALT_OPTS} state.sls aptly || true
sleep 5
salt-call ${SALT_OPTS} state.sls aptly
aptly_mirror_update.sh -sv
aptly-publisher --url http://10.99.0.1:18084 --timeout=1200 publish -v -d -c /etc/aptly/publisher.yaml --architectures amd64 --recreate --force-overwrite
#docker registry
salt-call ${SALT_OPTS} state.sls docker.client.registry
docker system prune --all --force || true
#debmirror
salt-call ${SALT_OPTS} state.sls debmirror
#git
salt-call ${SALT_OPTS} state.sls git.server
# Enable 'update' hook.
# Those would prevent failures for 2018q3+ model releases, where
# 'system.linux.system.repo.mcp.apt_mirantis.update.xxx' enabled by default
pushd /srv/volumes/aptly/public/
CUR_V=$(salt-call pillar.get _param:apt_mk_version --out text | awk '{print $2}')
mkdir -p update
ln -s ../${CUR_V} update/${CUR_V} || true
popd