image: ubuntu

before_script:
  - echo "Hello, $GITLAB_USER_LOGIN!"
  - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
  - eval $(ssh-agent -s)
  - echo "$SSH_PRIVATE_KEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
  - mkdir -p ~/.ssh
  - chmod 700 ~/.ssh
  # - ssh-keyscan 193.196.53.93 > ~/.ssh/known_hosts
  # - ssh-keyscan bwunicluster.scc.kit.edu > ~/.ssh/known_hosts
  - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
  - chmod 644 ~/.ssh/known_hosts

Test SSH:
    script:
      - ssh -J ubuntu@193.196.53.93 $USER_NAME "test/testscript.sh"
      # - GITLAB_KEY=$(echo "$GITLAB_KEY" | tr -d '\r' | tr -d '\n')
      # - ssh -J ubuntu@193.196.53.93 $USER_NAME "mkdir -p test_dir"
      # - scp testscript.sh $USER_NAME:~/test_dir/testscript.sh
      # - ssh $USER_NAME "chmod 700 test_dir/testscript.sh && sbatch -p single ./test_dir/testscript.sh $GITLAB_KEY"
