8000 Add RESTRICT_HOSTNAME_PATTERN by sksat · Pull Request #106 · sksat/compose-cd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add RESTRICT_HOSTNAME_PATTERN #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions compose-cd
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ function load_global_config() {
}

function load_config() {
local ret
ret=0

compose_log echo -n "[$proj:load config] "
if [ ! -e ./.compose-cd ]; then
compose_log echo "config file not found"
Expand All @@ -126,6 +129,13 @@ function load_config() {

if [ -z ${RESTART_WITH_BUILD+x} ]; then RESTART_WITH_BUILD=false; fi

if [ -v RESTRICT_HOSTNAME_PATTERN ]; then
if ! expr "$(hostname)" : "${RESTRICT_HOSTNAME_PATTERN}" >/dev/null; then
# restricted but not match
ret=1 # skip update
fi
fi

if "$UPDATE_REPO_ONLY" && "$UPDATE_IMAGE_ONLY"; then
compose_log echo "UPDATE_REPO_ONLY and UPDATE_IMAGE_ONLY are true. This is something wrong."
exit 1
Expand All @@ -136,6 +146,7 @@ function load_config() {
fi

compose_log echo "ok"
return $ret
}

function service_up() {
Expand Down Expand Up @@ -361,13 +372,20 @@ function update_image() {

function project_update() {
local proj=$1
local rc
local rr
local ri

local before_script
local after_script

load_config
rc=$?
if [ $rc = 1 ]; then
# skip update
compose_log echo "skip update"
return
fi

rr=1
ri=1
Expand Down
0