summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml18
1 files changed, 11 insertions, 7 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 06c6286e..f1070f4f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,17 +24,19 @@ before_script:
# Store cache in the shared Docker volume
- export XDG_CACHE_HOME=/cache
+ # Create ~/.ssh for storing keys
+ - mkdir -p ~/.ssh
+
# Private key stored as a protected variable that allows pushing to
# ostree@ostree.baserock.org
- |
if [ -z "$baserock_ostree_cache_private_key" ]; then
echo >&2 "Private key for ostree.baserock.org is not available."
- exit 1
+ else
+ echo "$baserock_ostree_cache_private_key" > ~/.ssh/id_rsa
+ chmod 600 ~/.ssh/id_rsa
+ ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
fi
- mkdir -p ~/.ssh
- echo "$baserock_ostree_cache_private_key" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
# Trust the host key of the cache server.
- ssh-keyscan -p 22200 ostree.baserock.org >> ~/.ssh/known_hosts
@@ -44,8 +46,10 @@ before_script:
mkdir -p ~/.config
echo "artifacts:" > ~/.config/buildstream.conf
echo " pull-url: https://ostree.baserock.org/cache/" >> ~/.config/buildstream.conf
- echo " push-url: ostree@ostree.baserock.org:cache" >> ~/.config/buildstream.conf
- echo " push-port: 22200" >> ~/.config/buildstream.conf
+ if [ -n "$baserock_ostree_cache_private_key" ]; then
+ echo " push-url: ostree@ostree.baserock.org:cache" >> ~/.config/buildstream.conf
+ echo " push-port: 22200" >> ~/.config/buildstream.conf
+ fi
cat ~/.config/buildstream.conf
# Install and configure YBD