我在伊朗有一台服务器,我想使用 gitlab ci 打开一个到我的服务器的 ssh 隧道。
但是感谢谷歌云服务,gitlab 看不到伊朗 IP。
有没有什么办法可以使用伊朗以外的中间服务器打开从 gitlab 到我的代理服务器以及从那个到我的伊朗服务器的代理隧道,然后使用 docker 从 gitlab registery 中提取图像?
考虑伊朗服务器无法连接到 gitlab,而 gitlab 也无法连接到伊朗服务器。
谢谢
最佳答案
我用这样的代码成功了
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>&1
关于docker - 如何使用 ssh 代理在 gitlab ci 中运行部署作业?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53898891/