Jenkins npm build fails to unzip a package on Windows slave - node.js

I have added a windows slave to do npm build, in my package.json i have a step in which it performs "unzip pack.zip".
When i do npm build directly on the box it does everything successfully but when it gets done using Jenkins job, it fails to unzip the file i.e pack.zip
The file even gets extracted properly using tools like Unzip, Winrar and 7z etc.
I wrote the bat file to do npm build. when i ran it using cmd it worked without any issue but when i executed the same bat file from jenkins, it failed in the same extraction step.
Added log below:
inflating: saui-client/node_modules/sig-quote/node_modules/sig-core/node_modules/underscore/underscore-min.map
error: expected central file header signature not found (file #73741).
(please check that you have transferred or created the zipfile in the
appropriate BINARY mode and that you have compiled UnZip properly)
inflating: saui-client/node_modules/sig-quote/node_modules/sig-core/node_modules/underscore/underscore.js
D:\jenkins\workspace\BUILD>exit 3
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

The only thing that comes to mind without the log is that you set your slave environment after connecting it to Jenkins - maybe even installed NodeJS after connecting it - meaning the session you have on your computer is not the same as was loaded when Jenkins was connected to it. The simple solution is to disconnect the slave and reconnect it with the new environment so the session will have all it needs to run. When you will have the log I will update my answer.
Good luck!

Related

Getting "exec user process caused "no such file or directory"" error when trying to run Docker image

I'm trying to run a simple image that executes .sh file but I got this error.
standard_init_linux.go:185: exec user process caused "no such file or directory"
Here is my Dockerfile
FROM python:2
ADD . .
CMD ["./test.sh"]
test.sh:
#!/bin/bash
echo "test"
I'm running Docker in Windows 10 and I have checked '/bin/bash' is existed in the container.
Why I got this error?
I have faced the exact same issue when I tried to create a Linux container image with Docker on windows 10. When you copy the file from windows to docker image, the file format is that of dos. You may need to run dos2unix utility on all the files before copying them inside docker image.
To make things clear, I would share my experience. When I checked out my project source code using git on windows and tried to create a linux docker container by building the image locally, I got the exact same error message. This happened because I created my git project on Linux but this time, I checked out on windows. My default git global configuration on windows was checkout Windows-style commit Unix-style, i.e. Git will convert LF to CRLF when checking out text files. When committing text files, CRLF will be converted to LF. For cross-platform projects, this is the recommended setting on Windows ("core.autocrlf" is set to "true")
In order to resolve this, I changed my windows' git global config as I wanted to checkout Unix-style commit Unix-style.(How to change line-ending settings)
git config --global autocrlf input
After this, I checked out my project again and created a fresh local image that ran perfectly.

Installing Node in a linux grid server

So some background, I'm installing Node on a host server, but it's a grid server not a server that's solely for my website.
The grid server doesn't have a root user/ administrative powers. So to install node I found this workaround: http://iantearle.com/blog/media-temple-grid-and-nodejs . It's a Linux Grid server, I've never used Linux so if someone could explain to me what the commands mean, especially: ./configure --prefix=~/opt/
Lastly I followed the steps but when I try to run the node command in the server it says node:command not found - which is why I'm trying to understand the steps. Thanks
To explain the process:
Configure
The configure script is responsible for getting ready to build the software on your specific system. It makes sure all of the dependencies for the rest of the build and install process are available, and finds out whatever it needs to know to use those dependencies.
Unix programs are often written in C, so we’ll usually need a C compiler to build them. In these cases the configure script will establish that your system does indeed have a C compiler, and find out what it’s called and where to find it.
Make
Once configure has done its job, we can invoke make to build the software. This runs a series of tasks defined in a Makefile to build the finished program from its source code.
The tarball you download usually doesn’t include a finished Makefile. Instead it comes with a template called Makefile.in and the configure script produces a customised Makefile specific to your system.
3.Make Install
Now that the software is built and ready to run, the files can be copied to their final destinations. The make install command will copy the built program, and its libraries and documentation, to the correct locations.
--prefix=~/opt/ -> will set the build directory to /home/yourhome/opt directory.
Now if you didnt get errors while doing those 3 steps explained above make sure you did the following:
nano ~/.bash_profile
export PATH=~/opt/bin:${PATH}
nano is a text editor and you are opening .bash_profile file with it.
you need to add export PATH=~/opt/bin:${PATH} in that file and save it using ctrl+x
Then restart your terminal.
Specified github repository for nodejs is outdated. use the following link instead.
git clone https://github.com/nodejs/node.git
P.S node:command not found usually happens when the program is not installed correctly or it's executable isnt in your terminal's PATH variable.

Jenkins tfs plug-in and checkout source on remote node

First, I'm a Jenkins neophyte. I have made a free-style software project in Jenkins to perform my Linux build. The Jenkins server is running on Windows so there are slave nodes configured for doing this Linux build. The sources are kept in a TFS server.
I updated our TFS plugin to the latest of 4.0.0. This plugin says that it is no longer necessary for slave nodes to have the Team Explorer Everywhere package installed as it uses the Java API. However, when I kick off my build, I get this:
Started by user Andy Falanga (afalanga)
[EnvInject] - Loading node environment variables.
Building remotely on dmdevlnx64-01 (PY27-64 CENTOS6-64 LOG4CPLUS PY26-64) in workspace /home/builder/jenkins/workspace/Linux Autotools Build
Deleting project workspace... done
Querying for remote changeset at '$/Sources/Branches/Andy/AutotoolsMigration' as of 'D2015-10-05T18:26:27Z'...
Query result is: Changeset #4872 by 'WINNTDOM\afalanga' on '2015-09-25T23:36:24Z'.
Listing workspaces from http://ets-tfs:8080/tfs/SoftwareCollection...
... Long list of workspaces
Workspace Created by Team Build
Getting version 'C4872' to '/home/builder/jenkins/workspace/Linux Autotools Build'...
Finished getting version 'C4872'.
[Linux Autotools Build] $ /bin/bash /tmp/hudson7081873611439714406.sh
Bootstrapping autotools
/tmp/hudson7081873611439714406.sh: line 4: ./bootstrap: No such file or directory
Build step 'Execute shell' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE
I log into that system and look in the directory /home/builder/jenkins/workspace/Linux Autotools Build and sure enough, there's nothing there. My configuration is pretty simple.
I have discard old builds checked and a simple rotation (this is just me learning how to use it).
I have it set to "Restrict where the build is done" and a label which associates to the 3 slave nodes for doing this build.
All TFS credentials are input and correct.
No build triggers
A simple shell script for Build->Execute Shell which bootstraps the autotools and calls configure and then make.
What am I doing incorrectly?
I found the answer and am posting it here in case someone runs into this. This seems better than simply deleting the question. The TFS plugin doesn't seem to like spaces in the project name. The name before Linux Autotools Build which didn't work and the name now, LinuxAutotoolsBuild which does.
The errors provided by the Jenkins system didn't provide enough information for this to be apparent. After trying a few other things the thought occurred, "Perhaps the spaces are causing grief."
Hope this helps someone.

Qt creator cannot upload files onto the remote device

I have been using the QtCreator to develop qt application for my remote generic Linux device, when i press the 'Run' button, the program will be deployed into the targeted directory on the remote device and running automatically, everything is fine until recently, i just changed lines of code, but haven't change any settings of the project, after that i'm not able to upload the program onto the remote device anymore, in the .pro file:
TARGET = Test
target.files = Test
target.path = /home/root
INSTALLS += target
The compile output info shows that:
mkdir: cannot create directory '/home/root': permission denied
Failed to upload file...
Deploy step failed.
Error while building/deploying project Test
When executing step 'Upload files via SFTP'
This is confusing, because i'm not creating the directory but just deploy the program into it, that's what i did before and it worked alright.
I was suspecting maybe i need to update the SFTP to newer version, but based on the fact that i can still manually upload files to the remote device via SFTP without any problems, so i guess this is not the reason.
Is anyone here encountered this issue before? Any suggestions and comments are appreciated, and thanks in advance.
check /home/root folders can have rights to access by using command (ls -l)
I just found out the problem has nothing to do with ssh or access right.
It is because i have added more than one linux generic devices, but i'm using the kit for the project with selecting the wrong device.

Google protocol buffer installation failling in windows xp

I am trying to run these commands given in the read me of protocol buffer
$ ./configure
$ make
$ make check
$ make install
when I give ./configure, I get the error
bash: ./configure: No such file or directory
First of all, it seems like you haven't got to the right directory that has the executable file "configure."
If your goal is to install protocol buffer on Windows, specifically for Java, you can do the following steps:
Download 2 files from http://code.google.com/p/protobuf/downloads/list (get the most up-to-date version)
protobuf-2.4.1.zip
protoc-2.4.1-win32.zip (this is the pre-compiled file for easy install)
Follow instructions in README from the downloaded protobuf
Install Apache Maven
Follow instructions in README in the downloaded Apache Maven
Step 3 is the one that I spent a lot of times since I hadn't read the whole documentation in the first place and did a harder way. I suggest to do step 3B since it takes me 5 minutes instead of waiting to download cygwin.
[DIFFICULT]For compiling binary ourselves, download and Install cygwin (REMEMBER to select gcc)
Run ./configure, make, make check, make install
[EASY] Using pre-compiled binary:
Unzip protoc-2.4.1-win32.zip
Place protoc.exe in protobuf-2.4.1\src (notice that this is different than protobuf-2.4.1\java\src . Some people on the net is confused between these 2 files so they'll get "An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "../src/protoc"" exception and have to change the pom.xml file manually. If we place the protoc.exe in the correct folder, we don't have to modify anything as I'm aware of)
Place protoc.exe in PATH (i.e. protobuf-2.4.1\src)
Then, below is just the copy from README file
Check protoc by executing "protoc --version"
cd protobuf-2.4.1\java (which has the file "pom.xml")
run "mvn test", "mvn install", "mvn package"
Should not have any errors
you must run ./autogen.sh first

Resources