Verified Commit e99fc031 authored by anarcat's avatar anarcat
Browse files

move deploy stage to the template (team#40364)

parent 3cdeec30
Pipeline #18574 passed with stages
in 41 seconds
......@@ -14,6 +14,10 @@ variables:
SUBDIR: public/
project: tpo/tpa/ci-templates
file: static-shim-deploy.yml
stage: build
......@@ -34,34 +38,3 @@ pages:
- public
- merge_requests
# reuses artifacts from the previous (build) stage
image: debian:stable-slim
stage: deploy
resource_group: static-component-$SITE_URL
# the printf stuff below is
- printf '\e[0Ksection_start:%s:apt_setup\r\e[0K\e[36minstall requirements with apt\e[0m\n' "$(date +%s)"
- apt update
- apt-get dist-upgrade --yes --no-install-recommends --no-install-suggests
- apt-get install --yes --no-install-recommends --no-install-suggests openssh-client rsync
- printf '\e[0Ksection_end:%s:apt_setup\r\e[0K\n' "$(date +%s)"
- printf '\e[0Ksection_start:%s:ssh_cleanup\r\e[0K\e[36mbuilding a fake .ssh directory to fixup perms, because that cannot be done on the files from variables\e[0m\n' "$(date +%s)"
- mkdir .ssh
- cp "$STATIC_GITLAB_SHIM_SSH_PRIVATE_KEY" .ssh/private_key
- cp "$STATIC_GITLAB_SHIM_SSH_HOST_KEYS" .ssh/known_hosts
- chmod 400 .ssh/known_hosts .ssh/private_key
- echo "variables often lack a trailing newline, which breaks SSH, detect and fix"
- ssh-keygen -y -f .ssh/private_key || echo >> .ssh/private_key
- echo "here is the SSH key we will deploy with"
- ssh-keygen -y -f .ssh/private_key
- printf '\e[0Ksection_end:%s:ssh_cleanup\r\e[0K\n' "$(date +%s)"
- printf '\e[0Ksection_start:%s:rsync\r\e[0K\e[36mrunning rsync\e[0m\n' "$(date +%s)"
- rsync --rsh="ssh -o UserKnownHostsFile=.ssh/known_hosts -i .ssh/private_key" --checksum --archive --verbose --delete "$SUBDIR""$SUBDIR"
- printf '\e[0Ksection_end:%s:rsync\r\e[0K\n' "$(date +%s)"
- printf '\e[0Ksection_start:%s:static-component\r\e[0K\e[36mrunning static-update-component\e[0m\n' "$(date +%s)"
- ssh -o UserKnownHostsFile=".ssh/known_hosts" -i ".ssh/private_key" static-update-component "$SITE_URL"
- printf '\e[0Ksection_end:%s:static-component\r\e[0K\n' "$(date +%s)"
- main
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment