Jenkins- flutter: command not found - jenkins

I am trying to configure a simple startup project. I am pulling the code from GIT and trying to create a build. Getting this error on local Jenkins,
[Flutter-Starter] $ /bin/sh /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/jenkins102165218853380431.sh
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/jenkins102165218853380431.sh: line 3: flutter: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
My Execute Shell has
#!/bin/sh
flutter build apk --debug
Flutter is installed and is working on my system. As the same command is creating the android build for me on Studio.
Here is the environment, from .bash_profile file.
...
export PATH=$PATH:/Users/rana.singh/Downloads/softwares/flutter/bin
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PATH=$PATH:Library/Android/sdk/platform-tools/
Not sure what is going wrong.

This is what I was missing. Just in case it could help someone else.
Remind you I had this in my .bash_profile already still, it was needed on Jenkins.
Goto Jenkins > Manage Jenkins > Configure System > Global Properties >

Related

I can't build and install a project with Cmake on Jenkins

I really need some help to build a simple project with Cmake with Jenkins.
I downloaded the Cmake plugin on Jenkins.
I configured it in the job :
and in Global Tool Configuration :
But then it doesn't work. Here are the end of the logs before the Jenkins build fails :
+ ls
CMakeLists.txt
MathFunctions
TutorialConfig.h.in
build
tutorial.cxx
[build] $ cmake /var/jenkins_home/workspace/Project
ERROR: Cannot run program "cmake" (in directory "/var/jenkins_home/workspace/Project/build"): error=2, No such file or directory
Build step 'CMake Build' marked build as failure
Finished: FAILURE
I don't understand why there is no proper step-by-step tutorial to create something that common as a Cmake build with Jenkins.
In the end, I managed to pull it off.
I uninstalled the Cmake plugin which seems to be useless apparently...
And I simply installed Cmake manually on the Jenkins container.

Not able to run maven command (mvn -version) through jenkins on mac machin but same command working fine for terminal of mac machine

Users/Shared/Jenkins/tmp/jenkins6366168807637424809.sh: line 2: mvn: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I tried to change the path of Maven in Jenkins but it did't work .
I have set maven path on Global tool configuration.
Name-M2_HOME
Path-/Applications/apache-maven-3.6.0
you should point the PATH to bin folder, like /Applications/apache-maven-3.6.0/bin

Jenkins dotnet command not found

I am trying to setup CI locally with Jenkins on OSX, however I am having some issues when trying to execute shell commands. Here are the commands I am trying to run in the Jenkins configuration:
cd /Users/username/projectname
dotnet build HD-Project.sln
However, when I try and build the project, I get the following errors:
Building in workspace /Users/Shared/Jenkins/Home/workspace/HD-Build
[HD-Build] $ /bin/sh -xe
/Users/Shared/Jenkins/tmp/jenkins2699993427980474696.sh
+ cd /Users/username/projectname
+ dotnet build HD-Project.sln
/Users/Shared/Jenkins/tmp/jenkins2699993427980474696.sh: line 3:
dotnet: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Any help would be greatly appreciated, thanks.
I got this working, and was successfully able to run dotnet commands through an executed shell via Jenkins.
To run dotnet commands, the .NET SDK needs to be installed on the Jenkins build server. Instructions on how to install the .NET SDK can be found here: https://www.microsoft.com/net/learn/get-started/macos for all OS - Linux, MacOS and Windows.
This happens because the installation package does not add the dotnet executable location to the PATH environment variable. This issue is mentioned in https://github.com/dotnet/core/blob/master/cli/known-issues.md#users-of-zsh-z-shell-dont-get-dotnet-on-the-path-after-install, but apparently it does not affect only zsh users. You need to add this path manually.
In my case the path was /usr/local/share/dotnet, so I ran (from the command line):
export PATH=/usr/local/share/dotnet:$PATH
Taken from https://github.com/dotnet/cli/issues/4357

command not found when executed from jenkins, but runs on mac agent

I have Jenkins set up on a Windows machine, with a mac slave configured.
When I run the command nuget directly from terminal, it works. However when I try running the nuget command from Jenkins as a executable shell, I get command not found
[iOS Build] $ /bin/sh -xe /var/folders/hr/b_p9skp53178b45895w2htw80000gn/T/hudson278562289764277217.sh
+ nuget restore '/Users/a/Jenkins/workspace/iOS Build/App/Acquaint.Native.sln'
/var/folders/hr/b_p9skp53178b45895w2htw80000gn/T/hudson278562289764277217.sh: line 2: nuget: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I already have the directory where nuget resides configured in the PATH environment variable
maybe:
echo $PATH within your job to ensure it's configured as you expect when the job runs.
try including the full path to nuget. run /usr/local/bin/nuget restore... (or wherever nuget is found) instead of nuget restore... to determine if it's really a PATH issue.

building failure in jenkins as build.sh: not found

I am building a free style project in jenkins. configure setting for execute shell script as
build.sh -label $JOB_NAME -$BUILD_NUMBER -java_home $JAVA_HOME
when i try to build the project, i have a console output as build failure.
Building in workspace /var/lib/jenkins/workspace/jmxweb
[jmxweb] $ /bin/sh -xe /tmp/hudson4723307331600368596.sh
+ build.sh -label jmxweb -8 -java_home /usr/lib/jvm/java-7-oracle
/tmp/hudson4723307331600368596.sh: 2: /tmp/hudson4723307331600368596.sh: build.sh: not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
According to the documentation
Builds for Non-Source Control Projects
There is sometimes a need to build a project simply for demonstration purposes or access to a SVN/CVS repository is unavailable. By choosing to configure the project as "None" under "Source Code Management" you will have to:
1 Build the Project at least once, (it will fail), but Jenkins will create the structure jenkins/workspace/PROJECTNAME/
2 Copy the project files to jenkins/workspace/PROJECTNAME/
3 Build again and configure appropriately
Try running : $WORKSPACE/build.sh -label $JOB_NAME -$BUILD_NUMBER -java_home $JAVA_HOME
The error is definitely because it can't find the file where you're looking for it. explicitly specifying the path should make sure it'll look for it in the current workspace.
Good luck!

Resources