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
- I have generated an ssh key from my local machine using this command
ssh-keygen -t ed25519 -C email_id - 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.
- I have copied the fingerprint id and pasted it into my config.yml file.
- I'm trying to copy the
HelloWorld-1.0-SNAPSHOT.jarfile into my local machinetestfolder usingscpcommand.scp -r /home/circleci/project/target/HelloWorld-1.0-SNAPSHOT.jar manjunathdavanam@$local_machine_ip_address:/Users/manjunathdavanam/test - I'm using mac laptop I have enabled the
remote login = trueandallow access for all usersin the system preferences sharing section. - for testing I tried to ssh from my local machine then I'm able to log in to the local machine.
- Now, I did ssh to circle the ci machine and tried
ssh -v username@ipaddressinside the circle ci machine but I'm getting a time out error - 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