From ecc47d63cc3232a3a1def3672ac326424d56f6e5 Mon Sep 17 00:00:00 2001 From: Mattt Date: Thu, 14 May 2020 02:06:59 -0700 Subject: [PATCH 1/4] Replace find / cp with rsync --- entrypoint.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 08a805c..915392c 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -50,11 +50,8 @@ tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) git pull "$GIT_REPOSITORY_URL" ) -debug "Enumerating contents of $1" -for file in $(find $1 -maxdepth 1 -type f -name '*.md' -execdir basename '{}' ';'); do - debug "Copying $file" - cp "$1/$file" "$tmp_dir" -done +debug "Syncing contents of $1 to repository" +rsync -avzr --delete --exclude='.git/' "$1" "$tmp_dir" debug "Committing and pushing changes" ( From d17ccfd9002037177e5dc4ada0428e17a5df2305 Mon Sep 17 00:00:00 2001 From: Mattt Date: Mon, 8 Jun 2020 08:01:14 -0700 Subject: [PATCH 2/4] Replace findutils with rsync --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8f8182c..e3039e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM alpine/git:latest -RUN apk add --no-cache bash findutils +RUN apk add --no-cache bash rsync COPY entrypoint.sh / RUN chmod +x /entrypoint.sh From e0639b4321625654f6e51415c0f450fb422c5783 Mon Sep 17 00:00:00 2001 From: Mattt Date: Mon, 8 Jun 2020 08:02:43 -0700 Subject: [PATCH 3/4] Add git to list of installed dependencies --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e3039e6..43e1f5a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM alpine/git:latest -RUN apk add --no-cache bash rsync +RUN apk add --no-cache bash rsync git COPY entrypoint.sh / RUN chmod +x /entrypoint.sh From 83d458dcd7bd52c9bdae0b0e9a413341551d15c2 Mon Sep 17 00:00:00 2001 From: Mattt Date: Fri, 18 Sep 2020 12:52:02 -0700 Subject: [PATCH 4/4] Exit with a failure if rsync command fails --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 915392c..2056526 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -51,7 +51,7 @@ tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) ) debug "Syncing contents of $1 to repository" -rsync -avzr --delete --exclude='.git/' "$1" "$tmp_dir" +rsync -avzr --delete --exclude='.git/' "$1" "$tmp_dir" || exit 1 debug "Committing and pushing changes" (