Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- before_script:
- ##
- ## Install ssh-agent if not already installed, it is required by Docker.
- ## (change apt-get to yum if you use an RPM-based image)
- ##
- - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- ##
- ## Run ssh-agent (inside the pull environment)
- ##
- - eval $(ssh-agent -s)
- ##
- ## Give the right permissions, otherwise ssh-add will refuse to add files
- ## Add the SSH key stored in SSH_PRIVATE_KEY file type CI/CD variable to the agent store
- ##
- - chmod 400 "$SSH_PRIVATE_KEY"
- - ssh-add "$SSH_PRIVATE_KEY"
- ##
- ## Create the SSH directory and give it the right permissions
- ##
- - mkdir -p ~/.ssh
- - chmod 700 ~/.ssh
- - cp "$SSH_CONFIG" ~/.ssh/config
- - chmod 600 ~/.ssh/config
- ## debug
- ## Use ssh-keyscan to scan the keys of your private server.
- ## Replace example.com with your private server's domain name. Repeat that
- ## command if you have more than one server to connect to.
- ##
- - ssh-keyscan bastion.moymarketplace.ru >> ~/.ssh/known_hosts
- - chmod 644 ~/.ssh/known_hosts
- #- 'command -v curl >/dev/null || ( apt-get update -y && apt-get install curl -y )'
- #- curl -s ifconfig.me
- #- grep -vE "^$|#" /etc/ssh/ssh_config
- #- grep -vE "^$|#" ~/.ssh/config
- stages: # List of stages for jobs, and their order of execution
- - pull
- pull-job: # This job runs in the pull stage, which runs first.
- image: debian
- stage: pull
- script:
- - echo "Pull the code..."
- - ssh -v local.docs.moymarketplace.ru "cd /docker/slate && git pull && git log -p -2 && tree"
- - echo "Pull complete."
- only:
- - main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement