Jenkins, SSH plugin, 0 files transferred - ssh

We are a group of three doing a project using MEANJS, Bitbucket is our source control and we are using Jenkins for test automation and CI. We want to use Jenkins to pull from Bitbucket, build and run tests and then deploy the project via SSH to another machine.
We have a connection between Bitbucket and Jenkins, Jenkins is hosted on a windows server, after that we want to deploy our project via SSH and we are able to connect to our CentOS server using SSH, the connection is a success but the transfer always has 0 files:
Started by user Centris
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Evert
> C:\Program Files (x86)\Git\cmd\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> C:\Program Files (x86)\Git\cmd\git.exe config remote.origin.url https://evertJenkins:teamEvert#bitbucket.org/evert-team/evert.git # timeout=10
Fetching upstream changes from https://evertJenkins#bitbucket.org/evert-team/evert.git
> C:\Program Files (x86)\Git\cmd\git.exe --version # timeout=10 using .gitcredentials to set credentials
> C:\Program Files (x86)\Git\cmd\git.exe config --local credential.helper store --file=\"C:\Users\centris\AppData\Local\Temp\git2236090933781388612.credentials\" # timeout=10
> C:\Program Files (x86)\Git\cmd\git.exe fetch --tags --progress https://evertJenkins#bitbucket.org/evert-team/evert.git +refs/heads/*:refs/remotes/origin/*
> C:\Program Files (x86)\Git\cmd\git.exe config --local --remove-section credential # timeout=10
> C:\Program Files (x86)\Git\cmd\git.exe rev-parse "origin/master^{commit}" # timeout=10
Checking out Revision b0ca93376cb8b1799a069a7e33e212ebc886261a (origin/master)
> C:\Program Files (x86)\Git\cmd\git.exe config core.sparsecheckout # timeout=10
> C:\Program Files (x86)\Git\cmd\git.exe checkout -f b0ca93376cb8b1799a069a7e33e212ebc886261a
> C:\Program Files (x86)\Git\cmd\git.exe rev-list b0ca93376cb8b1799a069a7e33e212ebc886261a # timeout=10
> C:\Program Files (x86)\Git\cmd\git.exe tag -a -f -m Jenkins Build #39 jenkins-Evert-39 # timeout=10
SSH: Connecting from host [centris]
SSH: Connecting with configuration [Centris leit] ...
SSH: Disconnecting configuration [Centris leit] ...
SSH: Transferred 0 file(s)
Build step 'Send files or execute commands over SSH' changed build result to SUCCESS
SSH: Connecting from host [centris]
SSH: Connecting with configuration [Centris leit] ...
SSH: Disconnecting configuration [Centris leit] ...
SSH: Transferred 0 file(s)
Finished: SUCCESS
Our project is named Evert and thus it is located under workspace\Evert.
We have tried all forms of strings for our source files, from a full path down to what we have now that is:
Evert\**\*
We also have remove prefix set as:
Evert\
we have tried following this: Jenkins transferring 0 files using publish over SSH plugin but we still have the same problem. Can anyone please tell us what might be the problem.

You could simply archive it and scp the archive to the CentOS machine. Not all Jenkins plugins are created equal.

I had this problem and found 2 issues:
the files in the transfer set are relative to the job workspace. So you just use **
setting a destination directory in the SSH server setup and on the SSH server in the build configuration causes it to double the path (i.e. /tmp in both places results in /tmp/tmp)

Related

gitlabrunner unable to clone repo

I am using gitlab UI to deploy rancher via TF, job runs on GitLab Runner as a container on linux VM.
below is the config of.gitlab-ci.yml
- echo "https://gitlab-ci-token:${CI_JOB_TOKEN}#git.myservice.demo.com" >> ~/.git-credentials
- git config --global credential.helper 'store --file ~/.git-credentials'
when i run the pipeline it fail to clone the repo , i have active deployment token not sure why its failing.
Any guidance will be appreciated as very new to gitlab.
Pipeline error
Running with gitlab-runner 13.2.1 (efa30e33)
on b069898257b6 HpcxYCyA
Preparing the "docker" executor
00:05
Using Docker executor with image hashicorp/terraform:0.12.29 ...
Pulling docker image hashicorp/terraform:0.12.29 ...
Using docker image sha256:323b4bbc567117d19a68bcfe71e87ce9be855674005f645e41c8faedf4c263cb for hashicorp/terraform:0.12.29 ...
Preparing environment
00:02
Running on runner-hpcxycya-project-257-concurrent-0 via 7d0ddeb92b75...
Getting source from Git repository
00:02
$ git config --global http.proxy $HTTP_PROXY; git config --global https.proxy $HTTPS_PROXY
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/demo/rancher-prod/.git/
fatal: unable to access 'https://git.myservice.demo.com/demo/rancher-prod.git/': SSL certificate problem: unable to get local issuer certificate
ERROR: Job failed: exit code 1
# openssl s_client -connect git.myserives.demo.com:443
140605252743616:error:0200206E:system library:connect:Connection timed out:../crypto/bio/b_sock2.c:110:
140605252743616:error:2008A067:BIO routines:BIO_connect:connect error:../crypto/bio/b_sock2.c:111:
connect:errno=110

Unable to deploy my Vue app on github pages

