Please help fill in this template with all the details to help others help you more efficiently. Use formatting blocks for code, config, logs and ensure to remove sensitive data.
Problem to solve
Describe your question in as much detail as possible:
Hi all,
We recently migrated our CI from Bamboo to self-hosted GitLab. The build works, but we’re stuck on deployment. I’d like to know how others handle this setup.
Setup
- Self-hosted GitLab, with runners using the Docker autoscaler/fleeting executor (instances are created on demand).
- The old Bamboo deployment ran
scpto upload an EAR file to an application server, then ransshto execute a deploy script on that server. - Bamboo agents sit in the same internal network zone as the target servers.
- The GitLab runners sit in a different network zone.
Steps to reproduce
Problem 1
A manual test job on the runner times out when connecting to the target server on TCP port 22:
nc -zv -w 5 “$DEPLOY_HOST” 22 nc: (:22): Operation timed out
DNS resolves correctly, and the same host is reachable from the Bamboo agent. A timeout rather than “connection refused” suggests a firewall drop between the zones.
Problem 2
apk add --no-cache openssh-client fails in the job container with DNS lookup error for the Alpine mirrors, so we can’t install packages at runtime. The runner can pull images and download artifacts from GitLab, but the job containers have no outbound internet access.
deploy-test: stage: deploy image: alpine:3.20 when: manual before_script: - apk add --no-cache openssh-client # fails: no internet - cp “$SSH_PRIVATE_KEY_FILE” ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519 script: - scp target/app.ear_* “$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_DIR” - ssh “$DEPLOY_USER@$DEPLOY_HOST” “cd $DEPLOY_DIR && sh ~/bin/deploy.sh app”
The SSH key is stored as a protected File variable.
Questions
- What is the recommended pattern for deploying to servers in a restricted network zone when the shared runners live elsewhere? Is a dedicated runner inside the target zone, selected with
tags:, the usual answer? - If a runner has to sit in that zone, are there best practices for placing and securing it (for example, limiting it to protected branches or specific projects)?
- For autoscaling runners, how do you give a firewall team a stable source range to allow? Can fleeting instances be pinned to a fixed subnet or NAT address?
- How do you provide ssh/scp in an environment without internet? Options I’m considering are a pre-built image in the GitLab Container Registry, the Dependency Proxy, or a runner-level HTTP proxy. Which works best, and are there pitfalls?
- Is there a better approach than SSH from the runner, such as a pull-based deployment or an agent on the target?
Configuration
Add the CI/CD configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml). Alternatively, create a public GitLab.com example project that provides all necessary files to reproduce the question.
Versions
Please select whether options apply, and add the version information.
- Self-managed
-
GitLab.comSaaS - Dedicated
- Self-hosted Runners
Versions
-
GitLab Enterprise Edition v19.5.4-ee
- GitLab Runner, if self-hosted (Web
/admin/runnersor CLIgitlab-runner --version):
Helpful resources
- Check the FAQ for helpful documentation, issues/bugs/feature proposals, and troubleshooting tips.
- Before opening a new topic, make sure to search for keywords in the forum search
- Check the GitLab and GitLab Runner projects for existing issues. If you encounter a bug, please create a bug report issue.
- Review existing troubleshooting docs.
Thanks for taking the time to be thorough in your request, it really helps! ![]()