With workflows, cloning another repo times out



Due to our setup our database migrations and seeders are in another repo. Before workflows we had a step that just cloned in the new repo and ran the necessary commands and that is working fine.

With workflows though, that same step suddenly runs into this:

Cloning into '/tmp/database-migrations'...
The authenticity of host 'github.com (' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? Too long with no output (exceeded 10m0s)

Not sure if this is a workflows specific thing or not, just seem to notice it only while workflow builds are running. Not sure what would be the best way to resolve this either.


That’s kind of weird- we should have already authorized that host. Are you changing $HOME or using a different user in that context? You might need cp ~/.ssh/known_hosts to somewhere else to authorize that host.


Not at all. The .sh file in question looks like this: (minus some details)


git clone git@github.com:Organization/repo.git /tmp/database-migrations

cd /tmp/database-migrations
if [ `git branch -r --list | egrep "^  origin/+${CIRCLE_BRANCH}$"` ]
  echo "Checking out branch: '$CIRCLE_BRANCH'"
  git checkout $CIRCLE_BRANCH

(cd /tmp/database-migrations && \
composer install --prefer-dist --no-interaction --no-dev --no-progress && \
cp /tmp/api/.env.circleci .env && \
php artisan migrate:refresh --seed)


But I should point out this is happening in a job that doesn’t run y’alls built in checkout command (checkout happens in a separate build job), which I can see is setting up the hosts for github and bitbucket. Most likely related to that?


Oh! Definitely related. Just go grab our command from a different of your 2.0 builds and include those setup lines. This will all work afterwards. It’s just getting your known_hosts configured to accept GitHub without being prompted.


Looks like I just need this part

set -e

# Workaround old docker images with incorrect $HOME
# check https://github.com/docker/docker/issues/2968 for details
if [ "${HOME}" = "/" ]
  export HOME=$(getent passwd $(id -un) | cut -d: -f6)

mkdir -p ~/.ssh

echo '
github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==
' >> ~/.ssh/known_hosts


Follow up for anyone interested, slapping the above code block somewhere in your steps gets the job done.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.