Load exact deployment revision directly from local Gitea
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
1 parent
0158560a68
commit
fdc7ddeee2
1 file changed
+9
-7
+9
-7
@@ -2,13 +2,9 @@ when:
|
|||||||
branch: master
|
branch: master
|
||||||
event: push
|
event: push
|
||||||
|
|
||||||
clone:
|
# Both Gitea and this deployment already use the same Docker host. Read the
|
||||||
git:
|
# exact commit from its local bare repository, avoiding the broken upload-pack hook.
|
||||||
image: woodpeckerci/plugin-git
|
skip_clone: true
|
||||||
settings:
|
|
||||||
partial: false
|
|
||||||
depth: 1
|
|
||||||
lfs: false
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
deploy:
|
deploy:
|
||||||
@@ -18,6 +14,12 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
set -eu
|
set -eu
|
||||||
|
case "$CI_COMMIT_SHA" in
|
||||||
|
""|*[!0-9a-f]*) echo "Invalid deployment revision"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
docker exec gitea git --git-dir=/data/git/repositories/keith/keith-portfolio.git cat-file -e "$CI_COMMIT_SHA^{commit}"
|
||||||
|
docker exec gitea git --git-dir=/data/git/repositories/keith/keith-portfolio.git archive --format=tar "$CI_COMMIT_SHA" | tar xf -
|
||||||
|
echo "Loaded exact source revision $CI_COMMIT_SHA from local Gitea"
|
||||||
CONTAINER_ID="$(docker ps --filter publish=8091 --format '{{.ID}}' | head -n 1)"
|
CONTAINER_ID="$(docker ps --filter publish=8091 --format '{{.ID}}' | head -n 1)"
|
||||||
test -n "$CONTAINER_ID" || { echo "No running portfolio container found on port 8091"; exit 1; }
|
test -n "$CONTAINER_ID" || { echo "No running portfolio container found on port 8091"; exit 1; }
|
||||||
HOST_SITE="$(docker inspect "$CONTAINER_ID" --format '{{range .Mounts}}{{if eq .Destination "/usr/share/nginx/html"}}{{.Source}}{{end}}{{end}}')"
|
HOST_SITE="$(docker inspect "$CONTAINER_ID" --format '{{range .Mounts}}{{if eq .Destination "/usr/share/nginx/html"}}{{.Source}}{{end}}{{end}}')"
|
||||||
|
|||||||
Reference in new issue
Block a user