Skip to content

Commit

Permalink
(azure) use ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh committed Mar 20, 2023
1 parent 4341c8e commit 84e8b44
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,36 @@ jobs:
source ./set-branch.sh --branch=${SYSTEM_PULLREQUEST_TARGETBRANCH:-${BUILD_SOURCEBRANCH#refs/heads/}}
echo "##vso[task.setvariable variable=BRANCH]$BRANCH"
condition: and(succeeded(), not(canceled()))
- task: DownloadSecureFile@1
name: deployKey
displayName: 'Download Deploy Key'
inputs:
secureFile: deploy_key
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Install
env:
SSH_KNOWN_HOSTS: "github.com"
inputs:
targetType: inline
script: |
bash install-package.sh --package=$PACKAGE --branch=$BRANCH --commit=$BUILD_SOURCEVERSION --pullrequest=${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER:-false} --image="tuerobotics/tue-env-ros-noetic"
mkdir -p "${HOME}"/.ssh
cp $(deployKey.secureFilePath) "${HOME}"/.ssh/ci_ssh_key
bla="$(cat $(deployKey.secureFilePath))"
if [[ -z "${bla}" ]]
then
echo -e "\e[31m\e[1mSSH_DEPLOY_KEY is empty\e[0m"
exit 1
fi
if [[ -n "${SSH_KNOWN_HOSTS}" ]]
then
for host in ${SSH_KNOWN_HOSTS}
do
echo -e "\e[35m\e[1mssh-keyscan -t rsa -H \"${host}\" 2>&1 | tee -a ${HOME}/.ssh/known_hosts\e[0m"
ssh-keyscan -t rsa -H "${host}" 2>&1 | tee -a "${HOME}"/.ssh/known_hosts
done
fi
bash install-package.sh --package=$PACKAGE --branch=$BRANCH --commit=$BUILD_SOURCEVERSION --pullrequest=${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER:-false} --image="tuerobotics/tue-env-ros-noetic" --ssh --ssh-key="${HOME}"/.ssh/ci_ssh_key
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Build
Expand Down

0 comments on commit 84e8b44

Please sign in to comment.