From 256e817b51d008d8a1b6fcba5840f5ac345269a6 Mon Sep 17 00:00:00 2001 From: Drew Reed Date: Tue, 10 Jan 2023 16:12:15 +0000 Subject: [PATCH] ci: Fix ssh key inclusion logic The logic used to only try and add the SSH keys for both the gitlab and gerrit servers is corrected to only try adding the keys when they are set in the environment. Signed-off-by: Drew Reed --- .gitlab/ci/cassini-build.yml | 4 ++-- .gitlab/ci/lava-test.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab/ci/cassini-build.yml b/.gitlab/ci/cassini-build.yml index 50a2199..6190f4f 100644 --- a/.gitlab/ci/cassini-build.yml +++ b/.gitlab/ci/cassini-build.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Arm Limited or its affiliates. All rights reserved. +# Copyright (c) 2022-2023 Arm Limited or its affiliates. All rights reserved. # # SPDX-License-Identifier: MIT --- @@ -27,7 +27,7 @@ before_script: - mkdir -p ~/.ssh - eval "$(ssh-agent -s)" - - if [ -z "${SSH_PRIVATE_GITLAB}+x" ]; then + - if [ -n "${SSH_PRIVATE_GITLAB+x}" ]; then echo "${SSH_PRIVATE_GITLAB}" | tr -d '\r' | ssh-add - > /dev/null; fi - ssh-keyscan -t rsa ${CI_SERVER_HOST} >> ~/.ssh/known_hosts diff --git a/.gitlab/ci/lava-test.yml b/.gitlab/ci/lava-test.yml index 5e4121a..5da6766 100644 --- a/.gitlab/ci/lava-test.yml +++ b/.gitlab/ci/lava-test.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Arm Limited or its affiliates. All rights reserved. +# Copyright (c) 2022-2023 Arm Limited or its affiliates. All rights reserved. # # SPDX-License-Identifier: MIT --- @@ -42,7 +42,7 @@ echo "Building FPGA image set for Corstone1000 MPS3 board" mkdir -p ~/.ssh eval "$(ssh-agent -s)" - if [ -n "${SSH_PRIVATE_GERRIT}+x" ]; then + if [ -n "${SSH_PRIVATE_GERRIT+x}" ]; then echo "${SSH_PRIVATE_GERRIT}" | tr -d '\r' | ssh-add - > /dev/null; fi ssh-keyscan -t rsa ${CI_SERVER_HOST} >> ~/.ssh/known_hosts -- GitLab