I followed the doc for deploying my vue app on gh-pages but running into an error. Here is my deploy.sh as mentioned on the official doc https://cli.vuejs.org/guide/deployment.html#github-pages:
#!/usr/bin/env sh
# abort on errors
set -e
# build
npm run build
# navigate into the build output directory
cd dist
# if you are deploying to a custom domain
# echo 'www.example.com' > CNAME
git init
git add -A
git commit -m 'deploy'
# if you are deploying to https://<USERNAME>.github.io
# git push -f git#github.com:<USERNAME>/<USERNAME>.github.io.git master
# if you are deploying to https://<USERNAME>.github.io/<REPO>
git push -f git#github.com:VishalGulati/vue-grid-poc.git master:gh-pages
cd -
Here is the error I am getting:
git#github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
PS - I ran the deploy.sh on my branch gh-pages. My app is buit using vue-cli 4.
What could be going wrong?

Scp copies data to server from GitLab and exit with code 1: No such file or directory

I have my script on GitLab, and I would like to copy my scripts to my server in deploy pipeline. I create env variables with my USER_IP and USER_PASS for sshpass comand. This is the output of my pipeline:
$ sshpass -e scp -o stricthostkeychecking=no -r project root#${USER_IP}:/opt
Warning: Permanently added '1.2.3.4' (ECDSA) to the list of known hosts.
root#: No such file or directory
ERROR: Job failed: exit code 1
The problem is, the pipeline faild, but data has been copied to server. So why The job failed with exit code 1 and message root#: No such file or directory?
Is there better way how to deploy data to server from GitLab?

Git clone from remote server failing in bitbucket pipelines

I'm trying to automatically deploy my app to digital ocean through bitbucket pipelines. Here are the steps my deployment is following:
connect to the remote digital ocean droplet using ssh
clone my repository by running a git clone with ssh
launch my application with docker-compose
I have successfully setup ssh access to my remote. I have also configured ssh access to my repository and can successfully execute git clone from my remote server.
However, in the pipeline, while connection to the remote server is successfull, the git clone command fails with the following error.
git#bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Anybody has an idea of what is going on here?
Here is my bitbucket-pipelines.yml
image: atlassian/default-image:latest
pipelines:
default:
- step:
deployment: production
script:
- cat deploy.sh | ssh $USER_NAME#$HOST
- echo "Deploy step finished"
And the deployment script deploy.sh
#!/usr/bin/env sh
git clone git#bitbucket.org:<username>/<my_repo>.git
cd my_repo
docker-compose up -d
Logs for the git clone ssh commands within the droplet and from the pipeline
Git uses the default ssh key by default.
You can overwrite the SSH command used by git, by setting the GIT_SSH_COMMAND environment variable. You can add the -i argument to use a different SSH key.
export GIT_SSH_COMMAND="ssh -i ~/.ssh/<key>"
git clone git#bitbucket.org:<username>/<my_repo>.git
From the git documentation:
GIT_SSH
GIT_SSH_COMMAND
If either of these environment variables is set then git fetch and git push will use the specified command instead of ssh when they need to connect to a remote system. The command-line parameters passed to the configured command are determined by the ssh variant. See ssh.variant option in git-config[1] for details.
$GIT_SSH_COMMAND takes precedence over $GIT_SSH, and is interpreted by the shell, which allows additional arguments to be included. $GIT_SSH on the other hand must be just the path to a program (which can be a wrapper shell script, if additional arguments are needed).
Usually it is easier to configure any desired options through your personal .ssh/config file. Please consult your ssh documentation for further details.

MSBUILD : error MSB1005: Specify a property and its value

I have tried to build .Net project using MSBuild in Bamboo and in MSBuild comman line switches I have provided /p:PublishDir=D:\Atlassian\home\bamboo\xml-data\build-dir\AP-BUILD-JOB1; /p:VisualStudioVersion=12.0 so i got the below error
MSBUILD : error MSB1005: Specify a property and its value.
Added job called MSBUild and provide .Net project details like solution file and all
Not sure has much to do with Bamboo - looks like an MSBUILD command syntax error. Here is their doc on error: https://msdn.microsoft.com/en-us/library/h8h04acf.aspx.
Looks like maybe a separator issue? It says semi-colon or comma can be used to separate properties, or the /p: may be repeated - but you've done both. You have a semi-colon and you're also repeating /p: - so you have two of what they consider to be separators back to back.
MSB1005: Specify a property and its value.
Rebuilds build #16
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building in workspace C:\Program Files (x86)\Jenkins\workspace\First Windows Project
No credentials specified
git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
git.exe config remote.origin.url https://github.com/pronobeshm/PdftoWord.git # timeout=10
Fetching upstream changes from https://github.com/pronobeshm/PdftoWord.git
git.exe --version # timeout=10
git.exe fetch --tags --force --progress -- https://github.com/pronobeshm/PdftoWord.git +refs/heads/:refs/remotes/origin/ # timeout=10
git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision b41ae8f43b6760d2da87091f907d2640ff42db6b (refs/remotes/origin/master)
git.exe config core.sparsecheckout # timeout=10
git.exe checkout -f b41ae8f43b6760d2da87091f907d2640ff42db6b # timeout=10
Commit message: "This is my First Commit to the Github"
git.exe rev-list --no-walk b41ae8f43b6760d2da87091f907d2640ff42db6b # timeout=10
New run name is '#17'
Path To MSBuild.exe: C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe
Executing the command cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" /p:Deploy=True;Configuration=Debug; %workspace%/FormatToFormat/FormatToFormat.sln " && exit %%ERRORLEVEL%% from C:\Program Files (x86)\Jenkins\workspace\First Windows Project
[First Windows Project] $ cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" /p:Deploy=True;Configuration=Debug; %workspace%/FormatToFormat/FormatToFormat.sln " && exit %%ERRORLEVEL%%
Active code page: 1252
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1005: Specify a property and its value.
Switch: /p:Deploy=True;Configuration=Debug;
For switch syntax, type "MSBuild /help"
Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure
New run name is '#17'
Finished: FAILURE