我在伊朗有一台服务器,我想使用gitlab ci打开到我的服务器的ssh隧道。
但由于谷歌的云服务,gitlab看不到伊朗的IP地址。
有没有办法使用伊朗的中间服务器打开从gitlab到我的代理服务器的代理隧道,然后使用docker从gitlab registery中提取图像?
考虑到伊朗的服务器无法连接到gitlab,gitlab也无法连接到伊朗的服务器。
谢谢
发布于 2019-01-24 07:17:20
这对我来说也是有效的
deploy:
environment:
name: production
url: http://example.com
image: ubuntu:latest
stage: deploy
only:
- master
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
## Install rsync to create mirror between runner and host.
- apt-get install -y rsync
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- eval $(ssh-agent -s)
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 --decode)
- ssh -o StrictHostKeyChecking=no $SSH_USER@"$SSH_HOST" 'ls -la && ssh user@host "cd ~/api && docker-compose pull && docker-compose up -d"'我还在这里描述了我用波斯语做的所有事情:https://virgol.io/@aminkt
发布于 2019-01-22 01:39:42
我已经成功地使用了这样的代码
before_script:
- apt-get update -y
- apt-get install openssh-client curl -y
integration:
stage: integration
script:
- mkdir ~/.ssh/
- eval $(ssh-agent -s)
- echo "$SSH_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh -fN -L 1029:localhost:1729 user@$HOST -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no 2>&1
- ssh -fN -L 9013:localhost:9713 user@$HOST -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no 2>&1https://stackoverflow.com/questions/53898891
复制相似问题