Deployment Using Jenkins task failed

@makadia.dhaval88 what section of the task is asking you to clone the repo? if you dont mind explaining that please?

Once the job is triggered we have to deploy the latest code. Latest code is in git and thus cloning comes into picture.
I hope it makes sense.

but you are already pushing the changes, then jobs is triggered to copy that into /data right?

The solution which I applied was to trigger Jenkins Build via Webhook and then wrote a script to execute on remote server i.e. Storage wherein I clone the git repo and copy to /data folder

1 Like

Hi,

Usually once you deploy code from any repository you never configure your deployment job to copy or update only single file (we can skip some files by keeping them in .gitignore etc though) but whatever we have under git repository it should be deployed so please make sure to configure your job to deploy the entire content of the repository on the destination, not only the index.html file. We have updated the question to make it more clear.

Also as of now we can not record your answers for Jenkins scenarios to review them further so could you please try to record your answer using some screen recording software such as loom.com ? You can directly share your answer with us in DM and we will review the same to identify the issues with this task.

Note: Avoid sharing your answers directly here on threads because we recommend others to try on their own rather than looking into the answers directly

1 Like

I am stuck on this task for days, it gets the following auth error? anyone has any ideas?

git rev-list --no-walk 165e67a938980150323bb2e4fa1ff524c577930d # timeout=10
SSH: Connecting from host [jenkins.stratos.xfusioncorp.com]
SSH: Connecting with configuration [ststor01] …
ERROR: Exception when publishing, exception message [Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [ststor01]. Message [Auth fail]]]
Build step ‘Send files or execute commands over SSH’ changed build result to UNSTABLE
Finished: UNSTABLE

When you add SSH servers you have an option to test the connection. Did you try that and confirm the connection is successfull.

the connection test is successful.

but when i try the copy script, it said authorization failed
beside the script, anything i need to do on the server?
send file over ssh
source file: */
exec command:
#!/bin/bash
sudo cp index.html /data

As per your exec command section, I think it’s failing because you are not passing the password with sudo command.
Sudo command will require the password (unless you have off this setting in the config file), and you can make use of sudo -S flag to pass the password.

I getting failure with below


Error

Git clone happens automatically for me, did not need that

Approach taken in my case was is mentioned here and as per the same “4.3 Build Scripts” were executed on App Servers and to do the same git clone was required.
Else I believe git clone would not require if it would be Jenkins Node itself where build got triggered.

I am also stuck with the same error for past one week. Can some one help me how to fix this issue. I have tried all the solution above but it didnt work. I am still getting unstable build. I have tested the connection with publish over ssh it was success. But my build is not passing through. I have give 777 permission the user i created and added the user to sudo group as well. No luck. Please help me.