Could not able to SSH/(SCP the file) into local machine from the circle

Viewed 151

I’m trying to deploy the jar file after building from circle ci by fetching from one of the Github repo into my local machine. Here are my config file and the steps which I followed.

# Use the latest 2.1 version of the CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
jobs:
  build-and-test:
    docker:
      - image: cimg/openjdk:11.0
    steps:
      - add_ssh_keys:
          fingerprints:
            - "a3:72:52:7d:19:e4:41:16:f1:87:ed:84:01:f9:d8:c0" // finger print ID 
      - checkout
      - run:
          name: Build
          command: mvn -B -DskipTests clean package
      - run:
          name: Test
          command: mvn test
      - run:
          name: Deploy Over SSH
          command: |
            scp -r /home/circleci/project/target/HelloWorld-1.0-SNAPSHOT.jar manjunathdavanam@$local_machine_ip_address:/Users/manjunathdavanam/test
workflows:
  sample:
    jobs:
      - build-and-test

Steps

  1. I have generated an ssh key from my local machine using this command ssh-keygen -t ed25519 -C email_id
  2. After creating an ssh key, Click on the project settings and add ssh key which is got generated from local and then after adding it will generate a fingerprint.
  3. I have copied the fingerprint id and pasted it into my config.yml file.
  4. I'm trying to copy the HelloWorld-1.0-SNAPSHOT.jar file into my local machine test folder using scp command. scp -r /home/circleci/project/target/HelloWorld-1.0-SNAPSHOT.jar manjunathdavanam@$local_machine_ip_address:/Users/manjunathdavanam/test
  5. I'm using mac laptop I have enabled the remote login = true and allow access for all users in the system preferences sharing section.
  6. for testing I tried to ssh from my local machine then I'm able to log in to the local machine.
  7. Now, I did ssh to circle the ci machine and tried ssh -v username@ipaddress inside the circle ci machine but I'm getting a time out error
  8. I have also checked the ssh config file inside the circle ci machine it's pointed to the right key. cat /home/circleci/.ssh/config

Host !github.com *
  IdentitiesOnly no
  IdentityFile /home/circleci/.ssh/id_rsa_a373527d19e44616f18fdf4328ed8401f

Could you please help me here what's wrong with my config file? Why I'm not able to SCP the file from circle ci machine to my local machine. ?

I have also raised the same in the CircleCI forum - https://discuss.circleci.com/t/could-not-able-to-ssh-scp-the-file-into-local-machine-from-the-circle/41508

0 Answers
Related