This GitLab CI runner image allows to deploy a GitLab project to a remote Git repo (useful for Dokku, Heroku, Deis, etc.)
Create .gitlab-ci.yml:
image: ilyasemenov/gitlab-ci-git-push
stages:
- deploy
deploy to production:
stage: deploy
environment: production
only:
- master
script: git-push [email protected]:myapp
Go to GitLab > Project > Settings > CI/CD > Secret Variables, and add a variable SSH_PRIVATE_KEY:
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
Make sure your private ssh key is not encrypted, or Gitlab won't be able to authenticate to your SSH server. You'll know if it is encrypted if you open it up and the top has something like:
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
If it is, you can decrypt it by running: openssl rsa -in enc.key -out dec.key
By default, git-push will push to branch master of a remote repository (that's what Dokku wants). You can override this with:
git-push [email protected]:repo branch
git-push ssh://[email protected]:8022/myapp
By default, git push will be forced. You can disable force push by setting environment variable DISABLE_FORCE_PUSH to any value.
Content type
Image
Digest
Size
14.6 MB
Last updated
over 6 years ago
docker pull haliliceylan/gitlab-ci-git-push