Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PrivateStorageio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PrivateStorage
PrivateStorageio
Merge requests
!138
Fix deployment key whitespace
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Fix deployment key whitespace
77.deployment-key-whitespace
into
develop
Overview
0
Commits
2
Pipelines
1
Changes
2
Merged
Fix deployment key whitespace
Jean-Paul Calderone
requested to merge
77.deployment-key-whitespace
into
develop
Jul 19, 2021
Overview
0
Commits
2
Pipelines
1
Changes
2
Fixes
#77 (closed)
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
986c3eb9
2 commits,
Jul 19, 2021
2 files
+
55
−
43
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
.gitlab-ci.yml
+
2
−
35
View file @ 986c3eb9
Edit in single-file editor
Open in Web IDE
Show full file
@@ -73,41 +73,8 @@ system-tests:
# A template for a job that can update one of the grids.
.update-grid
:
&UPDATE_GRID
stage
:
"
deploy"
script
:
# Announce our intentions.
-
|
echo "Hello $GITLAB_USER_LOGIN from $CI_JOB_NAME. I was triggered by $CI_PIPELINE_SOURCE"
echo "and I am deploying the $CI_COMMIT_BRANCH branch to the $CI_ENVIRONMENT_NAME environment."
# Copy the deploy key from the environment to a file so we can actually
# tell ssh to use it.
-
|
# Make sure the deploy key file is not readable by anyone else. Not
# that there should be anyone else looking - but OpenSSH won't even read
# it if it looks like it is too open.
umask 077
# Make up a safe-ish place on the filesystem to write the key.
KEY_PATH="$(mktemp -d)/deploy_key"
# The environment variable holding the path to the key is configured
# with GitLab using Terraform so we can retain some bare minimum level
# of confidentiality.
#
# It contains the *path to the key*. It does not contain the key
# itself.
base64 --decode "${PRIVATESTORAGEIO_SSH_DEPLOY_KEY_PATH}" > "${KEY_PATH}"
# Update the deployment
-
|
./ci-tools/update-grid-servers "${KEY_PATH}" "${CI_ENVIRONMENT_NAME}"
# Remove the key from the filesystem to reduce the chance of unintentional
# disclosure. Overall our handling of this key is still not *particulary*
# safe or secure but that's why the key is only authorized to perform a
# single very specific operation.
-
|
rm -v "${KEY_PATH}"
script
:
|
env --ignore-environment - NIX_PATH=$NIX_PATH GITLAB_USER_LOGIN=$GITLAB_USER_LOGIN CI_JOB_NAME=$CI_JOB_NAME CI_PIPELINE_SOURCE=$CI_PIPELINE_SOURCE CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH ./ci-tools/update-grid-servers "${PRIVATESTORAGEIO_SSH_DEPLOY_KEY_PATH}" "${CI_ENVIRONMENT_NAME}"
# Update the staging deployment - only on a merge to the staging branch.
update-staging
:
Loading